Created
April 7, 2018 20:16
-
-
Save moea/d5c1927d244b293ed9c411bf7140f232 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import sys, rlp, leveldb | |
from ethereum import trie | |
db = leveldb.LevelDB('/tmp/xyz') | |
class X: | |
def get(self, a): | |
return db.Get(a) | |
def put(self, a, b): | |
return db.Put(a, b) | |
def commit(self): | |
pass | |
state = trie.Trie(X(), '') | |
i = 0 | |
for line in file('/usr/share/dict/words'): | |
if i == 500: | |
break | |
line = line.strip() | |
state.update(line, line) | |
i += 1 | |
print line, state.root_hash.encode('hex') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment