Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
NeoRust
NeoRust is a comprehensive Rust SDK for interacting with the Neo N3 blockchain. It provides a complete set of tools and utilities for building applications on the Neo ecosystem, including wallet management, transaction creation, smart contract interaction, and more.
Features
- Complete Neo N3 Support: Full compatibility with the Neo N3 blockchain protocol
- Wallet Management: Create, manage, and secure Neo wallets with support for NEP-6 standard
- Transaction Building: Construct and sign various transaction types
- Smart Contract Interaction: Deploy and interact with smart contracts
- RPC Client: Connect to Neo nodes via JSON-RPC
- NEP-17 Token Support: Interact with NEP-17 compatible tokens
- Neo Name Service (NNS): Resolve and manage domain names on the Neo blockchain
- Cryptographic Operations: Secure key management and cryptographic functions
- Modular Architecture: Well-organized codebase with clear separation of concerns
- Famous Neo N3 Contracts: Direct support for popular Neo N3 contracts like Flamingo Finance, NeoburgerNeo, GrandShare, and NeoCompound
- Neo X Support: EVM compatibility layer and bridge functionality for Neo X, an EVM-compatible chain maintained by Neo
Installation
Add neo3 to your Cargo.toml:
[]
= "0.1.0"
Note: The crate is published as neo3 but is imported as neo in code:
use *;
You can also specify features if needed:
[]
= { = "0.1.1", = ["ledger", "aws", "futures"] }
For the latest development version, you can use the Git repository:
[]
= { = "https://github.com/R3E-Network/NeoRust.git" }
Documentation
Comprehensive documentation is available at:
- API Reference: https://docs.rs/neo3
- Online Documentation: https://r3e-network.github.io/NeoRust/
- PDF Documentation: https://r3e-network.github.io/NeoRust/pdf/neorust-sdk-documentation.pdf
- Crate Page: https://crates.io/crates/neo3
Quick Start
use *;
async
Usage Examples
Connecting to Neo Nodes
use ;
async
Wallet Management
use ;
async
Creating and Sending Transactions
use ;
async
Interacting with Smart Contracts
use ;
async
Working with NEP-17 Tokens
use ;
async
Using Neo Name Service (NNS)
use ;
async
Working with Famous Neo N3 Contracts
use ;
use FromStr;
async
Using Neo X EVM Compatibility and Bridge
use ;
use H160;
use FromStr;
async
Configuration
NeoRust provides configuration options for different network environments and blockchain parameters:
use ;
Available Features
NeoRust provides several optional features that can be enabled in your Cargo.toml:
- ledger: Support for hardware wallets via Ledger devices
- aws: AWS KMS integration for key management
- futures: Support for asynchronous Futures
- sgx: Intel SGX support for secure enclaves (requires additional setup)
Example of enabling multiple features:
[]
= { = "0.1.0", = ["ledger", "aws", "futures"] }
Feature Flag System
NeoRust uses a comprehensive feature flag system to allow you to include only the functionality you need. This helps reduce compile times, decrease binary sizes, and simplify dependency management.
Core Feature Groups
The following core feature groups are available:
- std: Standard library support with basic serialization (default)
- transaction: Transaction creation and signing capabilities
- wallet: Wallet and account management
- contract: Smart contract interaction
- http-client: HTTP-based RPC client for Neo N3 nodes
- ws-client: WebSocket client for real-time updates
Token Standards
Support for Neo N3 token standards:
- nep17: NEP-17 fungible token standard support
- nep11: NEP-11 non-fungible token standard support
Integration Features
Features for integrating with external systems:
- sgx: Intel SGX secure enclave integration
- wasm: WebAssembly support for browser environments
- ledger: Ledger hardware wallet support
- aws: Amazon Web Services KMS integration
- ethereum-compat: Ethereum compatibility for Neo X integration
Cryptography Levels
Choose your required level of cryptographic functionality:
- crypto-standard: Basic cryptographic functions (default)
- crypto-advanced: Advanced cryptography with additional algorithms
Wallet Features
Enhanced wallet capabilities:
- wallet-standard: Standard wallet with file I/O support (default with wallet)
- wallet-hardware: Hardware wallet support
- wallet-secure: Advanced security features for wallets
Serialization Support
Data format support:
- serde: Serialization/deserialization support
- json: JSON format support
- binary-format: Binary format utilities
Example Usage
In your Cargo.toml, specify exactly what features you need:
# Basic wallet application
= { = "0.1.2", = ["wallet", "crypto-standard"] }
# Full-featured dApp backend
= { = "0.1.2", = ["wallet", "transaction", "contract", "http-client", "nep17"] }
# Minimal transaction builder
= { = "0.1.2", = false, = ["transaction"] }
# WebAssembly application
= { = "0.1.2", = ["wallet", "http-client", "wasm"] }
# Secure application with hardware wallet support
= { = "0.1.2", = ["wallet-hardware", "wallet-secure"] }
Common Feature Combinations
Here are some recommended feature combinations for common use cases:
| Use Case | Recommended Features |
|---|---|
| Simple Wallet Tool | wallet, crypto-standard |
| Block Explorer | http-client |
| Token Transfer dApp | wallet, transaction, http-client, nep17 |
| NFT Marketplace | wallet, transaction, http-client, nep11 |
| Smart Contract Development | wallet, transaction, contract, http-client |
| Web dApp (WASM) | wallet, transaction, http-client, wasm |
| Hardware Wallet Integration | wallet-hardware, transaction |
| Secure Enterprise Application | wallet-secure, crypto-advanced, sgx |
Performance Benefits
By selecting only the features you need, you can significantly reduce compile times and binary sizes:
| Feature Combination | Approximate Compile Time | Approximate Binary Size |
|---|---|---|
| All features | 2m 15s | 8.2 MB |
| Default features | 1m 45s | 6.5 MB |
| Minimal wallet | 38s | 1.1 MB |
| HTTP client only | 42s | 1.5 MB |
The specific improvements will vary based on your hardware and build configuration.
Examples
For practical demonstrations of feature flags, see the examples in the examples/feature_flags directory:
- Minimal Wallet Example - Using only wallet and crypto-standard features
- NEP-17 Token Example - Working with NEP-17 tokens
Migration Guide
If you're upgrading from a previous version, please see our Feature Flag Migration Guide for details on how to transition to the new feature flag system.
Build and Test Scripts
NeoRust includes convenient scripts for building and testing with different feature configurations:
Unix/Linux/MacOS:
# Build with default configuration
# Build with specific features
# Run tests with default features (ledger,aws,futures)
# Run tests and show output
Windows:
# Build with default configuration
.\scripts\build.bat
# Build with specific features
.\scripts\build.bat --features ledger,aws,futures
# Run tests with default features (ledger,aws,futures)
.\scripts\test.bat
For more details on available script options, see the scripts README.
Project Structure
NeoRust is organized into several modules:
- neo_builder: Transaction and script building utilities
- neo_clients: Neo node interaction clients (RPC and WebSocket)
- neo_codec: Encoding/decoding for Neo-specific data structures
- neo_config: Network and client configuration
- neo_contract: Smart contract interaction
- neo_crypto: Neo-specific cryptographic operations
- neo_protocol: Neo network protocol implementation
- neo_types: Core Neo ecosystem data types
- neo_wallets: Neo asset and account management
Contributing
Contributions are welcome! Here's how you can contribute to the NeoRust SDK:
-
Report Issues: If you find a bug or have a feature request, please create an issue on the GitHub repository.
-
Submit Pull Requests: If you'd like to contribute code:
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature-name) - Make your changes
- Run the tests (
./scripts/test.sh) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature-name) - Open a Pull Request
-
Coding Standards: Please follow the Rust coding standards and include appropriate tests for your changes.
-
Documentation: Update the documentation to reflect your changes if necessary.
Package Status
NeoRust is now available on crates.io as the neo3 crate. The latest version is 0.1.2.
This means you can now easily add it to your Rust projects without having to reference the GitHub repository directly.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Acknowledgments
Supported by R3E Network and GrantShares. Additional support is welcome.
The NeoRust team would like to thank everyone who contributed to reaching the milestone of publishing the neo3 crate to crates.io.