Created
August 21, 2014 20:10
-
-
Save wanderer/5cb216961395ac287fd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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