SYNOPSIS
This is an implementation of the modified merkle patricia tree as specified in the Ethereum's 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.
- Ethereum's yellow paper
The only backing store supported is LevelDB through the levelup
module.
INSTALL
npm install icjs-mpt
USAGE
Initialization and Basic Usage
var Trie = levelup = db = trie = db; trie;
Merkle Proofs
Trie
Read stream on Geth DB
var levelup = var Trie = var stateRoot = "0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544" // Block #222 var db = var trie = db stateRoot trie
API
TESTING
npm test
REFERENCES
- "Exploring IrChain's state trie with Node.js" blog post
- "Merkling in Ethereum" blog post
- Ethereum Trie Specification Wiki
- "Understanding the irchain trie" blog post
- "Trie and Patricia Trie Overview" Video Talk on Youtube
LICENSE
MPL-2.0