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

MerkleTree from 1 data node #40

Open
Dmdv opened this issue May 20, 2024 · 1 comment
Open

MerkleTree from 1 data node #40

Dmdv opened this issue May 20, 2024 · 1 comment

Comments

@Dmdv
Copy link

Dmdv commented May 20, 2024

Why merkle tree can't be from 1 node?

// Check if there are enough data blocks to build the tree.

Even if there's just one mode, we still can compute 1 node merkle tree.
What is the standard solution?

@txaty
Copy link
Owner

txaty commented May 22, 2024

Hi! Thanks for using the library and providing feedbacks.

From the Bitcoin source code of Merkle Tree and this GitHub issue, seems like the standard solution is to make the solo node the root of the tree.

I thought it was meaningless and lack of use cases to construct a Merkle Tree with only one leaf so I enforced the number of leaves to be at least 2.

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