Documentation ¶
Index ¶
- Constants
- func FromBlockAndReceipts(block *types.Block, receipts []*types.Receipt) (*EthHeader, []*EthHeader, []*EthTx, []*EthTxTrie, []*EthReceipt, []*EthRctTrie, ...)
- func RawdataToCid(codec uint64, rawdata []byte, multiHash uint64) (cid.Cid, error)
- type EthAccount
- type EthAccountSnapshot
- func (as *EthAccountSnapshot) Cid() cid.Cid
- func (as *EthAccountSnapshot) Copy() node.Node
- func (as *EthAccountSnapshot) Links() []*node.Link
- func (as *EthAccountSnapshot) Loggable() map[string]interface{}
- func (as *EthAccountSnapshot) MarshalJSON() ([]byte, error)
- func (as *EthAccountSnapshot) RawData() []byte
- func (as *EthAccountSnapshot) Resolve(p []string) (interface{}, []string, error)
- func (as *EthAccountSnapshot) ResolveLink(p []string) (*node.Link, []string, error)
- func (as *EthAccountSnapshot) Size() (uint64, error)
- func (as *EthAccountSnapshot) Stat() (*node.NodeStat, error)
- func (as *EthAccountSnapshot) String() string
- func (as *EthAccountSnapshot) Tree(p string, depth int) []string
- type EthHeader
- func (b *EthHeader) Cid() cid.Cid
- func (b *EthHeader) Copy() node.Node
- func (b *EthHeader) Links() []*node.Link
- func (b *EthHeader) Loggable() map[string]interface{}
- func (b *EthHeader) MarshalJSON() ([]byte, error)
- func (b *EthHeader) RawData() []byte
- func (b *EthHeader) Resolve(p []string) (interface{}, []string, error)
- func (b *EthHeader) ResolveLink(p []string) (*node.Link, []string, error)
- func (b *EthHeader) Size() (uint64, error)
- func (b *EthHeader) Stat() (*node.NodeStat, error)
- func (b *EthHeader) String() string
- func (b *EthHeader) Tree(p string, depth int) []string
- type EthRctTrie
- type EthReceipt
- func (node *EthReceipt) Cid() cid.Cid
- func (*EthReceipt) Copy() node.Node
- func (*EthReceipt) Links() []*node.Link
- func (r *EthReceipt) Loggable() map[string]interface{}
- func (r *EthReceipt) MarshalJSON() ([]byte, error)
- func (node *EthReceipt) RawData() []byte
- func (r *EthReceipt) Resolve(p []string) (interface{}, []string, error)
- func (r *EthReceipt) ResolveLink(p []string) (*node.Link, []string, error)
- func (r *EthReceipt) Size() (uint64, error)
- func (r *EthReceipt) Stat() (*node.NodeStat, error)
- func (r *EthReceipt) String() string
- func (r *EthReceipt) Tree(p string, depth int) []string
- type EthStateTrie
- type EthStorageTrie
- type EthTx
- func (t *EthTx) Cid() cid.Cid
- func (t *EthTx) Copy() node.Node
- func (t *EthTx) Links() []*node.Link
- func (t *EthTx) Loggable() map[string]interface{}
- func (t *EthTx) MarshalJSON() ([]byte, error)
- func (t *EthTx) RawData() []byte
- func (t *EthTx) Resolve(p []string) (interface{}, []string, error)
- func (t *EthTx) ResolveLink(p []string) (*node.Link, []string, error)
- func (t *EthTx) Size() (uint64, error)
- func (t *EthTx) Stat() (*node.NodeStat, error)
- func (t *EthTx) String() string
- func (t *EthTx) Tree(p string, depth int) []string
- type EthTxTrie
- type TrieNode
- func (t *TrieNode) Copy() node.Node
- func (t *TrieNode) Links() []*node.Link
- func (t *TrieNode) MarshalJSON() ([]byte, error)
- func (t *TrieNode) Resolve(p []string) (interface{}, []string, error)
- func (t *TrieNode) ResolveLink(p []string) (*node.Link, []string, error)
- func (t *TrieNode) Size() (uint64, error)
- func (t *TrieNode) Stat() (*node.NodeStat, error)
- func (t *TrieNode) Tree(p string, depth int) []string
Constants ¶
const ( RawBinary = 0x55 MEthHeader = 0x90 MEthHeaderList = 0x91 MEthTxTrie = 0x92 MEthTx = 0x93 MEthTxReceiptTrie = 0x94 MEthTxReceipt = 0x95 MEthStateTrie = 0x96 MEthAccountSnapshot = 0x97 MEthStorageTrie = 0x98 )
IPLD Codecs for Ethereum See the authoritative document: https://github.com/multiformats/multicodec/blob/master/table.csv
Variables ¶
This section is empty.
Functions ¶
func FromBlockAndReceipts ¶
func FromBlockAndReceipts(block *types.Block, receipts []*types.Receipt) (*EthHeader, []*EthHeader, []*EthTx, []*EthTxTrie, []*EthReceipt, []*EthRctTrie, error)
FromBlockAndReceipts takes a block and processes it to return it a set of IPLD nodes for further processing.
Types ¶
type EthAccount ¶
type EthAccount struct { Nonce uint64 Balance *big.Int Root []byte // This is the storage root trie CodeHash []byte // This is the hash of the EVM code }
EthAccount is the building block of EthAccountSnapshot. Or, is the former stripped of its cid and rawdata components.
type EthAccountSnapshot ¶
type EthAccountSnapshot struct { *EthAccount // contains filtered or unexported fields }
EthAccountSnapshot (eth-account-snapshot codec 0x97) represents an ethereum account, i.e. a wallet address or a smart contract
func (*EthAccountSnapshot) Cid ¶
func (as *EthAccountSnapshot) Cid() cid.Cid
Cid returns the cid of the transaction.
func (*EthAccountSnapshot) Copy ¶
func (as *EthAccountSnapshot) Copy() node.Node
Copy will go away. It is here to comply with the interface.
func (*EthAccountSnapshot) Links ¶
func (as *EthAccountSnapshot) Links() []*node.Link
Links is a helper function that returns all links within this object
func (*EthAccountSnapshot) Loggable ¶
func (as *EthAccountSnapshot) Loggable() map[string]interface{}
Loggable returns in a map the type of IPLD Link.
func (*EthAccountSnapshot) MarshalJSON ¶
func (as *EthAccountSnapshot) MarshalJSON() ([]byte, error)
MarshalJSON processes the transaction into readable JSON format.
func (*EthAccountSnapshot) RawData ¶
func (as *EthAccountSnapshot) RawData() []byte
RawData returns the binary of the RLP encode of the account snapshot.
func (*EthAccountSnapshot) Resolve ¶
func (as *EthAccountSnapshot) Resolve(p []string) (interface{}, []string, error)
Resolve resolves a path through this node, stopping at any link boundary and returning the object found as well as the remaining path to traverse
func (*EthAccountSnapshot) ResolveLink ¶
ResolveLink is a helper function that calls resolve and asserts the output is a link
func (*EthAccountSnapshot) Size ¶
func (as *EthAccountSnapshot) Size() (uint64, error)
Size will go away. It is here to comply with the interface.
func (*EthAccountSnapshot) Stat ¶
func (as *EthAccountSnapshot) Stat() (*node.NodeStat, error)
Stat will go away. It is here to comply with the interface.
func (*EthAccountSnapshot) String ¶
func (as *EthAccountSnapshot) String() string
String is a helper for output
type EthHeader ¶
EthHeader (eth-block, codec 0x90), represents an ethereum block header
func DecodeEthHeader ¶
DecodeEthHeader takes a cid and its raw binary data from IPFS and returns an EthTx object for further processing.
func NewEthHeader ¶
NewEthHeader converts a *types.Header into an EthHeader IPLD node
func (*EthHeader) Links ¶
Links is a helper function that returns all links within this object HINT: Use `ipfs refs <cid>`
func (*EthHeader) MarshalJSON ¶
MarshalJSON processes the block header into readable JSON format, converting the right links into their cids, and keeping the original hex hash, allowing the user to simplify external queries.
func (*EthHeader) Resolve ¶
Resolve resolves a path through this node, stopping at any link boundary and returning the object found as well as the remaining path to traverse
func (*EthHeader) ResolveLink ¶
ResolveLink is a helper function that allows easier traversal of links through blocks
type EthRctTrie ¶
type EthRctTrie struct {
*TrieNode
}
EthRctTrie (eth-tx-trie codec 0x92) represents a node from the transaction trie in ethereum.
func DecodeEthRctTrie ¶
func DecodeEthRctTrie(c cid.Cid, b []byte) (*EthRctTrie, error)
DecodeEthRctTrie returns an EthRctTrie object from its cid and rawdata.
func (*EthRctTrie) Loggable ¶
func (t *EthRctTrie) Loggable() map[string]interface{}
Loggable returns in a map the type of IPLD Link.
func (*EthRctTrie) RawData ¶
func (t *EthRctTrie) RawData() []byte
RawData returns the binary of the RLP encode of the transaction.
type EthReceipt ¶
func DecodeEthReceipt ¶
func DecodeEthReceipt(c cid.Cid, b []byte) (*EthReceipt, error)
DecodeEthReceipt takes a cid and its raw binary data from IPFS and returns an EthTx object for further processing.
func NewReceipt ¶
func NewReceipt(receipt *types.Receipt) (*EthReceipt, error)
NewReceipt converts a types.ReceiptForStorage to an EthReceipt IPLD node
func (*EthReceipt) Cid ¶
func (node *EthReceipt) Cid() cid.Cid
func (*EthReceipt) Copy ¶
func (*EthReceipt) Copy() node.Node
Copy will go away. It is here to comply with the Node interface.
func (*EthReceipt) Links ¶
func (*EthReceipt) Links() []*node.Link
Links is a helper function that returns all links within this object
func (*EthReceipt) Loggable ¶
func (r *EthReceipt) Loggable() map[string]interface{}
Loggable returns in a map the type of IPLD Link.
func (*EthReceipt) MarshalJSON ¶
func (r *EthReceipt) MarshalJSON() ([]byte, error)
MarshalJSON processes the receipt into readable JSON format.
func (*EthReceipt) RawData ¶
func (node *EthReceipt) RawData() []byte
func (*EthReceipt) Resolve ¶
func (r *EthReceipt) Resolve(p []string) (interface{}, []string, error)
Resolve resolves a path through this node, stopping at any link boundary and returning the object found as well as the remaining path to traverse
func (*EthReceipt) ResolveLink ¶
ResolveLink is a helper function that calls resolve and asserts the output is a link
func (*EthReceipt) Size ¶
func (r *EthReceipt) Size() (uint64, error)
Size will go away. It is here to comply with the interface.
type EthStateTrie ¶
type EthStateTrie struct {
*TrieNode
}
EthStateTrie (eth-state-trie, codec 0x96), represents a node from the satte trie in ethereum.
func DecodeEthStateTrie ¶
func DecodeEthStateTrie(c cid.Cid, b []byte) (*EthStateTrie, error)
DecodeEthStateTrie returns an EthStateTrie object from its cid and rawdata.
func FromStateTrieRLP ¶
func FromStateTrieRLP(raw []byte) (*EthStateTrie, error)
FromStateTrieRLP takes the RLP representation of an ethereum state trie node to return it as an IPLD node for further processing.
func (*EthStateTrie) Cid ¶
func (st *EthStateTrie) Cid() cid.Cid
Cid returns the cid of the state trie node.
func (*EthStateTrie) Loggable ¶
func (st *EthStateTrie) Loggable() map[string]interface{}
Loggable returns in a map the type of IPLD Link.
func (*EthStateTrie) RawData ¶
func (st *EthStateTrie) RawData() []byte
RawData returns the binary of the RLP encode of the state trie node.
type EthStorageTrie ¶
type EthStorageTrie struct {
*TrieNode
}
EthStorageTrie (eth-storage-trie, codec 0x98), represents a node from the storage trie in ethereum.
func DecodeEthStorageTrie ¶
func DecodeEthStorageTrie(c cid.Cid, b []byte) (*EthStorageTrie, error)
DecodeEthStorageTrie returns an EthStorageTrie object from its cid and rawdata.
func FromStorageTrieRLP ¶
func FromStorageTrieRLP(raw []byte) (*EthStorageTrie, error)
FromStorageTrieRLP takes the RLP representation of an ethereum storage trie node to return it as an IPLD node for further processing.
func (*EthStorageTrie) Cid ¶
func (st *EthStorageTrie) Cid() cid.Cid
Cid returns the cid of the storage trie node.
func (*EthStorageTrie) Loggable ¶
func (st *EthStorageTrie) Loggable() map[string]interface{}
Loggable returns in a map the type of IPLD Link.
func (*EthStorageTrie) RawData ¶
func (st *EthStorageTrie) RawData() []byte
RawData returns the binary of the RLP encode of the storage trie node.
func (*EthStorageTrie) String ¶
func (st *EthStorageTrie) String() string
String is a helper for output
type EthTx ¶
type EthTx struct { *types.Transaction // contains filtered or unexported fields }
EthTx (eth-tx codec 0x93) represents an ethereum transaction
func DecodeEthTx ¶
DecodeEthTx takes a cid and its raw binary data from IPFS and returns an EthTx object for further processing.
func NewEthTx ¶
func NewEthTx(tx *types.Transaction) (*EthTx, error)
NewEthTx converts a *types.Transaction to an EthTx IPLD node
func (*EthTx) MarshalJSON ¶
MarshalJSON processes the transaction into readable JSON format.
func (*EthTx) Resolve ¶
Resolve resolves a path through this node, stopping at any link boundary and returning the object found as well as the remaining path to traverse
func (*EthTx) ResolveLink ¶
ResolveLink is a helper function that calls resolve and asserts the output is a link
type EthTxTrie ¶
type EthTxTrie struct {
*TrieNode
}
EthTxTrie (eth-tx-trie codec 0x92) represents a node from the transaction trie in ethereum.
func DecodeEthTxTrie ¶
DecodeEthTxTrie returns an EthTxTrie object from its cid and rawdata.
type TrieNode ¶
type TrieNode struct {
// contains filtered or unexported fields
}
TrieNode is the general abstraction for ethereum IPLD trie nodes.
func (*TrieNode) MarshalJSON ¶
MarshalJSON processes the transaction trie into readable JSON format.
func (*TrieNode) Resolve ¶
Resolve resolves a path through this node, stopping at any link boundary and returning the object found as well as the remaining path to traverse
func (*TrieNode) ResolveLink ¶
ResolveLink is a helper function that calls resolve and asserts the output is a link