Documentation ¶
Index ¶
- Constants
- func EncodeProof(dnmp DoubleNodeWithMerkleProof) string
- func EncodeProofArray(arr []DoubleNodeWithMerkleProof) string
- func Epoch(block uint64, config *shadow.Config) (*ethashproof.DatasetMerkleTreeCache, error)
- 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 BlockResult
- type DarwiniaEthHeader
- type DarwiniaEthHeaderHexFormat
- type DoubleNodeWithMerkleProof
- type EthHeader
- type EthReceipt
- type EthReceiptLog
- type Geth
- type InfuraResponse
- type Log
- type ProofOutput
- type ProofRecord
- type Receipts
- type RedeemFor
- 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
View Source
const ETHASHPROOF_CACHE = ".ethashproof"
Constants
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
func Epoch ¶ added in v0.2.5
func Epoch(block uint64, config *shadow.Config) (*ethashproof.DatasetMerkleTreeCache, error)
Types ¶
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"` }
func GetChainBlockInfo ¶
func GetChainBlockInfo(api string, blockNum int64) (*BlockResult, error)
type DarwiniaEthHeader ¶
type DarwiniaEthHeader struct { ParentHash string `json:"parent_hash"` TimeStamp uint64 `json:"timestamp"` Number uint64 `json:"number"` Author string `json:"author"` TransactionsRoot string `json:"transactions_root"` UnclesHash string `json:"uncles_hash"` ExtraData string `json:"extra_data"` StateRoot string `json:"state_root"` ReceiptsRoot string `json:"receipts_root"` LogBloom string `json:"log_bloom"` GasUsed uint64 `json:"gas_used"` GasLimited uint64 `json:"gas_limit"` Difficulty uint64 `json:"difficulty"` Seal []string `json:"seal"` Hash string `json:"hash"` }
Darwinia block
func IntoDarwiniaEthHeader ¶
func IntoDarwiniaEthHeader(e *types.Header) (DarwiniaEthHeader, error)
Convert EthHeader to Darwinia Eth Block
func (*DarwiniaEthHeader) HexFormat ¶
func (h *DarwiniaEthHeader) HexFormat() DarwiniaEthHeaderHexFormat
func (*DarwiniaEthHeader) ToString ¶
func (d *DarwiniaEthHeader) ToString() (string, error)
type DarwiniaEthHeaderHexFormat ¶
type DarwiniaEthHeaderHexFormat struct { ParentHash string `json:"parent_hash"` TimeStamp string `json:"timestamp"` Number string `json:"number"` Author string `json:"author"` TransactionsRoot string `json:"transactions_root"` UnclesHash string `json:"uncles_hash"` ExtraData string `json:"extra_data"` StateRoot string `json:"state_root"` ReceiptsRoot string `json:"receipts_root"` LogBloom string `json:"log_bloom"` GasUsed string `json:"gas_used"` GasLimited string `json:"gas_limit"` Difficulty string `json:"difficulty"` Seal []string `json:"seal"` Hash string `json:"hash"` }
type DoubleNodeWithMerkleProof ¶
type DoubleNodeWithMerkleProof struct { DagNodes []string `json:"dag_nodes"` Proof []string `json:"proof"` }
Final outputs of ethashproof
type EthHeader ¶
type EthHeader struct { ParentHash string `json:"parent_hash"` Timestamp int64 `json:"timestamp"` Number int64 `json:"number"` Auth string `json:"auth"` TransactionRoot string `json:"transaction_root"` UnclesHash string `json:"uncles_hash"` ExtraData string `json:"extra_data"` StateRoot string `json:"state_root"` ReceiptsRoot string `json:"receipts_root"` LogBloom string `json:"log_bloom"` GasUsed string `json:"gas_used"` GasLimit string `json:"gas_limit"` Difficulty string `json:"difficulty"` Seal []string `json:"seal"` Hash string `json:"hash"` }
type EthReceipt ¶
type EthReceipt struct { GasUsed int64 `json:"gas_used"` LogBloom string `json:"log_bloom"` Logs []EthReceiptLog `json:"logs"` Outcome int `json:"outcome"` }
type EthReceiptLog ¶
type Geth ¶ added in v0.2.1
type Geth struct {
// contains filtered or unexported fields
}
func (*Geth) HashToNumber ¶ added in v0.2.1
type InfuraResponse ¶
type InfuraResponse struct { JsonRPC string `json:"jsonrpc"` Id uint32 `json:"id"` Result types.Header `json:"result"` }
The response of etherscan api
type ProofOutput ¶
type ProofOutput struct { HeaderRLP string `json:"header_rlp"` MerkleRoot string `json:"merkle_root"` Elements []string `json:"elements"` MerkleProofs []string `json:"merkle_proofs"` ProofLength uint64 `json:"proof_length"` }
This struct is used for process interaction
func (*ProofOutput) Format ¶
func (o *ProofOutput) Format() []DoubleNodeWithMerkleProof
Format ProofOutput to double node with merkle proofs
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"` }
type RedeemFor ¶
type RedeemFor struct { Ring *ProofRecord `json:"ring,omitempty"` Kton *ProofRecord `json:"kton,omitempty"` Deposit *ProofRecord `json:"deposit,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.