Documentation ¶
Index ¶
- Constants
- func FromBlockJSON(r io.Reader) (*EthBlock, []*EthTx, []*EthTxTrie, error)
- func FromBlockRLP(r io.Reader) (*EthBlock, []*EthTx, []*EthTxTrie, 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 EthBlock
- func (b *EthBlock) Cid() *cid.Cid
- func (b *EthBlock) Copy() node.Node
- func (b *EthBlock) Links() []*node.Link
- func (b *EthBlock) Loggable() map[string]interface{}
- func (b *EthBlock) MarshalJSON() ([]byte, error)
- func (b *EthBlock) RawData() []byte
- func (b *EthBlock) Resolve(p []string) (interface{}, []string, error)
- func (b *EthBlock) ResolveLink(p []string) (*node.Link, []string, error)
- func (b *EthBlock) Size() (uint64, error)
- func (b *EthBlock) Stat() (*node.NodeStat, error)
- func (b *EthBlock) String() string
- func (b *EthBlock) 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 MEthBlock = 0x90 MEthBlockList = 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 FromBlockJSON ¶
FromBlockJSON takes the output of an ethereum client JSON API (i.e. parity or geth) and returns a set of IPLD nodes.
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 EthBlock ¶
EthBlock (eth-block, codec 0x90), represents an ethereum block header
func DecodeEthBlock ¶
DecodeEthBlock takes a cid and its raw binary data from IPFS and returns an EthBlock object for further processing.
func (*EthBlock) Links ¶
Links is a helper function that returns all links within this object HINT: Use `ipfs refs <cid>`
func (*EthBlock) 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 (*EthBlock) 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 (*EthBlock) ResolveLink ¶
ResolveLink is a helper function that allows easier traversal of links through blocks
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(r io.Reader) (*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(r io.Reader) (*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 NewTx ¶
func NewTx(t *types.Transaction) *EthTx
NewTx computes the cid and rlp-encodes a types.Transaction object returning a proper EthTx 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