I read Understanding the ethereum trie and try to do examples from that article. Now i am at ex1.py
- first exaple. Look at code from that example:
import sys
sys.path.append('src')
import trie, utils, rlp
#initialize trie
state = trie.Trie('triedb', trie.BLANK_ROOT)
state.update('\x01\x01\x02', rlp.encode(['hello']))
print 'root hash', state.root_hash.encode('hex')
k, v = state.root_node
print 'root node:', [k, v]
print 'hp encoded key, in hex:', k.encode('hex')
after work around line:
state.update('\x01\x01\x02', rlp.encode(['hello']))
I saw how code create state.root_hash
, in example it is:
15da97c42b7ed2e1c0c8dab6a6d7e3d9dc0a75580bbc4f1f29c33996d1415dcc
I obtain another, but not understood how get it. Can anyone explain me?
So we has:
key = pack_nibbles(with_terminator('\x01\x01\x02')
value = rlp.encode(['hello'])
How from that we got state.root_hash
?