rootchain-rs
The primary Rust SDK for interacting with the RootChain network.
rootchain-rs provides a high-level async client for building Rust applications that communicate with RootChain nodes: wallets, bots, indexers, relayers, and tooling.
What's Inside
| Module | Description |
|---|---|
client |
JSON-RPC async client for communicating with a RootChain node (getBalance, sendTransaction, getBlock, etc.) |
wallet |
Wallet type for key management, BIP-39 mnemonic support, AES-256-GCM encrypted storage, and transaction signing |
contract |
Typed Contract wrapper for encoding/decoding ABI calls to RootChain WASM contracts |
error |
Unified SdkError type covering RPC, signing, and serialization errors |
Installation
[]
= "1.0.1"
= { = "1", = ["full"] }
Usage
Connecting to a Node
use RootchainClient;
async
Wallet Management
use Wallet;
// Create a new wallet from a BIP-39 mnemonic
let wallet = from_mnemonic?;
let address = wallet.address;
// Sign and send a transfer
let client = new;
let tx_hash = wallet.send_transfer.await?;
Contract Interaction
use Contract;
let contract = at;
// Encode a method call (method ID + bincode payload)
let payload = contract.encode_call?;
// Submit via wallet
let tx_hash = wallet.call_contract.await?;
High-Precision Balances
All balance fields use u128 internally to support the full 18-decimal precision of ROOT tokens (1 ROOT = 1,000,000 µROOT). Balances are safely serialized as decimal strings over JSON.
let balance: u128 = 1_000_000_000_000u128; // 1,000,000 ROOT
License
MIT — See LICENSE for details.