ipldeth

package module
v0.0.0-...-50e5a90 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 15 Imported by: 1

README

Deprecated

Note that this repo is archived and been eclipsed by https://github.com/vulcanize/go-codec-dageth

go-ipld-eth

go-ipld-eth is the set of Ethereum elements as a part of the IPLD merkle-forest

Table of Contents

Maintainers

Captain: @hermanjunge

Install

Please check the guide at this document in the /plugin directory.

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Jeromy Johnson

Documentation

Index

Constants

View Source
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

func FromBlockJSON(r io.Reader) (*EthBlock, []*EthTx, []*EthTxTrie, error)

FromBlockJSON takes the output of an ethereum client JSON API (i.e. parity or geth) and returns a set of IPLD nodes.

func FromBlockRLP

func FromBlockRLP(r io.Reader) (*EthBlock, []*EthTx, []*EthTxTrie, error)

FromBlockRLP takes an RLP message representing an ethereum block header or body (header, ommers and txs) to return it as 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 (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 (as *EthAccountSnapshot) ResolveLink(p []string) (*node.Link, []string, error)

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

func (*EthAccountSnapshot) Tree

func (as *EthAccountSnapshot) Tree(p string, depth int) []string

Tree lists all paths within the object under 'path', and up to the given depth. To list the entire object (similar to `find .`) pass "" and -1

type EthBlock

type EthBlock struct {
	*types.Header
	// contains filtered or unexported fields
}

EthBlock (eth-block, codec 0x90), represents an ethereum block header

func DecodeEthBlock

func DecodeEthBlock(c *cid.Cid, b []byte) (*EthBlock, error)

DecodeEthBlock takes a cid and its raw binary data from IPFS and returns an EthBlock object for further processing.

func (*EthBlock) Cid

func (b *EthBlock) Cid() *cid.Cid

Cid returns the cid of the block header.

func (*EthBlock) Copy

func (b *EthBlock) Copy() node.Node

Copy will go away. It is here to comply with the Node interface.

func (b *EthBlock) Links() []*node.Link

Links is a helper function that returns all links within this object HINT: Use `ipfs refs <cid>`

func (*EthBlock) Loggable

func (b *EthBlock) Loggable() map[string]interface{}

Loggable returns a map the type of IPLD Link.

func (*EthBlock) MarshalJSON

func (b *EthBlock) MarshalJSON() ([]byte, error)

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) RawData

func (b *EthBlock) RawData() []byte

RawData returns the binary of the RLP encode of the block header.

func (*EthBlock) Resolve

func (b *EthBlock) 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 (b *EthBlock) ResolveLink(p []string) (*node.Link, []string, error)

ResolveLink is a helper function that allows easier traversal of links through blocks

func (*EthBlock) Size

func (b *EthBlock) Size() (uint64, error)

Size will go away. It is here to comply with the Node interface.

func (*EthBlock) Stat

func (b *EthBlock) Stat() (*node.NodeStat, error)

Stat will go away. It is here to comply with the Node interface.

func (*EthBlock) String

func (b *EthBlock) String() string

String is a helper for output

func (*EthBlock) Tree

func (b *EthBlock) Tree(p string, depth int) []string

Tree lists all paths within the object under 'path', and up to the given depth. To list the entire object (similar to `find .`) pass "" and -1

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.

func (*EthStateTrie) String

func (st *EthStateTrie) String() string

String is a helper for output

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

func DecodeEthTx(c *cid.Cid, b []byte) (*EthTx, error)

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) Cid

func (t *EthTx) Cid() *cid.Cid

Cid returns the cid of the transaction.

func (*EthTx) Copy

func (t *EthTx) Copy() node.Node

Copy will go away. It is here to comply with the interface.

func (t *EthTx) Links() []*node.Link

Links is a helper function that returns all links within this object

func (*EthTx) Loggable

func (t *EthTx) Loggable() map[string]interface{}

Loggable returns in a map the type of IPLD Link.

func (*EthTx) MarshalJSON

func (t *EthTx) MarshalJSON() ([]byte, error)

MarshalJSON processes the transaction into readable JSON format.

func (*EthTx) RawData

func (t *EthTx) RawData() []byte

RawData returns the binary of the RLP encode of the transaction.

func (*EthTx) Resolve

func (t *EthTx) 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 (t *EthTx) ResolveLink(p []string) (*node.Link, []string, error)

ResolveLink is a helper function that calls resolve and asserts the output is a link

func (*EthTx) Size

func (t *EthTx) Size() (uint64, error)

Size will go away. It is here to comply with the interface.

func (*EthTx) Stat

func (t *EthTx) Stat() (*node.NodeStat, error)

Stat will go away. It is here to comply with the interface.

func (*EthTx) String

func (t *EthTx) String() string

String is a helper for output

func (*EthTx) Tree

func (t *EthTx) Tree(p string, depth int) []string

Tree lists all paths within the object under 'path', and up to the given depth. To list the entire object (similar to `find .`) pass "" and -1

type EthTxTrie

type EthTxTrie struct {
	*TrieNode
}

EthTxTrie (eth-tx-trie codec 0x92) represents a node from the transaction trie in ethereum.

func DecodeEthTxTrie

func DecodeEthTxTrie(c *cid.Cid, b []byte) (*EthTxTrie, error)

DecodeEthTxTrie returns an EthTxTrie object from its cid and rawdata.

func (*EthTxTrie) Cid

func (t *EthTxTrie) Cid() *cid.Cid

Cid returns the cid of the transaction.

func (*EthTxTrie) Loggable

func (t *EthTxTrie) Loggable() map[string]interface{}

Loggable returns in a map the type of IPLD Link.

func (*EthTxTrie) RawData

func (t *EthTxTrie) RawData() []byte

RawData returns the binary of the RLP encode of the transaction.

func (*EthTxTrie) String

func (t *EthTxTrie) String() string

String is a helper for output

type TrieNode

type TrieNode struct {
	// contains filtered or unexported fields
}

TrieNode is the general abstraction for ethereum IPLD trie nodes.

func (*TrieNode) Copy

func (t *TrieNode) Copy() node.Node

Copy will go away. It is here to comply with the interface.

func (t *TrieNode) Links() []*node.Link

Links is a helper function that returns all links within this object

func (*TrieNode) MarshalJSON

func (t *TrieNode) MarshalJSON() ([]byte, error)

MarshalJSON processes the transaction trie into readable JSON format.

func (*TrieNode) Resolve

func (t *TrieNode) 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 (t *TrieNode) ResolveLink(p []string) (*node.Link, []string, error)

ResolveLink is a helper function that calls resolve and asserts the output is a link

func (*TrieNode) Size

func (t *TrieNode) Size() (uint64, error)

Size will go away. It is here to comply with the interface.

func (*TrieNode) Stat

func (t *TrieNode) Stat() (*node.NodeStat, error)

Stat will go away. It is here to comply with the interface.

func (*TrieNode) Tree

func (t *TrieNode) Tree(p string, depth int) []string

Tree lists all paths within the object under 'path', and up to the given depth. To list the entire object (similar to `find .`) pass "" and -1

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL