I am trying to implement a Simplified World State Trie based on Merkle Patricia Tree.
Take the following image for example enter image description here

there are four accounts

address  value

a711355   45
a77d337   1
a7f9365    2
a77d397   12

my question is, how do I generate the state root using programming language?
I was trying

const RLP = require('rlp');
const keccak256 = require('keccak256');
var nestedList = [0,"a7",
var encoded = RLP.encode(nestedList);

but clearly it's wrong, it comes out 09ac270191aa233ea294b2ffab5da5adf7620aef7739eb162ca6cacb245ebe63
where I believe the correct answer is 5838ad5578f346f40d3e6b71f9a82ae6e5198dd39c52e18deec63734da512055

Any comment or answer is appreciated!! thanks for your valuable time



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.