This is an implementation of the modified merkle patricia tree as specified in the Ethereum Yellow Paper:
The modified Merkle Patricia tree (trie) provides a persistent data structure to map between arbitrary-length binary data (byte arrays). It is defined in terms of a mutable data structure to map between 256-bit binary fragments and arbitrary-length binary data. The core of the trie, and its sole requirement in terms of the protocol specification is to provide a single 32-byte value that identifies a given set of key-value pairs.
The only backing store supported is LevelDB through the
npm install merkle-patricia-tree
There are 3 variants of the tree implemented in this library, namely:
CheckpointTrie adds checkpointing functionality to the
BaseTrie with the methods
CheckpointTrie and is the most suitable variant for Ethereum applications. It stores values under the
keccak256 hash of their keys.
Initialization and Basic Usage
Read stream on Geth DB
// Set stateRoot to block #222// Initialize trietrie.createReadStream.on'data', console.log.on'end',
Read Account State including Storage from Geth DB
- Blog posts
See our organizational documentation for an introduction to
EthereumJS as well as information on current standards and best practices.
If you want to join for work or do improvements on the libraries have a look at our contribution guidelines.