NeoRust
A comprehensive, production-ready Rust SDK for the Neo N3 blockchain platform. NeoRust provides an enterprise-grade toolkit with simplified APIs, real-time features, and professional developer tools for building blockchain applications.
📊 Project Status
- Version: 1.0.1 (Production Ready - Security Hardened)
- Rust Version: 1.70.0+
- Platform Support: Windows, macOS, Linux
- Security: Dependencies audited; no known CVEs, with tracked unmaintained transitive crates only
- Coverage: Comprehensive testing with property-based tests
- Production Readiness: Enterprise-grade with WebSocket support, HD wallets, and transaction simulation
- Performance: <100ms WebSocket latency, <10ms HD derivation, 50-70% code reduction
Features
Core Features
- 🔐 Cryptography - Complete cryptographic functions including key generation, signing, and verification
- 💼 Wallet Management - Create, import, and manage Neo wallets with hardware wallet support
- 🔗 RPC Client - Full-featured RPC client for Neo N3 node interaction
- 📦 Smart Contracts - Deploy, invoke, and interact with Neo N3 smart contracts
- 🪙 Token Support - Native NEP-17 token operations and custom token support
- 🌐 Network Support - Mainnet, Testnet, and custom network configurations
New in v1.0.x 🚀
- 🌐 WebSocket Support - Real-time blockchain events with auto-reconnection
- 🔑 HD Wallet (BIP-39/44) - Hierarchical deterministic wallets with mnemonic phrases
- 🔮 Transaction Simulation - Preview effects and estimate gas before submission
- 🎯 High-Level SDK API - Simplified interface reducing code by 50-70%
- 🧙 Interactive CLI Wizard - Guided blockchain operations with visual feedback
- 📦 Project Templates - Quick-start templates for dApps, tokens, and smart contracts
- 🔧 Unified Error Handling - Consistent errors with recovery suggestions
- ⚡ Performance Optimized - <100ms event processing, efficient caching
- 🆕 Neo 3.9 Ready - Full support for Hardfork Echidna, Faun, and upcoming Gorgon
Applications
- 🖥️ CLI Tools - Command-line interface for common blockchain operations
Quick Start
Add NeoRust to your Cargo.toml:
[]
= "1.0.1"
Basic Usage
New Simplified API (v1.0.x+)
use ;
use Duration;
async
Choose Your Transport (HTTP / WS / IPC / Mock)
use ;
// 1) HTTP (default, no extra feature flags)
let http = new?;
let client = new;
// 2) Modern WebSocket client (enable the `ws` feature)
// 3) IPC (enable the `ipc` feature)
// 4) Offline-friendly mock (enable the `mock` feature; great for tests/CI)
Feature Flags
ws: enable the modern WebSocket transportipc: enable IPC (Unix domain sockets / Windows named pipes)legacy-ws: legacy WebSocket compatibility layer (fallback)mock: enableMockClientand in-memory mocking helpersledger,yubi: opt into hardware wallet supportno_std,sgx: specialized environments
WebSocket Real-time Events
Requires the ws feature:
= { = "1.0.1", = ["ws"] }
use ;
// Connect to WebSocket
let mut ws = new.await?;
ws.connect.await?;
// Subscribe to new blocks
let handle = ws.subscribe.await?;
// Process events
if let Some = ws.take_event_receiver
HD Wallet with BIP-39
use HDWallet;
// Generate new HD wallet with 24-word mnemonic
let wallet = generate?;
println!;
// Derive multiple accounts
let mut wallet = wallet;
let account1 = wallet.derive_account?;
let account2 = wallet.derive_account?;
// Import from existing mnemonic
let wallet = from_phrase?;
Transaction Simulation
use TransactionSimulator;
// Create simulator
let mut simulator = new;
// Simulate before sending
let result = simulator.simulate_script.await?;
if result.success else
Traditional API (still supported)
use ;
async
Components
Core SDK (neo3)
The main Rust SDK providing all blockchain functionality.
CLI Tool (neo-cli)
Interactive command-line interface with wizard mode:
# Launch interactive wizard
# Generate a new project from template
# Common commands
Building
Core SDK and CLI
Documentation
- Installation Guide
- API Documentation
- WebSocket Guide
- HD Wallet Guide
- Transaction Simulation Guide
- Examples
- CLI Documentation
- Migration Guide to v1.0
Examples
Explore our comprehensive examples:
- Basic Operations: Wallet creation, token transfers, balance queries
- Smart Contracts: Deploy and interact with Neo N3 contracts
- WebSocket Events: Real-time blockchain monitoring and event handling
- HD Wallets: BIP-39/44 mnemonic wallets with account derivation
- Transaction Simulation: Gas estimation and state change preview
- Advanced Features: Multi-sig wallets, hardware wallet integration
- DeFi Integration: Interact with popular Neo DeFi protocols
- Neo X: Cross-chain bridge operations
- Live RPC (optional): Set
NEO_RPC_URLto point examples at your preferred node; otherwise they run offline-friendly paths.
See the examples directory for full code samples.
License
Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)
Testing
# Run all tests
# Run specific component tests
# Run integration tests
CI/CD
The project uses streamlined GitHub Actions workflows:
GitHub Workflows
-
build-test.yml - Unified build, test, and quality checks
- Multi-platform testing (Linux, Windows, macOS)
- Rust formatting and clippy checks
- Security audit on every PR
- Code coverage reporting
-
release.yml - Automated release process
- Triggered by version tags (v*..)
- Cross-platform binary builds
- Automatic crates.io publishing
- GitHub release creation with artifacts
- Release notes extraction from CHANGELOG
Running Tests Locally
# Format check
# Clippy lints
# Run all tests
# Security audit
# Build documentation
Feature Comparison
| Feature | Pre-1.0 | v1.0.x | Improvement |
|---|---|---|---|
| Connection Setup | 5-10 lines | 1 line | 90% reduction |
| Balance Check | Manual RPC + parsing | Single method | 70% reduction |
| Error Handling | Basic errors | Recovery suggestions | Enhanced UX |
| Real-time Events | Not supported | WebSocket with auto-reconnect | New feature |
| HD Wallets | Not supported | BIP-39/44 compliant | New feature |
| Gas Estimation | Manual calculation | Automatic simulation | 95% accuracy |
| Transaction Preview | Not available | Full state change preview | New feature |
| Project Setup | Manual | Template generation | 80% faster |
| CLI Experience | Commands only | Interactive wizard | Enhanced UX |
Migration to v1.0
Quick Migration
// Pre-1.0
let provider = new?;
let client = new;
let result = client.invoke_function.await?;
let balance = parse_balance?; // Manual parsing
// v1.0
let neo = testnet.await?;
let balance = neo.get_balance.await?; // Automatic parsing
Breaking Changes
- Error Types: All errors now use
NeoErrorwith recovery suggestions - Module Structure: Some modules reorganized for better discoverability
- Async Patterns: Standardized async/await usage across all APIs
See the full migration guide for detailed instructions.
Performance Metrics
| Operation | Pre-1.0 | v1.0.x | Improvement |
|---|---|---|---|
| WebSocket Events | N/A | <100ms | New |
| HD Account Derivation | N/A | <10ms | New |
| Transaction Simulation | N/A | <200ms | New |
| Balance Query | 300-500ms | 200-300ms | 40% faster |
| Token Transfer | 15-20 lines | 5-7 lines | 65% less code |
| Error Recovery | Manual | Automatic suggestions | Enhanced |
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure:
- All tests pass (
cargo test --workspace) - Code is formatted (
cargo fmt) - No clippy warnings (
cargo clippy -- -D warnings) - Documentation is updated
- CI checks pass locally before pushing
Security
For security issues, please email security@r3e.network instead of using the issue tracker.
Acknowledgments
- Neo Foundation for the Neo N3 blockchain
- Rust community for excellent tooling
- All contributors who have helped shape this project