esp-solana
no_std Solana SDK for ESP32. Wallets, signing, transactions, and RPC — in ~163KB of flash.
Usage
[]
= { = "https://github.com/SkyRizzAI/esp-solana", = ["wallet"] }
Requires alloc. On ESP32, set up a heap with esp-alloc:
heap_allocator!;
Wallet
use Wallet;
let entropy: = get_from_hw_rng;
let wallet = generate_12.unwrap;
let mnemonic = wallet.mnemonic;
let keypair = wallet.keypair.unwrap;
let address = wallet.default_pubkey.unwrap;
// restore later
let restored = from_mnemonic.unwrap;
Keys and seeds are zeroized from memory on drop.
Transactions
use *;
use system_transfer;
use Message;
use Transaction;
let ix = system_transfer;
let msg = compile.unwrap;
let tx = new.unwrap;
let b64 = tx.to_base64; // ready for sendTransaction
RPC
The SDK doesn't include an HTTP client — you bring your own by implementing RpcClient:
use ;
;
let rpc = new;
let blockhash = rpc.get_latest_blockhash?;
let balance = rpc.get_balance?;
let sig = rpc.send_transaction?;
Also supports request_airdrop, get_signature_status, get_transaction, get_account_info.
Examples
# host-side transaction demo
# real devnet transfer (creates wallets, sends SOL, verifies)
For ESP32-C3 hardware, see examples/esp32c3_demo/.
ESP32-C3 flash usage
| Config | Flash |
|---|---|
| crypto only (signing + tx + rpc) | 148 KB |
| full SDK with wallet | 163 KB |
Out of 4MB. Use lto = 'fat' and opt-level = 's' in your release profile.
License
MIT