types

package
v0.0.0-...-686c1ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2015 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bloom9 = bloom9

Functions

func BloomLookup

func BloomLookup(bin Bloom, topic bytesBacked) bool

func DeriveSha

func DeriveSha(list DerivableList) common.Hash

func IsContractAddr

func IsContractAddr(addr []byte) bool

func LogsBloom

func LogsBloom(logs state.Logs) *big.Int

func Number

func Number(b1, b2 *Block) bool

Types

type Block

type Block struct {
	// Preset Hash for mock (Tests)
	HeaderHash       common.Hash
	ParentHeaderHash common.Hash

	Td *big.Int

	ReceivedAt time.Time
	// contains filtered or unexported fields
}

func NewBlock

func NewBlock(parentHash common.Hash, coinbase common.Address, root common.Hash, difficulty *big.Int, nonce uint64, extra []byte) *Block

func NewBlockWithHeader

func NewBlockWithHeader(header *Header) *Block

func (*Block) AddReceipt

func (self *Block) AddReceipt(receipt *Receipt)

func (*Block) AddTransaction

func (self *Block) AddTransaction(transaction *Transaction)

func (*Block) Bloom

func (self *Block) Bloom() Bloom

func (*Block) CalculateUnclesHash

func (self *Block) CalculateUnclesHash() common.Hash

func (*Block) Coinbase

func (self *Block) Coinbase() common.Address

func (*Block) Copy

func (self *Block) Copy() *Block

func (*Block) DecodeRLP

func (self *Block) DecodeRLP(s *rlp.Stream) error

func (*Block) Difficulty

func (self *Block) Difficulty() *big.Int

Implement pow.Block

func (Block) EncodeRLP

func (self Block) EncodeRLP(w io.Writer) error

func (*Block) GasLimit

func (self *Block) GasLimit() *big.Int

func (*Block) GasUsed

func (self *Block) GasUsed() *big.Int

func (*Block) GetTransaction

func (self *Block) GetTransaction(i int) *Transaction

func (*Block) GetUncle

func (self *Block) GetUncle(i int) *Header

func (*Block) Hash

func (self *Block) Hash() common.Hash

func (*Block) HashNoNonce

func (self *Block) HashNoNonce() common.Hash

func (*Block) Header

func (self *Block) Header() *Header

func (*Block) MixDigest

func (self *Block) MixDigest() common.Hash

func (*Block) Nonce

func (self *Block) Nonce() uint64

func (*Block) Number

func (self *Block) Number() *big.Int

Header accessors (add as you need them)

func (*Block) NumberU64

func (self *Block) NumberU64() uint64

func (*Block) ParentHash

func (self *Block) ParentHash() common.Hash

func (*Block) Queued

func (self *Block) Queued() bool

func (*Block) Receipts

func (self *Block) Receipts() Receipts

func (*Block) RlpData

func (self *Block) RlpData() interface{}

func (*Block) RlpDataForStorage

func (self *Block) RlpDataForStorage() interface{}

func (*Block) Root

func (self *Block) Root() common.Hash

func (*Block) SetNonce

func (self *Block) SetNonce(nonce uint64)

func (*Block) SetQueued

func (self *Block) SetQueued(q bool)

func (*Block) SetReceipts

func (self *Block) SetReceipts(receipts Receipts)

func (*Block) SetRoot

func (self *Block) SetRoot(root common.Hash)

func (*Block) SetTransactions

func (self *Block) SetTransactions(transactions Transactions)

func (*Block) SetUncles

func (self *Block) SetUncles(uncleHeaders []*Header)

func (*Block) Size

func (self *Block) Size() common.StorageSize

func (*Block) String

func (self *Block) String() string

func (*Block) Time

func (self *Block) Time() int64

func (*Block) Transaction

func (self *Block) Transaction(hash common.Hash) *Transaction

func (*Block) Transactions

func (self *Block) Transactions() Transactions

func (*Block) Uncles

func (self *Block) Uncles() []*Header

func (*Block) ValidateFields

func (self *Block) ValidateFields() error

type BlockBy

type BlockBy func(b1, b2 *Block) bool

func (BlockBy) Sort

func (self BlockBy) Sort(blocks Blocks)

type BlockProcessor

type BlockProcessor interface {
	Process(*Block) (state.Logs, error)
}

type Blocks

type Blocks []*Block

type Bloom

type Bloom [bloomLength]byte

func BytesToBloom

func BytesToBloom(b []byte) Bloom

func CreateBloom

func CreateBloom(receipts Receipts) Bloom

func (Bloom) Big

func (b Bloom) Big() *big.Int

func (Bloom) Bytes

func (b Bloom) Bytes() []byte

func (*Bloom) SetBytes

func (b *Bloom) SetBytes(d []byte)

type DerivableList

