Thank you for considering contributing to Sentrix! We welcome contributions from the community and are grateful for every pull request, bug report, and feature suggestion.
- Rust 1.94+ —
rustup install stable - Visual Studio Build Tools (Windows) or GCC (Linux/macOS)
- Git
# Clone the repository
git clone https://github.com/sentrix-labs/sentrix.git
cd sentrix
# Build
cargo build
# Run tests
cargo test
# Build release
cargo build --releaseSentrix is a Cargo workspace with 14 crates under crates/ plus the
binary at bin/sentrix/:
crates/
├── sentrix-primitives/ # Block, Transaction, Account, Error types
├── sentrix-codec/ # Wire-format encoding helpers
├── sentrix-wire/ # Wire-protocol message types
├── sentrix-wallet/ # Argon2id keystore, ECDSA keypair ops
├── sentrix-trie/ # Binary Sparse Merkle Tree (MDBX backend)
├── sentrix-staking/ # DPoS, epoch, slashing
├── sentrix-evm/ # revm 37 adapter
├── sentrix-precompiles/ # EVM precompiles
├── sentrix-bft/ # BFT consensus (timeout-only round advance)
├── sentrix-core/ # Blockchain, authority, executor, mempool
├── sentrix-network/ # libp2p P2P, gossipsub, kademlia, sync
├── sentrix-rpc/ # REST API, JSON-RPC, block explorer
├── sentrix-rpc-types/ # Shared RPC request/response types
└── sentrix-storage/ # MDBX wrapper + ChainStorage API
bin/sentrix/
└── src/main.rs # CLI entry point (sentrix start, validator,
# wallet, token, chain, state, mempool, ...)
tests/ # Workspace-level integration tests live in
# crate-local `tests/` directories under each
# crate above.
The legacy single-crate src/ layout was retired in v2.1.x; any
reference to src/core/... in older docs predates the workspace
migration.
- Check existing issues to avoid duplicates
- Open a new issue with:
- Clear title describing the bug
- Steps to reproduce
- Expected vs actual behavior
- Rust version (
rustc --version) - OS and architecture
Open an issue with the feature-request label. Include:
- What problem does this solve?
- Proposed solution
- Alternatives you've considered
- Fork the repository
- Create a branch from
main:git checkout -b feat/my-feature - Make your changes — keep commits focused and atomic
- Add tests for any new functionality
- Run the test suite:
cargo test— all tests must pass - Run clippy:
cargo clippy --tests -- -D warnings— must be clean - Push to your fork and open a Pull Request
- 4-space indent (Rust default)
- snake_case for functions and variables
- PascalCase for types and structs
- UPPER_CASE for constants
- Run
cargo fmtbefore committing
Follow Conventional Commits:
feat: add staking contract
fix: correct nonce validation in mempool
docs: update API reference
test: add authority round-robin edge cases
refactor: extract fee calculation into helper
- Keep modules focused — one responsibility per file
- Add tests in the same file using
#[cfg(test)] mod tests - Public types get
pub, internals stay private
Before submitting, make sure:
-
cargo buildcompiles without errors -
cargo test— all tests pass -
cargo clippy— no warnings -
cargo fmt— code is formatted - New code has tests
- No sensitive data (keys, passwords, .env) in the commit
- Commit messages follow conventional format
- PR description explains what and why
We take testing seriously. The project has 551+ tests across 14 crates.
# All tests
cargo test
# Specific crate
cargo test -p sentrix-core
cargo test -p sentrix-wallet
cargo test -p sentrix-storage
# With output
cargo test -- --nocapture#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_descriptive_name() {
// Arrange
let mut db = AccountDB::new();
db.credit("alice", 10_000);
// Act
let result = db.transfer("alice", "bob", 5_000, 100);
// Assert
assert!(result.is_ok());
assert_eq!(db.get_balance("bob"), 5_000);
}
}- No unsafe code — we don't use
unsafeblocks - Integer arithmetic — balances use
u64(sentri), neverf64 - Atomic validation — blocks are validated in two passes (dry-run → commit)
- Fail fast — use
SentrixResult<T>and propagate errors with? - Deterministic — same input always produces same output (critical for consensus)
- Bug fixes with a regression test
- Performance improvements with benchmarks
- New features aligned with the roadmap
- Documentation improvements
- Test coverage for uncovered code paths
- Breaking changes to the consensus protocol without discussion
- Dependencies with C bindings (we prefer pure Rust)
- Features not aligned with the roadmap
- Code without tests
If you find a security vulnerability, do NOT open a public issue. See SECURITY.md for responsible disclosure instructions.
- GitHub Issues — bugs and feature requests
- Pull Requests — code contributions
- Discussions — questions and ideas
By contributing to Sentrix, you agree that your contributions will be licensed under the BUSL-1.1 license.
Thank you for being part of building Sentrix!