Documentation ¶
Index ¶
- Constants
- func EncodeProof(dnmp DoubleNodeWithMerkleProof) string
- func EncodeProofArray(arr []DoubleNodeWithMerkleProof) string
- func GetReceiptRlpEncode(api string, tx string) (*types.Receipt, error)
- func Header(api string, block uint64) (types.Header, error)
- func LenToHex(len int) string
- func RPC(api string, method string, params interface{}) (*dto.RequestResult, error)
- func RlpEncode(hexStr string) string
- func UncleBlock(number uint64, api string) (types.Header, error)
- type AncientReader
- type BlockHashReader
- type BlockResult
- type DoubleNodeWithMerkleProof
- type EthashProof
- func (proof *EthashProof) GenerateEpoch(epoch uint64) error
- func (proof *EthashProof) NotifyEpoch(blockno uint64) bool
- func (proof *EthashProof) NotifyEpochWait(epoch uint64) error
- func (proof *EthashProof) Proof(header *types.Header, wait bool) (*Output, []DoubleNodeWithMerkleProof, error)
- func (proof *EthashProof) Start(currentEpoch uint64)
- func (proof *EthashProof) Stop()
- type InfuraResponse
- type Log
- type NotifyWaitInfo
- type Output
- type ProofRecord
- type Receipts
- type Transaction
Constants ¶
View Source
const ( GETBLOCK = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\": [\"0x%x\", false],\"id\":1}\n" GETBLOCK_BYHASH = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\": [\"%s\", false],\"id\":1}\n" // uncle block GET_UNCLE_BLOCK = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getUncleByBlockNumberAndIndex\",\"params\": [\"0x%x\", \"0x0\"],\"id\":1}\n" )
The post api of fetching eth header
Variables ¶
This section is empty.
Functions ¶
func EncodeProof ¶
func EncodeProof(dnmp DoubleNodeWithMerkleProof) string
Encode proof to hex with exist hex
func EncodeProofArray ¶
func EncodeProofArray(arr []DoubleNodeWithMerkleProof) string
Pack encode proof
Types ¶
type AncientReader ¶
type AncientReader struct {
// contains filtered or unexported fields
}
func NewAncientReader ¶
func NewAncientReader(path string, name string, compression bool) *AncientReader
type BlockHashReader ¶
type BlockHashReader struct { Head uint64 // contains filtered or unexported fields }
func NewBlockHashReader ¶
func NewBlockHashReader(ar *AncientReader, dbpath string) *BlockHashReader
func (*BlockHashReader) CheckGenesis ¶
func (bhr *BlockHashReader) CheckGenesis(genesis string) error
type BlockResult ¶
type BlockResult struct { Difficulty string `json:"difficulty"` ExtraData string `json:"extraData"` GasLimit string `json:"gasLimit"` GasUsed string `json:"gasUsed"` Hash string `json:"hash"` LogsBloom string `json:"logs_bloom"` Miner string `json:"miner"` MixHash string `json:"mixHash"` Nonce string `json:"nonce"` Number string `json:"number"` ParentHash string `json:"parentHash"` ReceiptsRoot string `json:"receiptsRoot"` Sha3Uncles string `json:"sha3Uncles"` StateRoot string `json:"stateRoot"` Timestamp string `json:"timestamp"` TotalDifficulty string `json:"totalDifficulty"` Transactions []Transaction `json:"transactions"` TransactionsRoot string `json:"transactionsRoot"` BaseFee string `json:"baseFeePerGas" rlp:"optional"` }
func GetChainBlockInfo ¶
func GetChainBlockInfo(api string, blockNum int64) (*BlockResult, error)
type EthashProof ¶
type EthashProof struct { Epoching uint64 // epoch=>timestamp SavedEpochs map[uint64]int64 // contains filtered or unexported fields }
func NewEthashProof ¶
func NewEthashProof(conf *config.EthProof) *EthashProof
func (*EthashProof) GenerateEpoch ¶
func (proof *EthashProof) GenerateEpoch(epoch uint64) error
func (*EthashProof) NotifyEpoch ¶
func (proof *EthashProof) NotifyEpoch(blockno uint64) bool
func (*EthashProof) NotifyEpochWait ¶
func (proof *EthashProof) NotifyEpochWait(epoch uint64) error
func (*EthashProof) Proof ¶
func (proof *EthashProof) Proof(header *types.Header, wait bool) (*Output, []DoubleNodeWithMerkleProof, error)
func (*EthashProof) Start ¶
func (proof *EthashProof) Start(currentEpoch uint64)
find existense of the epoch files
func (*EthashProof) Stop ¶
func (proof *EthashProof) Stop()
type InfuraResponse ¶
type InfuraResponse struct { JsonRPC string `json:"jsonrpc"` Id uint32 `json:"id"` Result types.Header `json:"result"` }
The response of etherscan api
type NotifyWaitInfo ¶
type ProofRecord ¶
type ProofRecord struct { Index string `json:"index"` Proof string `json:"proof"` HeaderHash string `json:"header_hash"` }
func BuildProofRecord ¶
func BuildProofRecord(api string, r *Receipts) (ProofRecord, string, error)
func GetReceipt ¶
func GetReceipt(api string, tx string) (ProofRecord, string, error)
type Receipts ¶
type Receipts struct { BlockNumber string `json:"block_number"` Logs []Log `json:"logs"` Status string `json:"status"` ChainSource string `json:"chainSource"` GasUsed string `json:"gasUsed"` LogsBloom string `json:"logsBloom"` Solidity bool `json:"solidity"` TransactionIndex string `json:"transactionIndex"` BlockHash string `json:"blockHash"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.