Skip to content

Instantly share code, notes, and snippets.

@moea
Created April 7, 2018 20:16
Show Gist options
  • Save moea/d5c1927d244b293ed9c411bf7140f232 to your computer and use it in GitHub Desktop.
Save moea/d5c1927d244b293ed9c411bf7140f232 to your computer and use it in GitHub Desktop.
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