Different result from merkletreejs and sha256

38 views Asked by At

I am just wondering if there is any logic which I don't see because when I manually hash two hashes together the result hash is different then the output from merkletreejs

const tree = new MerkleTree(leaves, sha256, { hashLeaves: true })

output:

├─ 329b7dd2b17d26a5ee578389e64e6861da47db80a688ac7a5f0729fbaefd5848
   │  ├─ ed0d6fb1b0dbf79915f8a61a163ddbd3087a5056397c1adac85950686ab50c89
   │  └─ 1ac1a71edc321a27fed1fd6166b1f635fccc178b46e377bb24aef154179970bc

but when I get these two leaves hashes and join them together and use sha256 then I am getting this

const hash = sha256('ed0d6fb1b0dbf79915f8a61a163ddbd3087a5056397c1adac85950686ab50c891ac1a71edc321a27fed1fd6166b1f635fccc178b46e377bb24aef154179970bc')

//hash is: b03bfd00deb2fa8b29a6e8846e15315dc9d0fb1d15e67b2d6f7101ffcc793913

which is the same result I am getting for example from the online visualization tool https://blockchain-academy.hs-mittweida.de/merkle-tree/

Thanks for clarify

0

There are 0 answers