Documentation ¶
Index ¶
- Constants
- func Assert(err error)
- func Filter(vs []string, f func(int, string) bool) []string
- func Header(block interface{}, api string) (types.Header, error)
- func Map(vs []string, f func(int, string) string) []string
- func RootDir() (string, error)
- type Config
- type DarwiniaEthHeader
- type DarwiniaEthHeaderHexFormat
- type DoubleNodeWithMerkleProof
- type InfuraResponse
- type ProofOutput
- type RawConfig
Constants ¶
View Source
const EPOCH_LOCK = "epoch.lock"
Constants
View Source
const ETHASHPROOF_CACHE = ".ethashproof"
View Source
const GETBLOCK = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\": [\"0x%x\", false],\"id\":1}\n"
The post api of fetching eth header
View Source
const GETBLOCK_BYHASH = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\": [\"%s\", false],\"id\":1}\n"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Api string `json:"api"` Genesis uint64 `json:"genesis"` Root string `json:"root"` }
func (*Config) CreateLock ¶ added in v0.1.2
Common load config
func (*Config) RemoveLock ¶ added in v0.1.2
Common load config
type DarwiniaEthHeader ¶ added in v0.1.1
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 ¶ added in v0.1.1
func IntoDarwiniaEthHeader(e types.Header) (DarwiniaEthHeader, error)
Convert EthHeader to Darwinia Eth Block
func (*DarwiniaEthHeader) HexFormat ¶ added in v0.1.1
func (h *DarwiniaEthHeader) HexFormat() DarwiniaEthHeaderHexFormat
type DarwiniaEthHeaderHexFormat ¶ added in v0.1.1
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 ¶ added in v0.1.1
type DoubleNodeWithMerkleProof struct { DagNodes []string `json:"dag_nodes"` Proof []string `json:"proof"` }
Final outputs of ethashproof
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 Proof ¶
func Proof(header *types.Header, config Config) (ProofOutput, error)
Proof eth blockheader
func (*ProofOutput) Format ¶ added in v0.1.1
func (o *ProofOutput) Format() []DoubleNodeWithMerkleProof
Format ProofOutput to double node with merkle proofs
Click to show internal directories.
Click to hide internal directories.