| Crates.io | onyx-sdk |
| lib.rs | onyx-sdk |
| version | 0.1.1 |
| created_at | 2025-12-22 02:29:35.419618+00 |
| updated_at | 2025-12-22 02:35:04.724184+00 |
| description | Onyx SDK - Privacy-preserving stealth addresses for Solana |
| homepage | |
| repository | https://github.com/OnyxSDK/onyx |
| max_upload_size | |
| id | 1998928 |
| size | 177,388 |
Privacy-preserving stealth addresses for Solana.
Onyx SDK enables private payments on Solana using stealth addresses. Senders can transfer SOL to unique one-time addresses that only the intended recipient can detect and spend from, without revealing the recipient's identity on-chain.
Add to your Cargo.toml:
[dependencies]
onyx-sdk = "0.1"
Or install via cargo:
cargo add onyx-sdk
use onyx_sdk::prelude::*;
// Generate new stealth meta-address
let meta = StealthMetaAddress::generate();
// Share this publicly to receive payments
let public_meta = meta.to_public();
println!("My stealth address: {}", public_meta.encode());
// Save privately (contains spending key!)
meta.save_to_file("~/.onyx/keys.json")?;
use onyx_sdk::prelude::*;
// Parse receiver's public meta-address
let public_meta = PublicMetaAddress::decode("st:sol:...")?;
// Create stealth payment
let payment = StealthPayment::create(&public_meta)?;
println!("Send SOL to: {}", payment.stealth_address);
println!("Ephemeral key: {}", hex::encode(&payment.ephemeral_pubkey));
// Transfer SOL to payment.stealth_address
// Publish payment.ephemeral_pubkey to the registry
use onyx_sdk::prelude::*;
// Load your meta-address
let meta = StealthMetaAddress::load_from_file("~/.onyx/keys.json")?;
// Check if a payment is for you
if let Some(_) = meta.try_detect(&ephemeral_pubkey)? {
// Derive the keypair to spend
let keypair = StealthKeypair::derive(&meta, &ephemeral_pubkey)?;
// Use keypair.to_solana_keypair() to sign transactions
println!("Can spend from: {}", keypair.address());
}
The cryptographic scheme uses ECDH (Elliptic Curve Diffie-Hellman) to create shared secrets that allow the receiver to derive the same stealth address and spending key that the sender generated.
onyx-sdk/
├── crates/
│ ├── core/ # Main SDK library (onyx-sdk)
│ └── program/ # Anchor program (onyx-program)
└── cli/ # Command-line interface (onyx)
# Install
cargo install --path cli
# Generate new stealth meta-address
onyx init
# Show your public meta-address
onyx address
# Send SOL to a stealth address
onyx send <recipient-meta-address> <amount>
# Check balance
onyx balance <address>
The onyx-program provides an on-chain registry for stealth payment announcements:
initialize - Create the announcement registry (PDA)send_stealth - Transfer SOL + register announcement in one transactionannounce - Register an announcement without transferMIT OR Apache-2.0