Documentation
¶
Overview ¶
* Define types and structures relate block
* Define types and structures relate header
Index ¶
Constants ¶
View Source
const ( HashLength = 32 AddressLength = 20 )
Lengths of hashes and addresses in bytes.
View Source
const ( Null = "Null" JustitiaRightToken = "JustitiaRight" JustitiaVoting = "Voting" JustitiaWhiteList = "WhiteList" JustitiaMetaData = "MetaData" JustitiaCrossFundsPool = "CrossFundsPool" )
define specified type of system contract
View Source
const ( MinimunNodesForDpos = uint64(4) MetaDataContractAddress = "8be503bcded90ed42eff31f56199399b2b0154ca" JustiitaContractDefaultAddress = "bd770416a3345f91e4b34576cb804a576fa48eb1" VotingContractDefaultAddress = "5a443704dd4b594b382c22a083e2bd3090a6fef3" WhiteListContractTypeDefaultAddress = "47e9fbef8c83a1714f1951f142132e6e90f5fa5d" CrossFundsPoolDefaultAddress = "47c5e40890bce4a473a49d7501808b9633f29782" )
View Source
const (
// BloomByteLength represents the number of bytes used in a header log bloom.
BloomByteLength = 256
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [AddressLength]byte
Address represents the 20 byte address of an Ethereum account.
type Block ¶
type Block struct { Header *Header Transactions []*Transaction HeaderHash Hash `json:"headerHash" gencodec:"required"` }
type ContractType ¶ added in v1.0.0
type ContractType int
const ( InitialContractType ContractType = iota JustitiaRightContractType VoteContractType WhiteListContractType MetaDataContractType CrossFundsPoolContractType MaximumContractType )
type ETransaction ¶ added in v1.1.0
type ETransaction struct {
// contains filtered or unexported fields
}
func (*ETransaction) DecodeBytes ¶ added in v1.1.0
func (tx *ETransaction) DecodeBytes(encodedTx []byte) error
func (*ETransaction) GetTxData ¶ added in v1.1.0
func (tx *ETransaction) GetTxData() TxData
func (*ETransaction) SetTxData ¶ added in v1.1.0
func (tx *ETransaction) SetTxData(txData *TxData) error
type EventCenter ¶
type EventCenter interface { // subscribe specified eventType with eventFunc Subscribe(eventType EventType, eventFunc EventFunc) Subscriber // unsubscribe specified eventType and subscriber UnSubscribe(eventType EventType, subscriber Subscriber) (err error) // notify subscriber of eventType Notify(eventType EventType, value interface{}) (err error) // notify specified eventFunc NotifySubscriber(eventFunc EventFunc, value interface{}) // notify subscriber traversing all events NotifyAll() (errs []error) // unsubscribe all event UnSubscribeAll() }
type EventType ¶
type EventType uint8
const ( EventBlockCommitted EventType = iota // 0, block submit successfully EventBlockCommitFailed // 1, block submit failed EventBlockVerifyFailed // 2, block verified failed EventBlockExisted // 3. block has exist EventConsensusFailed // 4. to consensus failed EventBlockWritten // 5. block has been written EventBlockWriteFailed // 6. block write failed EventTxVerifySucceeded // 7. tx has been verified successfully EventTxVerifyFailed // 8. tx was verified failed EventMasterChange // 9. change master EventOnline // 10. node online EventBlockWithoutTxs // 11. block without any txs //P2P Event EventRemovePeer EventAddPeer EventBroadCastMsg EventRecvNewMsg // txpool events EventAddTxToTxPool )
type Hash ¶
type Hash [HashLength]byte
Hash represents the 32 byte Keccak256 hash of arbitrary data.
type Header ¶
type Header struct { ChainID uint64 `json:"chainId" gencodec:"required"` // chainid PrevBlockHash Hash `json:"prevHash" gencodec:"required"` // preblock hash StateRoot Hash `json:"stateRoot" gencodec:"required"` // statedb root TxRoot Hash `json:"txRoot" gencodec:"required"` // transactions root ReceiptsRoot Hash `json:"receiptsRoot" gencodec:"required"` // receipt root Height uint64 `json:"height" gencodec:"required"` // block height Timestamp uint64 `json:"timestamp" gencodec:"required"` // timestamp CoinBase Address `json:"coinbase" gencodec:"required"` // coin base // not contain when compute header hash MixDigest Hash `json:"mixDigest" gencodec:"required"` // digest SigData [][]byte `json:"signData" gencodec:"required"` // SigData //match etherum ParentHash Hash `json:"parentHash" gencodec:"required"` Coinbase Address `json:"miner" gencodec:"required"` TxHash Hash `json:"transactionsRoot" gencodec:"required"` UncleHash Hash `json:"sha3Uncles" gencodec:"required"` Bloom Bloom `json:"logsBloom" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"` Number *big.Int `json:"number" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` Extra []byte `json:"extraData" gencodec:"required"` Nonce uint64 `json:"nonce" gencodec:"required"` }
Header represents a block header in the Ethereum blockchain.
type Log ¶
type Log struct { // Consensus fields: // address of the contract that generated the event Address Address `json:"address" gencodec:"required"` // list of topics provided by the contract. Topics []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 BlockNumber uint64 `json:"blockNumber"` // hash of the transaction TxHash 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 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"` }
type Receipt ¶
type Receipt struct { // Consensus fields PostState []byte `json:"root"` Status uint64 `json:"status"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"` Bloom Bloom `json:"logsBloom" gencodec:"required"` Logs []*Log `json:"logs" gencodec:"required"` // Implementation fields (don't reorder!) TxHash Hash `json:"transactionHash" gencodec:"required"` ContractAddress Address `json:"contractAddress"` GasUsed uint64 `json:"gasUsed" gencodec:"required"` }
Receipt represents the results of a transaction.
type StorageSize ¶
type StorageSize float64
StorageSize is a wrapper around a float value that supports user friendly formatting.
type Subscriber ¶
type Subscriber chan interface{}
type Transaction ¶
type TxData ¶
type TxData struct { AccountNonce uint64 `json:"nonce" gencodec:"required"` Price *big.Int `json:"gasPrice" gencodec:"required"` GasLimit uint64 `json:"gas" gencodec:"required"` Recipient *Address `json:"to" rlp:"nil"` From *Address `json:"from" rlp:"-"` Amount *big.Int `json:"value" gencodec:"required"` Payload []byte `json:"input" gencodec:"required"` // Signature values V *big.Int `json:"v" gencodec:"required"` R *big.Int `json:"r" gencodec:"required"` S *big.Int `json:"s" gencodec:"required"` // This is only used when marshaling to JSON. Hash *Hash `json:"hash" rlp:"-"` }
Click to show internal directories.
Click to hide internal directories.