Documentation ¶
Index ¶
- Constants
- Variables
- func NewTxData(nonce, gasPrice, gasLimit uint64, value *big.Int, payload []byte, ...) txData
- type BNonce
- type Block
- func (bl *Block) Clone() *Block
- func (bl *Block) Coinbase() common.Address
- func (bl *Block) ConsensusInfo() []byte
- func (bl *Block) Deserialize(d []byte) error
- func (bl *Block) Extra() []byte
- func (bl *Block) GasLimit() uint64
- func (bl *Block) GasUsed() uint64
- func (bl *Block) Hash() common.Hash
- func (bl *Block) Height() uint64
- func (bl *Block) ParentHash() common.Hash
- func (bl *Block) ReceiptsHash() common.Hash
- func (bl *Block) Serialize() ([]byte, error)
- func (bl *Block) Sign(priv crypto.PrivateKey) ([]byte, error)
- func (bl *Block) Size() uint64
- func (bl *Block) StateRoot() common.Hash
- func (bl *Block) Time() *big.Int
- func (bl *Block) TxRoot() common.Hash
- type Blocks
- type Header
- type Log
- type Logs
- type NonceSortedList
- type Receipt
- type Receipts
- type SortedList
- type Transaction
- func (tx *Transaction) Cost() *big.Int
- func (tx *Transaction) Deserialize(d []byte) error
- func (tx *Transaction) Hash() common.Hash
- func (tx *Transaction) Serialize() ([]byte, error)
- func (tx *Transaction) Sign(privKey crypto.PrivKey) ([]byte, error)
- func (tx *Transaction) Size() uint32
- func (tx *Transaction) Verify() (bool, error)
- type Transactions
- type TxMeta
Constants ¶
View Source
const (
MaxTxSize = 32 * 1024 // Maximum transaction size
)
Variables ¶
Functions ¶
Types ¶
type BNonce ¶
type BNonce [8]byte
BNonce is a 64-bit hash which proves that a sufficient amount of computation has been carried out on a block
func EncodeNonce ¶
type Block ¶
type Block struct { Header *Header `json:"header"` Transactions Transactions `json:"transactions"` PubKey []byte `json:"pub_key"` Signature []byte `json:"signature"` // contains filtered or unexported fields }
func NewBlock ¶
func NewBlock(header *Header, txs Transactions) *Block
func (*Block) ConsensusInfo ¶
func (*Block) Deserialize ¶
func (*Block) Hash ¶
Calculate hash of block Combine header hash and transactions hash, and sha256 it
func (*Block) ParentHash ¶
func (*Block) ReceiptsHash ¶
type Header ¶
type Header struct { ParentHash common.Hash `json:"parent_hash"` // Hash of parent block Height uint64 `json:"height"` // Block height StateRoot common.Hash `json:"state_root"` // State root TxRoot common.Hash `json:"tx_root"` // Transaction tree root ReceiptsHash common.Hash `json:"receipt_hash"` // Receipts hash Coinbase common.Address `json:"miner"` // Miner address who receives reward of this block Time *big.Int `json:"time"` // Timestamp GasUsed uint64 `json:"gas"` // Total gas used GasLimit uint64 `json:"gas_limit"` // Gas limit of this block Extra []byte `json:"extra,omitempty"` // Extra data ConsensusInfo []byte `json:"consensus_info,omitempty"` // Extra consensus information }
func (*Header) Desrialize ¶
func (*Header) HashNoConsensus ¶
type Log ¶
type Log struct { // Consensus fields: // address of the contract that generated the event Address common.Address `json:"address" gencodec:"required"` // list of topics provided by the contract. Topics []common.Hash `json:"topics" gencodec:"required"` // supplied by the contract, usually ABI-encoded Data []byte `json:"data" gencodec:"required"` // Derived fields. These fields are filled in by the node // but not secured by consensus. // block in which the transaction was included BlockHeight uint64 `json:"blockHeight"` // hash of the transaction TxHash common.Hash `json:"transactionHash" gencodec:"required"` // index of the transaction in the block TxIndex uint `json:"transactionIndex" gencodec:"required"` // hash of the block in which the transaction was included BlockHash common.Hash `json:"blockHash"` // index of the log in the receipt Index uint `json:"logIndex" gencodec:"required"` // The Removed field is true if this log was reverted due to a chain reorganisation. // You must pay attention to this field if you receive logs through a filter query. Removed bool `json:"removed"` }
Log represents a contract log event. These events are generated by the LOG opcode and stored/indexed by the node.
func (*Log) Deserialize ¶
type NonceSortedList ¶
type NonceSortedList Transactions
func (NonceSortedList) Len ¶
func (txs NonceSortedList) Len() int
func (NonceSortedList) Less ¶
func (txs NonceSortedList) Less(i, j int) bool
func (NonceSortedList) Swap ¶
func (txs NonceSortedList) Swap(i, j int)
type Receipt ¶
type Receipt struct { // Consensus fields PostState common.Hash `json:"root"` // post state root Status bool `json:"status"` // Transaction executing success or failed TxHash common.Hash `json:"tx_hash"` // Transaction hash ContractAddress common.Address `json:"contract_address"` // Contract address GasUsed uint64 `json:"gas_used"` // gas used of transaction Logs []*Log `json:"logs"` // contract log events }
Receipt represents the results of a transaction
func (*Receipt) Deserialize ¶
func (*Receipt) SetContractAddress ¶
type SortedList ¶
type SortedList Transactions
Nonce-asec-sorted and price-desec-sorted list
func (SortedList) Len ¶
func (txs SortedList) Len() int
func (SortedList) Less ¶
func (txs SortedList) Less(i, j int) bool
func (SortedList) Swap ¶
func (txs SortedList) Swap(i, j int)
type Transaction ¶
type Transaction struct { PubKey []byte `json:"pub_key"` // Public key Signature []byte `json:"signature"` // Signature of tx // contains filtered or unexported fields }
func NewTransaction ¶
func (*Transaction) Cost ¶
func (tx *Transaction) Cost() *big.Int
func (*Transaction) Deserialize ¶
func (tx *Transaction) Deserialize(d []byte) error
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() common.Hash
func (*Transaction) Serialize ¶
func (tx *Transaction) Serialize() ([]byte, error)
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(privKey crypto.PrivKey) ([]byte, error)
Sign the transaction with private key
func (*Transaction) Size ¶
func (tx *Transaction) Size() uint32
func (*Transaction) Verify ¶
func (tx *Transaction) Verify() (bool, error)
Verify transaction signature by specific public key
type Transactions ¶
type Transactions []*Transaction
func (Transactions) Commit ¶
func (txs Transactions) Commit(db *db.LDBDatabase) error
func (Transactions) Deserialize ¶
func (txs Transactions) Deserialize(d []byte) error
func (Transactions) Hash ¶
func (txs Transactions) Hash() common.Hash
func (Transactions) Serialize ¶
func (txs Transactions) Serialize() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.