Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Murky does not match OpenZeppelin/merkle-tree or merkletreejs implementations #11

Open
0xTimepunk opened this issue Dec 7, 2023 · 1 comment

Comments

@0xTimepunk
Copy link

0xTimepunk commented Dec 7, 2023

The issue reported in https://ethereum.stackexchange.com/questions/129249/merkle-tree-not-matching-between-solidity-and-etherjs

Cannot be fixed by adding one element by making it even - this only seems to work if the number of leaves is small (3 in the case of the example above, making it 4)

But for a tree of say 9 elements, adding a zero node does not solve the issue

Why does murky not follow the bitcoin tree implementation?

@dmfxyz
Copy link
Owner

dmfxyz commented Dec 17, 2023

Thanks for the issue. That is how Bitcoin implements its merkle trees, but is not the only way. When murky was originally written, zero padding for odd number of leafs best matched off chain implementations I was writing.

A tree of 9 elements should definitely be coercible to match. But, either way, I will consider adding a Bitcoin style implementation. And would absolutely welcome a PR that does so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants