A high-performance Rust-based platform for blockchain education and prototyping. Chaincraft Rust provides a clean, well-documented implementation of core blockchain concepts with a focus on performance, security, and educational value.
- High Performance: Built with Rust for maximum performance and memory safety
- Educational Focus: Well-documented code with clear explanations of blockchain concepts
- Modular Design: Pluggable consensus mechanisms, storage backends, and network protocols
- Cryptographic Primitives: Support for multiple signature schemes (Ed25519, ECDSA/secp256k1)
- Network Protocol: P2P networking with peer discovery and message propagation
- Flexible Storage: Memory and persistent storage options with optional SQLite indexing
- CLI Interface: Easy-to-use command-line interface for node management
cargo install chaincraft-rustgit clone https://github.com/jio-gl/chaincraft-rust.git
cd chaincraft-rust
cargo build --releaseStart a Chaincraft node with default settings:
chaincraft-cli startOr with custom configuration:
chaincraft-cli start --port 8080 --max-peers 20 --debugchaincraft-cli keygenAdd Chaincraft Rust to your Cargo.toml:
[dependencies]
chaincraft-rust = "0.1.0"use chaincraft_rust::{ChaincraftNode, Result};
#[tokio::main]
async fn main() -> Result<()> {
let mut node = ChaincraftNode::builder()
.port(21000)
.max_peers(10)
.build()?;
println!("Starting node {} on port {}", node.id(), node.port());
node.start().await?;
// Your application logic here
node.stop().await?;
Ok(())
}use chaincraft_rust::{ChaincraftNode, Result};
use chaincraft_rust::crypto::KeyType;
#[tokio::main]
async fn main() -> Result<()> {
let mut node = ChaincraftNode::builder()
.port(21000)
.max_peers(50)
.enable_compression()
.enable_persistent_storage()
.key_type(KeyType::Ed25519)
.build()?;
node.start().await?;
// Node is now running with persistent storage and compression enabled
Ok(())
}Chaincraft Rust is built with a modular architecture:
- Core: Basic blockchain data structures and validation logic
- Consensus: Pluggable consensus mechanisms (currently implementing PoS)
- Network: P2P networking layer with peer discovery
- Storage: Flexible storage backends (memory, persistent, indexed)
- Crypto: Cryptographic primitives and utilities
- CLI: Command-line interface for node management
compression: Enable message compression for network efficiency
persistent: Enable persistent storage using sledindexing: Enable SQLite-based transaction indexingvdf-crypto: Enable VDF (Verifiable Delay Function) support
Enable features in your Cargo.toml:
[dependencies]
chaincraft-rust = { version = "0.1.0", features = ["persistent", "indexing"] }- Rust 1.70 or later
- Git
git clone https://github.com/chaincraft-org/chaincraft-rust.git
cd chaincraft-rust
cargo build# Run all tests
cargo test
# Run tests with all features enabled
cargo test --all-features
# Run integration tests
cargo test --test integrationcargo benchcargo install cargo-tarpaulin
cargo tarpaulin --out HtmlFull API documentation is available on docs.rs.
To build documentation locally:
cargo doc --open --all-featuresCheck out the examples/ directory for more usage examples:
basic_node.rs: Simple node setup and operationcustom_consensus.rs: Implementing custom consensus mechanismsnetwork_simulation.rs: Multi-node network simulation
Run examples with:
cargo run --example basic_nodeWe welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for your changes
- Ensure all tests pass (
cargo test --all-features) - Run clippy (
cargo clippy --all-features) - Format your code (
cargo fmt) - Commit your changes (
git commit -am 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Chaincraft Rust is designed for high performance:
- Zero-copy serialization where possible
- Efficient async networking with tokio
- Optimized cryptographic operations
- Configurable resource limits
Security is a top priority:
- Memory-safe Rust implementation
- Cryptographic operations use well-audited libraries
- Network protocol includes message authentication
- Input validation and sanitization throughout
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Tokio for async runtime
- Cryptography powered by RustCrypto
- P2P networking with libp2p
- Advanced consensus mechanisms (PBFT)
- Smart contract support
- Enhanced monitoring and metrics
- WebAssembly runtime integration
For more information, visit our documentation or repository.