-
Notifications
You must be signed in to change notification settings - Fork 41
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
Feature Request: Sparse Merkle Tree #25
Comments
A sparse merkle tree requires some kind of data management unless you're only going a few levels deep (unlikely). The sparse merkle block commitment was an idea joseph and I had (as an alternative to the severely flawed way other projects are doing this). The basic notion is you allocate a sparse merkle tree 32 levels deep. You create an authenticated map of height(uint32) to hash. To get actual distribution at the leaves, you run the height through a perfect hash function before insertion (1 2 3). 32 bits is ~4.3 billion potential leaves, so that necessitates some kind of data management. This doesn't belong in bcrypto. It definitely justifies having its own repo. We had an impl. of a sparse merkle tree to benchmark it against urkel a while ago. It's either in the urkel repo history or the btrie repo. If we decide to do this for handshake, I would probably just include it in the hsd repo. edit: Also, note that this might be the only legitimate use-case for a sparse merkle tree in the blockchain space. It's far too slow to use for anything else. |
I think its possible to create a wrapper over
lib/mrkl.js
to create a sparse merkle tree with an easy to use API. This could be used to add commitments to all previous blocks in the block header, allowing for a Flyclient like construction. Light clients will be able to run even lighter as they will not need to index all previous blocks and can just keep the latest block indexed.Potential API:
It would also be cool to allow for passing custom read/write functions, similar to how bcoin has a custom
createSocket
function, so that different storage backends can be used/tested.Is this something that you would consider for bcrypto?
The text was updated successfully, but these errors were encountered: