Lichen Rust SDK
Official Rust SDK for building on Lichen blockchain.
Features
- ✅ Production-Ready - Type-safe, async RPC client
- ✅ PQ Keypairs - Native ML-DSA-65 addresses and signatures
- ✅ Self-Contained Signatures - Matches the core
PqSignaturewire model - ✅ Transaction Building - Easy transaction creation and signing
- ✅ Developer-Friendly - Comprehensive examples and docs
Installation
Add to your Cargo.toml:
[]
= "0.1.5"
= { = "1.35", = ["full"] }
Quick Start
use ;
async
Examples
Run examples with:
API Reference
Client
// Create client
let client = new;
// Or with custom configuration
let client = builder
.rpc_url
.timeout
.build?;
// Query methods
client.get_slot.await?;
client.get_balance.await?;
client.get_block.await?;
client.get_latest_block.await?;
client.get_network_info.await?;
client.get_validators.await?;
Keypair Management
// Generate new keypair
let keypair = new;
// From seed
let seed = ; // Use secure random seed
let keypair = from_seed;
// Get public key
let pubkey = keypair.pubkey;
println!;
// Get the full PQ verifying key
let public_key = keypair.public_key;
println!;
// Sign message
let message = b"Hello Lichen";
let signature = keypair.sign;
assert!;
Transaction Building
use ;
// Build transaction
let tx = new
.add_instruction
.recent_blockhash
.build_and_sign?;
// Serialize and send
let tx_bytes = serialize?;
let tx_base64 = encode;
client.send_raw_transaction.await?;
File Format
Keypairs are saved in JSON format:
Testing
# Run tests
# Run with validator
License
MIT OR Apache-2.0
Contributing
See CONTRIBUTING.md for guidelines.