From 1bded4e3786ffc53fff9010082376d7d14dcd04f Mon Sep 17 00:00:00 2001 From: Davidson Souza Date: Mon, 14 Aug 2023 14:10:51 -0300 Subject: [PATCH 1/3] Update readme with useful info --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index abb284b..a9797a9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,41 @@ -# rustreexo - Utreexo in rust +# rustreexo - Utreexo in rust -This is an on-going library to implement/port the golang Utreexo code to Rust. +![Build Status](https://github.com/mit-dci/rustreexo/actions/workflows/rust.yml/badge.svg) + +Utreexo is a dynamic hash-based accumulator designed to be used as a set membership proof system and it is used in the Bitcoin network to compress the UTXO set. This is a pure-rust implementation of the accumulator, allowing proving and verifying set membership proofs. + +## Usage + +Rustreexo provides two basic data structures to represent the accumulator, `Stump` and `Pollard`. `Stump` is a lightweight version of the accumulator that only keeps the roots, and therefore only uses `O(log n)` space. `Pollard` is a more complete version of the accumulator that keeps the full tree, and therefore uses `O(n)` space. However, both data structures implements the same algorithms, so a proof generated by a `Pollard` is meant to be verified by a `Stump`. Here's how to use the `Stump`: + +```rust +use rustreexo::accumulator::stump::Stump; + +let stump = Stump::new(); +// Modify the accumulator, adding UTXOs and removing STXOs, that are proved by del_proof +let (stump, _) = stump.modify(utxos, stxos, del_proof).unwrap(); +// Verify a proof for a UTXO +assert!(stump.verify(utxo_proof).unwrap()); +``` + +for a complete example, see `examples/`. + +## Testing + +This library contains an exhaustive test suite that covers all the algorithms implemented. To run the tests, simply run `cargo test`. We test for internal code sanity and cross-test with values generated by the [utreexo](https://github.com/utreexo/utreexo) lib. + +## License + +rustreexo is released under the terms of the MIT license. See [LICENSE](LICENSE) for more +information or see https://opensource.org/licenses/MIT. + +## References + +- [Utreexo: A dynamic hash-based accumulator optimized for the Bitcoin UTXO set](https://eprint.iacr.org/2019/611.pdf) +- [Dev++ 03-09-EN | Acumulator Based Cryptography & UTreexo](https://www.youtube.com/watch?v=xlKQP9J88uA) +- [What is UTreeXO? with Calvin Kim](https://www.youtube.com/watch?v=IcHW6RsZR7o) +- [Rustreexo](https://blog.dlsouza.lol/bitcoin/utreexo/2023/07/07/rustreexo.html) + +## Contributing + +Contributions are welcome! Please feel free to submit a Pull Request. From 11f958495e994994f55644b45c300f89129b52c3 Mon Sep 17 00:00:00 2001 From: Davidson Souza Date: Mon, 14 Aug 2023 14:12:58 -0300 Subject: [PATCH 2/3] Add required cargo.toml fields --- Cargo.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 19080df..cb127d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,11 @@ name = "rustreexo" version = "0.1.0" authors = ["Calvin Kim "] edition = "2018" +description = "A Rust implementation of Utreexo" +license = "MIT" +repository = "https://github.com/mit-dci/rustreexo" +readme = "README.md" +homepage = "https://github.com/mit-dci/rustreexo" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] From d6471d25b1051ce9b0cfde5dcaf0ca823765c93e Mon Sep 17 00:00:00 2001 From: Davidson Souza Date: Mon, 14 Aug 2023 14:23:18 -0300 Subject: [PATCH 3/3] Add a few badges to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a9797a9..5441dcc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # rustreexo - Utreexo in rust ![Build Status](https://github.com/mit-dci/rustreexo/actions/workflows/rust.yml/badge.svg) +![License](https://img.shields.io/crates/l/rustreexo) +![Version](https://img.shields.io/crates/v/rustreexo) +![Downloads](https://img.shields.io/crates/d/rustreexo) Utreexo is a dynamic hash-based accumulator designed to be used as a set membership proof system and it is used in the Bitcoin network to compress the UTXO set. This is a pure-rust implementation of the accumulator, allowing proving and verifying set membership proofs.