Skip to content

Instantly share code, notes, and snippets.

@wanderer
Created August 21, 2014 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wanderer/5cb216961395ac287fd5 to your computer and use it in GitHub Desktop.
Save wanderer/5cb216961395ac287fd5 to your computer and use it in GitHub Desktop.
//npm install ethereum-lib
//npm install level
var Ethereum = require('ethereum-lib'),
levelup = require('levelup');
var internals = {},
Trie = Ethereum.Trie,
rlp = Ethereum.rlp,
etherUtils = Ethereum.utils,
//chanage to your directory
stateDB = levelup('/home/null/.ethereum/state');
var state = new Trie(stateDB);
//put the state root here
var stateRoot = new Buffer('8dbd704eb38d1c2b73ee4788715ea5828a030650829703f077729b2b613dd206', 'hex');
state.root = stateRoot;
var stream = state.createReadStream();
stream.on("data", function (data) {
console.log("key: " + data.key.toString("hex"));
var decoded = rlp.decode(data.value);
// buffer array to json; lol
console.log("decoded: " + etherUtils.BAToJSON( decoded));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment