Rhizome - P2P protocol
Rhizome is a highβperformance, decentralized P2P messaging library implemented on Rust. It is based on the Kademlia DHT protocol with custom data replication and content ranking mechanisms.
β¨ Features
- π¦
Rust Core: Maximum performance and memory security without GC. - π
Anonymity: DHT-based routing hides direct connections between network participants. - β‘
Async First: A fully asynchronous stack based on tokio and futures. - π
Smart replication: Automatic distribution of data to k-nearest nodes. - π
Popularity system: Content in demand gets storage priority and a higher TTL. - π¦
Modularity: You can use it as a ready-made CLI node, or connect it as a library (cargo lib) to your project.
π Technology stack
Runtime & Async: Fully asynchronous architecture based on tokio (full) and futures. Using async-trait for flexible component design.Persistence (Storage): heed is a highβperformance embedded database (a wrapper over LMDB) that provides ACID transactions and instant access to data.Cryptography & Security:RSA (with SHA-2 support)for key management and digital signatures.sha1, sha2, digestβ a set of cryptographic hash functions for data integrity and identification in DHT.
Serialization:rmp-serde (MessagePack)is the main binary protocol for minimizing traffic in a P2P network.serde_json & serde_yamlβ for configuration and external `APIs'.
Observability (Logging): An advanced system based ontracing. Support for structured logging (JSON), filtering via env-filter, and log file rotation via tracing-appender.Portability (WASM): Support for compilation to `WebAssembly' (wasm-bindgen) for use in browser environments, including integration with getrandom/js.Development & Quality:- Automatic style and linting control via
cargo-husky(pre-commit hooks for fmt and clippy). - The use of
thiserrorfor strict and understandable error typing.
- Automatic style and linting control via
π Project structure
rhizome/
βββ examples/ # Examples of the system operation
βββ src/ # The main project code
β βββ config.rs # Configuration Module
β βββ logger.rs # The logging module
β βββ api.rs # API module for external operation
β βββ exception.rs # Error management module
β βββ dht/ # Kademlia DHT Module
β βββ network/ # Network operation module
β βββ node/ # Node Module
β βββ popularity/ # A module for the operation of the reputation system
β βββ replication/ # Data replication
β βββ storage/ # Storage System Module
β βββ utils/ # Auxiliary functions module
β βββ security/ # The security module
π Setup and develop
For project build you need Rust version 1.85+ (because we will use Edition 2024).
rustup update stable
Clone and build
Bash
git clone https://github.com/vazonhub/rhizome.git
cd rhizome
cargo build
Run tests
For running tests you can use:
Bash
# Run all tests
cargo test
# Run tests with logs in console
RUST_LOG=debug cargo test -- --nocapture
Static analyze and formating
In project, we have some feature for code analyze and formating:
- Formating by (
cargo fmt) - Analyze linter by (
cargo clippy)
π€ Participation in the development
We are happy to see your Pull Requests!
- Create fork from
developbranch; - Create branch:
git checkout -b feature/amazing-feature; - Commit changes:
git commit -m 'Add amazing feature'; - Create push in your branch:
git push origin feature/amazing-feature; - Check pre-commit result. If you have any troubles you can't push anything.
- Open
Pull Request.
We use git flow in branch architecture. Create your pull request in
developbranch.
π License
Distributed under the Apache 2.0 license. Details in the file LICENSE.
π₯ Author
Rhizome Dev Team - GitHub.
Inspired by the resilience of nature. Built for the freedom of speech.