A Method for Computing Merkle Roots of Annotated Binary Trees



Summary:

In a discussion on bitcoin-dev email group, Russell O'Connor describes the SHA256 compression function that takes a 256-bit value for the previous chunk in a chain, or an initial vector in the case of the first chunk, and a 512-bit chunk of data. The total compression is done from 768-bits to 256-bits. This property makes it useful primitive for building Merkle Trie. O'Connor suggests that in his construction, values are already hashed down to 256 bits when they are passed in, and the tags include three states for either side: empty, unary or middle. Six possible tags are needed for this approach. He also believes that this approach improves performance by skipping the unary hashes and there appears to be no downside in leveraging this trick as long as tags are cheap.


Updated on: 2023-06-12T01:06:32.757669+00:00