type DerivableList interface {
	Len() int
	GetRlp(i int) []byte
}
type Header struct {
	// Hash to the previous block
	ParentHash common.Hash
	// Uncles of this block
	UncleHash common.Hash
	// The coin base address
	Coinbase common.Address
	// Block Trie state
	Root common.Hash
	// Tx sha
	TxHash common.Hash
	// Receipt sha
	ReceiptHash common.Hash
	// Bloom
	Bloom Bloom
	// Difficulty for the current block
	Difficulty *big.Int
	// The block number
	Number *big.Int
	// Gas limit
	GasLimit *big.Int
	// Gas used
	GasUsed *big.Int
	// Creation time
	Time uint64
	// Extra data
	Extra []byte
	// Mix digest for quick checking to prevent DOS
	MixDigest common.Hash
	// Nonce
	Nonce [8]byte
}

func (*Header) Hash

func (self *Header) Hash() common.Hash

func (*Header) HashNoNonce

func (self *Header) HashNoNonce() common.Hash

func (*Header) RlpData

func (self *Header) RlpData() interface{}

func (*Header) SetNonce

func (self *Header) SetNonce(nonce uint64)

func (*Header) String

func (self *Header) String() string

type Receipt

type Receipt struct {
	PostState         []byte
	CumulativeGasUsed *big.Int
	Bloom             Bloom
	// contains filtered or unexported fields
}

func NewReceipt

func NewReceipt(root []byte, cumalativeGasUsed *big.Int) *Receipt

func (*Receipt) Cmp

func (self *Receipt) Cmp(other *Receipt) bool

func (*Receipt) EncodeRLP

func (self *Receipt) EncodeRLP(w io.Writer) error

func (*Receipt) RlpEncode

func (self *Receipt) RlpEncode() []byte

func (*Receipt) SetLogs

func (self *Receipt) SetLogs(logs state.Logs)

func (*Receipt) String

func (self *Receipt) String() string

type Receipts

type Receipts []*Receipt

func (Receipts) GetRlp

func (self Receipts) GetRlp(i int) []byte

func (Receipts) Len

func (self Receipts) Len() int

func (Receipts) RlpEncode

func (self Receipts) RlpEncode() []byte

type StorageBlock

type StorageBlock Block

StorageBlock defines the RLP encoding of a Block stored in the state database. The StorageBlock encoding contains fields that would otherwise need to be recomputed.

func (*StorageBlock) DecodeRLP

func (self *StorageBlock) DecodeRLP(s *rlp.Stream) error

func (StorageBlock) EncodeRLP

func (self StorageBlock) EncodeRLP(w io.Writer) error

type Transaction

type Transaction struct {
	AccountNonce uint64
	Price        *big.Int
	GasLimit     *big.Int
	Recipient    *common.Address `rlp:"nil"` // nil means contract creation
	Amount       *big.Int
	Payload      []byte
	V            byte
	R, S         *big.Int
}

func NewContractCreationTx

func NewContractCreationTx(amount, gasLimit, gasPrice *big.Int, data []byte) *Transaction

func NewTransactionFromBytes

func NewTransactionFromBytes(data []byte) *Transaction

func NewTransactionMessage

func NewTransactionMessage(to common.Address, amount, gasAmount, gasPrice *big.Int, data []byte) *Transaction

func (*Transaction) Curve

func (tx *Transaction) Curve() (v byte, r []byte, s []byte)

func (*Transaction) Data

func (self *Transaction) Data() []byte

func (*Transaction) From

func (self *Transaction) From() (common.Address, error)

func (*Transaction) Gas

func (self *Transaction) Gas() *big.Int

func (*Transaction) GasPrice

func (self *Transaction) GasPrice() *big.Int

func (*Transaction) Hash

func (tx *Transaction) Hash() common.Hash

func (*Transaction) Nonce

func (self *Transaction) Nonce() uint64

func (*Transaction) PublicKey

func (tx *Transaction) PublicKey() []byte

func (*Transaction) RlpData

func (tx *Transaction) RlpData() interface{}

TODO: remove

func (*Transaction) SetNonce

func (self *Transaction) SetNonce(AccountNonce uint64)

func (*Transaction) SetSignatureValues

func (tx *Transaction) SetSignatureValues(sig []byte) error

func (*Transaction) SignECDSA

func (tx *Transaction) SignECDSA(prv *ecdsa.PrivateKey) error

func (*Transaction) Signature

func (tx *Transaction) Signature(key []byte) []byte

func (*Transaction) String

func (tx *Transaction) String() string

func (*Transaction) To

func (tx *Transaction) To() *common.Address

To returns the recipient of the transaction. If transaction is a contract creation (with no recipient address) To returns nil.

func (*Transaction) Value

func (self *Transaction) Value() *big.Int

type Transactions

type Transactions []*Transaction

Transaction slice type for basic sorting

func (Transactions) GetRlp

func (s Transactions) GetRlp(i int) []byte

func (Transactions) Len

func (s Transactions) Len() int

func (Transactions) RlpData

func (self Transactions) RlpData() interface{}

TODO: remove

func (Transactions) Swap

func (s Transactions) Swap(i, j int)

type TxByNonce

type TxByNonce struct{ Transactions }

func (TxByNonce) Less

func (s TxByNonce) Less(i, j int) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL