Documentation ¶
Index ¶
- Constants
- Variables
- func ABIEncodePublicKey(publicKey []byte) []byte
- func ABIEncodeSignature(signature []byte) []byte
- func AssembleProof(client *Client, pivot, proofType uint64, method string, fId msg.ChainId, ...) ([]byte, error)
- func CreateReceiptsMPT(epochReceipts [][]types.TransactionReceipt) ([]*mpt.Node, *mpt.Node)
- func MustRLPEncodeBlock(block *BlockSummary) []byte
- func NewBigIntByRaw(x *big.Int) *hexutil.Big
- type Address
- type Block
- type BlockHeader
- type BlockInfo
- type BlockNumber
- type BlockRlp
- type BlockSummary
- type Bytes
- type CfxBlock
- type Client
- func (c *Client) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (c *Client) GetBlockByEpochNumber(ctx context.Context, blockNumber hexutil.Uint64) (*BlockSummary, error)
- func (c *Client) GetBlockByNumber(ctx context.Context, blockNumber BlockNumber) (*Block, error)
- func (c *Client) GetEpochReceipts(ctx context.Context, epoch types.EpochOrBlockHash, includeEthReceipts ...bool) ([][]types.TransactionReceipt, error)
- func (c *Client) GetLedgerInfoByEpochAndRound(ctx context.Context, epochNumber hexutil.Uint64, round hexutil.Uint64) (*LedgerInfoWithSignatures, error)
- func (c *Client) GetStatus(ctx context.Context) (*Status, error)
- type Decision
- type Epoch
- type EpochState
- type H256
- type ILightNodeState
- type LedgerInfo
- type LedgerInfoLibAccountSignature
- type LedgerInfoLibDecision
- type LedgerInfoLibEpochState
- type LedgerInfoLibLedgerInfoWithSignatures
- type LedgerInfoLibValidatorInfo
- type LedgerInfoWithSignatures
- type PivotBlockDecision
- type PoSAccounts
- type Signature
- type Status
- type Transaction
- type ValidatorConsensusInfo
- type ValidatorVerifier
Constants ¶
View Source
const DeferredExecutionEpochs uint64 = 5
Variables ¶
View Source
var ( BlockEarliest = &BlockNumber{"earliest", 0} BlockLatestCommitted = &BlockNumber{"latest_committed", 0} BlockLatestVoted = &BlockNumber{"latest_voted", 0} )
View Source
var ErrNoResult = errors.New("no result in JSON-RPC response")
View Source
var ErrTransactionExecutionFailed = errors.New("transaction execution failed")
Functions ¶
func ABIEncodePublicKey ¶
func ABIEncodeSignature ¶
func AssembleProof ¶
func CreateReceiptsMPT ¶
func MustRLPEncodeBlock ¶
func MustRLPEncodeBlock(block *BlockSummary) []byte
Types ¶
type Block ¶
type Block struct { Hash common.Hash `json:"hash"` Height hexutil.Uint64 `json:"height"` Epoch hexutil.Uint64 `json:"epoch"` Round hexutil.Uint64 `json:"round"` LastTxNumber hexutil.Uint64 `json:"lastTxNumber"` Miner *Address `json:"miner"` ParentHash common.Hash `json:"parentHash"` Timestamp hexutil.Uint64 `json:"timestamp"` PivotDecision *Decision `json:"pivotDecision"` Signatures []Signature `json:"signatures"` }
type BlockHeader ¶
type BlockHeader struct { Hash types.Hash `json:"hash"` ParentHash types.Hash `json:"parentHash"` Height *hexutil.Big `json:"height"` Miner types.Address `json:"miner"` DeferredStateRoot types.Hash `json:"deferredStateRoot"` DeferredReceiptsRoot types.Hash `json:"deferredReceiptsRoot"` DeferredLogsBloomHash types.Hash `json:"deferredLogsBloomHash"` Blame hexutil.Uint64 `json:"blame"` TransactionsRoot types.Hash `json:"transactionsRoot"` EpochNumber *hexutil.Big `json:"epochNumber"` BlockNumber *hexutil.Big `json:"blockNumber"` GasLimit *hexutil.Big `json:"gasLimit"` GasUsed *hexutil.Big `json:"gasUsed"` Timestamp *hexutil.Big `json:"timestamp"` Difficulty *hexutil.Big `json:"difficulty"` PowQuality *hexutil.Big `json:"powQuality"` RefereeHashes []types.Hash `json:"refereeHashes"` Adaptive bool `json:"adaptive"` Nonce *hexutil.Big `json:"nonce"` Size *hexutil.Big `json:"size"` Custom []Bytes `json:"custom"` PosReference *types.Hash `json:"posReference"` BaseFeePerGas *hexutil.Big `json:"baseFeePerGas"` }
type BlockInfo ¶
type BlockInfo struct { Epoch hexutil.Uint64 `json:"epoch"` Round hexutil.Uint64 `json:"round"` Id hexutil.Bytes `json:"id"` ExecutedStateId hexutil.Bytes `json:"executedStateId"` Version hexutil.Uint64 `json:"version"` TimestampUsecs hexutil.Uint64 `json:"timestampUsecs"` NextEpochState *EpochState `json:"nextEpochState"` Pivot *PivotBlockDecision `json:"pivot"` }
type BlockNumber ¶
type BlockNumber struct {
// contains filtered or unexported fields
}
func NewBlockNumber ¶
func NewBlockNumber(number hexutil.Uint64) BlockNumber
func (BlockNumber) MarshalText ¶
func (e BlockNumber) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*BlockNumber) String ¶
func (e *BlockNumber) String() string
String implements the fmt.Stringer interface
func (*BlockNumber) UnmarshalJSON ¶
func (e *BlockNumber) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type BlockRlp ¶
type BlockRlp struct {
// contains filtered or unexported fields
}
func ConvertBlock ¶
func ConvertBlock(block *BlockSummary) BlockRlp
type BlockSummary ¶
type BlockSummary struct {
BlockHeader
}
BlockSummary includes block header and a list of transaction hashes
type Bytes ¶
type Bytes []byte
func (Bytes) MarshalText ¶
func (*Bytes) ToHexBytes ¶
func (*Bytes) UnmarshalJSON ¶
type CfxBlock ¶
type CfxBlock struct { BlockHeader Transactions []Transaction `json:"transactions"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CallContext ¶
func (*Client) GetBlockByEpochNumber ¶
func (*Client) GetBlockByNumber ¶
func (*Client) GetEpochReceipts ¶
func (c *Client) GetEpochReceipts(ctx context.Context, epoch types.EpochOrBlockHash, includeEthReceipts ...bool) ([][]types.TransactionReceipt, error)
func (*Client) GetLedgerInfoByEpochAndRound ¶
type Epoch ¶
type Epoch struct {
// contains filtered or unexported fields
}
Epoch represents an epoch in Conflux.
var ( EpochEarliest *Epoch = &Epoch{"earliest", nil} EpochLatestCheckpoint *Epoch = &Epoch{"latest_checkpoint", nil} EpochLatestConfirmed *Epoch = &Epoch{"latest_confirmed", nil} EpochLatestState *Epoch = &Epoch{"latest_state", nil} EpochLatestMined *Epoch = &Epoch{"latest_mined", nil} EpochLatestFinalized *Epoch = &Epoch{"latest_finalized", nil} )
Const epoch definitions
func NewEpochNumber ¶
NewEpochNumber creates an instance of Epoch with specified number.
func (Epoch) MarshalText ¶
func (*Epoch) UnmarshalJSON ¶
type EpochState ¶
type EpochState struct { Epoch hexutil.Uint64 `json:"epoch"` Verifier ValidatorVerifier `json:"verifier"` VrfSeed hexutil.Bytes `json:"vrfSeed"` }
type ILightNodeState ¶
type ILightNodeState struct { Epoch *big.Int Round *big.Int EarliestBlockNumber *big.Int FinalizedBlockNumber *big.Int Blocks *big.Int MaxBlocks *big.Int }
ILightNodeState is an auto generated low-level Go binding around an user-defined struct.
type LedgerInfo ¶
type LedgerInfoLibDecision ¶
type LedgerInfoLibEpochState ¶
type LedgerInfoLibEpochState struct { Epoch uint64 Validators []LedgerInfoLibValidatorInfo QuorumVotingPower uint64 TotalVotingPower uint64 VrfSeed []byte }
func ConvertCommittee ¶
func ConvertCommittee(ledger *LedgerInfoWithSignatures) (LedgerInfoLibEpochState, bool)
type LedgerInfoLibLedgerInfoWithSignatures ¶
type LedgerInfoLibLedgerInfoWithSignatures struct { Epoch uint64 Round uint64 Id [32]byte ExecutedStateId [32]byte Version uint64 TimestampUsecs uint64 NextEpochState LedgerInfoLibEpochState Pivot LedgerInfoLibDecision ConsensusDataHash [32]byte Accounts [][32]byte AggregatedSignature []byte }
LedgerInfoLibLedgerInfoWithSignatures is an auto generated low-level Go binding around an user-defined struct.
func ConvertLedger ¶
func ConvertLedger(ledger *LedgerInfoWithSignatures) LedgerInfoLibLedgerInfoWithSignatures
type LedgerInfoWithSignatures ¶
type LedgerInfoWithSignatures struct { LedgerInfo LedgerInfo `json:"ledgerInfo"` // The validator is identified by its account address: in order to verify // a signature one needs to retrieve the public key of the validator // for the given epoch. // // BLS signature in uncompressed format Signatures map[common.Hash]hexutil.Bytes `json:"signatures"` // Validators with uncompressed BLS public key (in 96 bytes) if next epoch // state available. Generally, this is used to verify BLS signatures at client side. NextEpochValidators map[common.Hash]hexutil.Bytes `json:"nextEpochValidators"` // Aggregated BLS signature in 192 bytes. AggregatedSignature hexutil.Bytes `json:"aggregatedSignature"` }
func (*LedgerInfoWithSignatures) NextEpochValidatorsSorted ¶
func (info *LedgerInfoWithSignatures) NextEpochValidatorsSorted() []common.Hash
func (*LedgerInfoWithSignatures) ValidatorsSorted ¶
func (info *LedgerInfoWithSignatures) ValidatorsSorted() []common.Hash
type PivotBlockDecision ¶
type PoSAccounts ¶
func (PoSAccounts) Len ¶
func (s PoSAccounts) Len() int
func (PoSAccounts) Less ¶
func (s PoSAccounts) Less(i, j int) bool
func (PoSAccounts) Swap ¶
func (s PoSAccounts) Swap(i, j int)
type Transaction ¶
type Transaction struct { Hash types.Hash `json:"hash"` Nonce *hexutil.Big `json:"nonce"` BlockHash *types.Hash `json:"blockHash"` TransactionIndex *hexutil.Uint64 `json:"transactionIndex"` From Address `json:"from"` To *Address `json:"to"` Value *hexutil.Big `json:"value"` GasPrice *hexutil.Big `json:"gasPrice"` Gas *hexutil.Big `json:"gas"` ContractCreated *Address `json:"contractCreated"` Data string `json:"data"` StorageLimit *hexutil.Big `json:"storageLimit"` EpochHeight *hexutil.Big `json:"epochHeight"` ChainID *hexutil.Big `json:"chainId"` Status *hexutil.Uint64 `json:"status"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` }
type ValidatorConsensusInfo ¶
type ValidatorVerifier ¶
type ValidatorVerifier struct { // An ordered map of each validator's on-chain account address to its // pubkeys and voting power. AddressToValidatorInfo map[common.Hash]ValidatorConsensusInfo `json:"addressToValidatorInfo"` // The minimum voting power required to achieve a quorum QuorumVotingPower hexutil.Uint64 `json:"quorumVotingPower"` // Total voting power of all validators (cached from // address_to_validator_info) TotalVotingPower hexutil.Uint64 `json:"totalVotingPower"` }
Click to show internal directories.
Click to hide internal directories.