types

package
v0.9.23 Latest Latest
Warning

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

Go to latest
Published: May 21, 2015 License: LGPL-2.1-or-later Imports: 19 Imported by: 28,611

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 added in v0.8.4

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

func NewBlockWithHeader added in v0.8.4

func NewBlockWithHeader(header *Header) *Block

func (*Block) AddReceipt added in v0.8.4

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

func (*Block) AddTransaction added in v0.8.4

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

func (*Block) Bloom added in v0.8.4

func (self *Block) Bloom() Bloom

func (*Block) CalculateUnclesHash added in v0.9.17

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

func (*Block) Coinbase

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

func (*Block) Copy added in v0.9.17

func (self *Block) Copy() *Block

func (*Block) DecodeRLP added in v0.8.4

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

func (*Block) Difficulty

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

Implement pow.Block

func (Block) EncodeRLP added in v0.9.17

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 added in v0.8.4

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 added in v0.8.4

func (self *Block) Header() *Header

func (*Block) MixDigest added in v0.9.17

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 added in v0.8.4

func (self *Block) NumberU64() uint64

func (*Block) ParentHash added in v0.8.4

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

func (*Block) Queued added in v0.9.17

func (self *Block) Queued() bool

func (*Block) Receipts

func (self *Block) Receipts() Receipts

func (*Block) RlpData

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

func (*Block) RlpDataForStorage added in v0.8.4

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

func (*Block) Root

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

func (*Block) SetNonce added in v0.9.17

func (self *Block) SetNonce(nonce uint64)

func (*Block) SetQueued added in v0.9.17

func (self *Block) SetQueued(q bool)

func (*Block) SetReceipts

func (self *Block) SetReceipts(receipts Receipts)

func (*Block) SetRoot added in v0.8.4

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 added in v0.8.4

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 added in v0.9.17

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 added in v0.9.17

type Bloom [bloomLength]byte

func BytesToBloom added in v0.9.17

func BytesToBloom(b []byte) Bloom

func CreateBloom

func CreateBloom(receipts Receipts) Bloom

func (Bloom) Big added in v0.9.17

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

func (Bloom) Bytes added in v0.9.17

func (b Bloom) Bytes() []byte

func (*Bloom) SetBytes added in v0.9.17

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 added in v0.8.4

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

func (*Header) HashNoNonce added in v0.8.4

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

func (*Header) RlpData added in v0.8.4

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

func (*Header) SetNonce added in v0.9.17

func (self *Header) SetNonce(nonce uint64)

func (*Header) String added in v0.8.4

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 added in v0.9.17

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 added in v0.9.17

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 added in v0.9.17

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

func (StorageBlock) EncodeRLP added in v0.9.17

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 added in v0.9.17

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

func (*Transaction) SignECDSA added in v0.8.4

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