Utreexo in rust
  • Rust 99.1%
  • Just 0.7%
  • Shell 0.2%
Find a file
merge-script 8f5139afd4
Merge mit-dci/rustreexo#113: Use cargo-rbmt for CI and local testing
04fbfa0b56 feat(ci): group dependabot PRs by ecosystem (Luis Schwab)
97b8760803 feat(cargo): add `categories` field to `Cargo.toml` (Luis Schwab)
d7841f34dc feat: run examples with `with-serde` and `std` features (Luis Schwab)
1e8053e4dc chore(ci): remove `extractions/setup-just` dependency from CI (Luis Schwab)
2a023cd5f3 feat(doc): update `README.md` (Luis Schwab)
65993c17e8 feat(ci): update Rust CI workflow to use `cargo-rbmt` (Luis Schwab)
7fd744d4c7 feat(ci): update benchmark workflow (Luis Schwab)
213f5aede9 chore(ci): update and format workflows (Luis Schwab)
d3cef9ce93 feat(ci): add commit signature check workflow (Luis Schwab)
7d4e79bc1d feat: commit `Cargo-recent.lock` and `Cargo-minimal.lock` (Luis Schwab)
a921eee920 chore: remove `rust-toolchain.toml` (Luis Schwab)
ee494a2316 chore: rename bench and example files (Luis Schwab)
72cc5e1822 chore: remove dead code and fix MSRV compilation (Luis Schwab)
7024bb1e0e feat: add `cargo-rbmt` (Luis Schwab)

Pull request description:

  Closes #103

  This PR changes all local and CI testing infrastructure to use [`cargo-rbmt`]().

  ## Changelog
  ```
  - Add `cargo-rbmt`
    - Update the `justfile` to use `cargo-rbmt` commands
    - Update `Cargo.toml`:
      - Add `[package.metadata.rbmt.*]` fields
      - Pin dependencies for MSRV
      - Remove example declarations
    - Commit `Cargo-minimal.lock` and `Cargo-recent.lock`

  - Remove `rust-toolchain.toml`
  - Add commit signature check to CI
  - Remove dead benchmarking code
  - Update the `README.md`
  ```

ACKs for top commit:
  lorenzolfm:
    ACK 04fbfa0b56
  Davidson-Souza:
    re-ACK 04fbfa0b56

Tree-SHA512: cbb4479133e5759a2512b8f7464a2839d051276066fb47f330fe29a4d4f22420a0f9c357d126251447b3dc0c0ae9c57403461ac70541c9ceb4a80d263f140ef2
2026-05-12 10:23:39 -03:00
.github feat(ci): group dependabot PRs by ecosystem 2026-05-11 18:52:45 -03:00
benches chore: rename bench and example files 2026-05-05 14:20:05 -03:00
contrib chore(ci): remove extractions/setup-just dependency from CI 2026-05-11 18:52:33 -03:00
examples chore: rename bench and example files 2026-05-05 14:20:05 -03:00
src chore: remove dead code and fix MSRV compilation 2026-05-05 14:20:02 -03:00
test_values Implementation of Proof::Update 2023-01-23 13:28:10 -03:00
.gitignore update .gitignore 2023-12-20 23:57:30 -03:00
Cargo-minimal.lock feat: commit Cargo-recent.lock and Cargo-minimal.lock 2026-05-05 14:20:09 -03:00
Cargo-recent.lock feat: commit Cargo-recent.lock and Cargo-minimal.lock 2026-05-05 14:20:09 -03:00
Cargo.toml feat(cargo): add categories field to Cargo.toml 2026-05-11 18:52:43 -03:00
justfile chore(ci): remove extractions/setup-just dependency from CI 2026-05-11 18:52:33 -03:00
LICENSE-APACHE chore: relicense this project under MIT OR Apache-2.0 2026-03-12 14:29:46 -03:00
LICENSE-MIT chore: relicense this project under MIT OR Apache-2.0 2026-03-12 14:29:46 -03:00
LICENSE.md chore: remove rust-toolchain.toml 2026-05-05 14:20:07 -03:00
rbmt-version feat: add cargo-rbmt 2026-05-05 14:19:59 -03:00
README.md feat(doc): update README.md 2026-05-05 14:21:24 -03:00
rustfmt.toml chore: remove rust-toolchain.toml 2026-05-05 14:20:07 -03:00

rustreexo

A Rust implementation of Utreexo, a dynamic hash-based accumulator optimized for the Bitcoin UTXO set.

Utreexo enables constructing a succinct representation of the Bitcoin UTXO in a logarithmic amount of size, by leveraging Merkle trees. Set membership can be proven and verified through Merkle inclusion proofs.

This library implements three accumulator primitives:

  • Stump: keeps the roots of the Merkle forest, using O(\log{n}) space

  • Pollard: keeps a specific set of leaves of the Merkle forest, using O(k \cdot \log{n}) space

  • MemForest: keeps all leaves of the Merkle forest, using O(n) space,

where n is the number of leaves, and k is the number of cached leaves.

Usage

use rustreexo::node_hash::BitcoinNodeHash;
use rustreexo::proof::Proof;
use rustreexo::stump::Stump;

let utxo = BitcoinNodeHash::from_str("b151a956139bb821d4effa34ea95c17560e0135d1e4661fc23cedc3af49dac42").unwrap();

// Create an accumulator
let stump = Stump::new();

// Add the UTXO to the accumulator
let (stump, _) = stump.modify(&vec![utxo], &[], &Proof::default()).unwrap();

// Create an inclusion proof for the UTXO that was added
let proof = Proof::new(vec![0], vec![utxo]);

// Remove the UTXO from the accumulator by proving its set membership
let (stump, _) = stump.modify(&vec![], &vec![utxo], &proof).unwrap();

To see complete usage examples, refer to the examples/ folder.

Developing

This project uses cargo-rbmt to manage everything related to cargo, such as formatting, linting, testing and CI. To install it, run:

~$ cargo install cargo-rbmt

A justfile is provided for convenience. Run just to see available commands:

~$ just
> rustreexo
> A Rust implementation of Utreexo

Available recipes:
    bench BENCH="" # Run benchmarks: accumulator, proof, stump
    check          # Check code formatting, compilation, and linting [alias: c]
    check-sigs     # Checks whether all commits in this branch are signed [alias: cs]
    doc            # Generate documentation [alias: d]
    doc-open       # Generate and open documentation [alias: do]
    fmt            # Format code [alias: f]
    lock           # Regenerate Cargo-recent.lock and Cargo-minimal.lock [alias: l]
    pre-push       # Run pre-push suite: lock, fmt, check, test, and test-no-std [alias: p]
    test           # Run tests across all toolchains and lockfiles [alias: t]
    test-no-std    # Run no_std build check with the MSRV toolchain (1.74.0) [alias: tns]

Minimum Supported Rust Version (MSRV)

This library should compile with any combination of features on Rust 1.74.0.

To build with the MSRV toolchain, copy Cargo-minimal.lock to Cargo.lock.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

References