Onyx SDK
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.
Features
- Stealth Addresses - Generate unique one-time addresses for each payment
- Unlinkable Payments - Observers cannot connect payments to your public identity
- Efficient Scanning - On-chain registry for payment detection
- Ed25519 Compatible - Works with Solana's native key format
- Anchor Program - Ready-to-deploy on-chain announcement registry
Installation
Add to your Cargo.toml:
[]
= { = "https://github.com/OnyxSDK/onyx" }
Quick Start
Receiver: Generate a Stealth Meta-Address
use *;
// Generate new stealth meta-address
let meta = generate;
// Share this publicly to receive payments
let public_meta = meta.to_public;
println!;
// Save privately (contains spending key!)
meta.save_to_file?;
Sender: Create a Stealth Payment
use *;
// Parse receiver's public meta-address
let public_meta = decode?;
// Create stealth payment
let payment = create?;
println!;
println!;
// Transfer SOL to payment.stealth_address
// Publish payment.ephemeral_pubkey to the registry
Receiver: Detect and Spend
use *;
// Load your meta-address
let meta = load_from_file?;
// Check if a payment is for you
if let Some = meta.try_detect?
How It Works
- Receiver generates a stealth meta-address (spending + viewing keypairs) and shares the public portion
- Sender uses the meta-address to derive a unique stealth address and ephemeral keypair
- Sender transfers SOL to the stealth address and publishes the ephemeral public key
- Receiver scans ephemeral keys, detects payments meant for them, and derives the spending key
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.
Project Structure
onyx-sdk/
├── crates/
│ ├── core/ # Main SDK library (onyx-sdk)
│ └── program/ # Anchor program (onyx-program)
└── cli/ # Command-line interface (onyx)
CLI Usage
# Install
# Generate new stealth meta-address
# Show your public meta-address
# Send SOL to a stealth address
# Check balance
Anchor Program
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 transfer
Security
- Private keys are never transmitted or stored on-chain
- Viewing keys allow detection without spending capability
- Spending keys are derived deterministically from the shared secret
- Uses SHA-256 for key derivation with domain separation
License
MIT OR Apache-2.0