turbofish-org / merk

High-performance Merkle key/value store
Apache License 2.0
226 stars 36 forks source link

Merklize key/value pair #17

Open mappum opened 5 years ago

mappum commented 5 years ago

Currently, a node's Merkle structure is H(H(key, value), left_child, right_child). However, this means that in proofs we must always be sent both the key and the value together, whereas in absence proofs there are cases when we only care about the key.

This can be fixed by changing the structure to H(H(key, H(value)), left_child, right_child) to compress the value to a single hash at the cost of one more hash per value update. We could still choose to send the value in proofs if it is less than the hash length and we want to optimize for bandwidth rather than CPU.