Module rustreexo::accumulator

source ·
Expand description

This module is the core of the library. It contains all the basic data structures for Utreexo, such as accumulator and proofs. The different data structures are compatible with each other and you may use different data structures to represent the accumulator. Each with its own advantages and disadvantages, and may be selected based on your use case.

If you only need to verify and cache proofs used in your wallet, see stump::Stump, a lightweight implementation of utreexo that only stores roots. Although the stump::Stump only keeps the accumulator’s roots, it still trustlessly update this state, not requiring a trusted third party to learn about the current state.

Modules

  • NodeHash is an internal type for representing Hashes in an utreexo accumulator. It’s just a wrapper around [[u8; 32]] but with some useful methods.
  • A full Pollard accumulator implementation. This is a simple version of the forest, that keeps every node in memory. This is may require more memory, but is faster to update, prove and verify.
  • A proof is a data structure that proves that a given element is in the accumulator. It is used to validate a transaction. A proof is composed of a list of hashes and a list of integers. The hashes are the hashes need to calculate the root hash for validation. The integers are the position of the element in the accumulator.
  • A Stump is a basic data structure used in Utreexo. It only holds the roots and the number of leaves in the accumulator. This is useful to create lightweight nodes, the still validates, but is more compact, perfect to clients running on low-power devices.