|
1 | | -# rustreexo - Utreexo in rust |
| 1 | +# rustreexo - Utreexo in rust |
2 | 2 |
|
3 | | -This is an on-going library to implement/port the golang Utreexo code to Rust. |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +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. |
| 9 | + |
| 10 | +## Usage |
| 11 | + |
| 12 | +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`: |
| 13 | + |
| 14 | +```rust |
| 15 | +use rustreexo::accumulator::stump::Stump; |
| 16 | + |
| 17 | +let stump = Stump::new(); |
| 18 | +// Modify the accumulator, adding UTXOs and removing STXOs, that are proved by del_proof |
| 19 | +let (stump, _) = stump.modify(utxos, stxos, del_proof).unwrap(); |
| 20 | +// Verify a proof for a UTXO |
| 21 | +assert!(stump.verify(utxo_proof).unwrap()); |
| 22 | +``` |
| 23 | + |
| 24 | +for a complete example, see `examples/`. |
| 25 | + |
| 26 | +## Testing |
| 27 | + |
| 28 | +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. |
| 29 | + |
| 30 | +## License |
| 31 | + |
| 32 | +rustreexo is released under the terms of the MIT license. See [LICENSE](LICENSE) for more |
| 33 | +information or see https://opensource.org/licenses/MIT. |
| 34 | + |
| 35 | +## References |
| 36 | + |
| 37 | +- [Utreexo: A dynamic hash-based accumulator optimized for the Bitcoin UTXO set](https://eprint.iacr.org/2019/611.pdf) |
| 38 | +- [Dev++ 03-09-EN | Acumulator Based Cryptography & UTreexo](https://www.youtube.com/watch?v=xlKQP9J88uA) |
| 39 | +- [What is UTreeXO? with Calvin Kim](https://www.youtube.com/watch?v=IcHW6RsZR7o) |
| 40 | +- [Rustreexo](https://blog.dlsouza.lol/bitcoin/utreexo/2023/07/07/rustreexo.html) |
| 41 | + |
| 42 | +## Contributing |
| 43 | + |
| 44 | +Contributions are welcome! Please feel free to submit a Pull Request. |
0 commit comments