Privacy SDK for Solana with optional x402 payment support - Python interface with Rust cryptographic backbone
Project description
Onyx
The Dark Layer for the Agentic Web.
Onyx is the production-ready privacy infrastructure for Solana, engineered specifically for Python developers and AI agents. By combining a high-level Python SDK with a high-performance Rust cryptographic core, Onyx solves the "transparency paradox" by enabling fully shielded transactions, private transfers, and chain-agnostic micropayments (x402) without sacrificing the speed required for modern DeFi or the usability required for autonomous agents.
The Onyx Trinity (Core Features)
1. The Onyx Shield (Privacy Primitives)
Turn public capital into private state. Onyx uses Pedersen Commitments on the BN254 curve to perfectly hide transaction amounts.
- Information-Theoretic Privacy: Amount data is mathematically impossible to extract without the blinding factor.
- Circuit-Safe Nullifiers: Two-step Poseidon hashing prevents double-spending while keeping your master secret isolated from the circuit.
- Front-Running Protection: A 30-root history buffer ensures your proofs remain valid even during network congestion.
2. Onyx Transfer (ZK-Transactions)
Move value without leaving a trace.
- Groth16 zkSNARKs: Generate proofs in seconds (2-5s) that certify transaction validity without revealing sender, recipient, or amount.
- Encrypted Notes: Uses ECDH and ChaCha20-Poly1305 to allow recipients to discover and decrypt their incoming funds securely.
- Unlinkability: The transaction graph is severed. Observers see a commitment enter and a different one leave, with no link between them.
3. Onyx Pay (x402 Integration)
Chain-agnostic payments for a multi-chain world.
- Gas Abstraction: Pay for privacy services on Solana using USDC on Base, Polygon, Avalanche, or 12+ other networks.
- Agent-Native: Based on the HTTP 402 standard, allowing AI agents to autonomously negotiate and pay for resources.
- Seamless Access: No accounts required. Cryptographically authorized per-request.
Developer Experience (The Stack)
"Python Simplicity. Rust Velocity."
Onyx utilizes a hybrid architecture to balance developer experience with raw performance.
| Layer | Technology | Function |
|---|---|---|
| Interface | Python 3.12+ | Async/await SDK for easy integration with AI agents and trading bots. |
| Engine | Rust Core | Native binaries handling heavy cryptography (Poseidon hashing, Proof generation). |
| Verifier | Anchor (Solana) | On-chain program handling state, Merkle trees, and nullifier tracking. |
Quick Start
Installation
pip install onyx-solana
Basic Usage
from onyx import OnyxClient
from solders.keypair import Keypair
# Initialize the Dark Layer
client = OnyxClient(rpc_url="https://api.mainnet-beta.solana.com")
user_keypair = Keypair()
# Shield assets (Public -> Private)
# Returns a commitment signature
secret, commitment = client.shield_assets(
amount=1_000_000_000, # 1 SOL
token="SOL",
keypair=user_keypair
)
# Transfer privately (Private -> Private)
# Proof generation takes <5s via Rust core
tx = await client.private_transfer_async(
recipient=recipient_address,
amount=500_000_000, # 0.5 SOL
sender_secret=secret,
sender_commitment=commitment
)
# Unshield assets (Private -> Public)
tx = client.unshield_assets(
commitment=commitment,
secret=secret,
recipient=user_keypair.pubkey()
)
Development
Prerequisites
- Python 3.12+
- Rust 1.70+
- Solana CLI tools
- Anchor Framework (for Solana program)
Building from Source
# Clone the repository
git clone https://github.com/onyxsolana/onyx-sdk.git
cd onyx-sdk
# Install all packages in development mode
make install-dev
# Run tests
make test
# Build all packages
make build
Roadmap (The Path Forward)
- Phase 1: Foundation (Current)
- Python SDK & Rust Core released.
- Groth16 Circuits (~7,000 constraints) live on Devnet.
- x402 Payment integration active on 15+ chains.
- Phase 2: The Network (v0.2.0)
- Public Onyx Relayer Network launch.
- Self-hosting infrastructure for relayers.
- Phase 3: Decentralization
- Trusted Setup Ceremony (MPC) for production parameters.
- Mainnet Launch.
- Phase 4: Expansion (2026)
- Full Gas Abstraction (Pay all Solana fees with USDC).
- Multi-asset support beyond SOL.
Onyx Security Architecture
- Curve: BN254 (alt_bn128).
- Hash: Poseidon (t=3, RF=8, RP=57).
- Proof System: Groth16 (256-byte proofs).
- Encryption: ChaCha20-Poly1305 + ECDH.
- Tree Depth: 20 levels (~1M leaves).
- Audit Status: MPC Ceremony Pending.
Documentation
- Getting Started: onyxprotocol.tech/docs/getting-started/overview
- API Reference: onyxprotocol.tech/docs/api
- Architecture: docs/ARCHITECTURE.md
Supported Networks (x402)
Onyx x402 integration supports payments on 15+ blockchains:
Mainnets: Base, Polygon, Avalanche, Solana, IoTeX, Peaq, Sei, XLayer Testnets: Base Sepolia, Polygon Amoy, Avalanche Fuji, Solana Devnet, and more
See x402 networks documentation for full list.
License
MIT License - see LICENSE for details
Contributing
Contributions welcome! Please see our contributing guidelines.
Onyx - The Dark Layer for the Agentic Web. Privacy for the Machine Economy.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onyx_solana-0.1.0.tar.gz.
File metadata
- Download URL: onyx_solana-0.1.0.tar.gz
- Upload date:
- Size: 224.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f11a263ea4bb4f6a115e92d8e213a089b94a71c1fc0bf4eec2400cf4c09b6186
|
|
| MD5 |
0f513b8b6134de6cfbc394ebf01c42c7
|
|
| BLAKE2b-256 |
7d7237ebd05fa6b15453740d265206f00f622b694763ce4bc08600c25a5dbb80
|
File details
Details for the file onyx_solana-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: onyx_solana-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 329.6 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f66aea5d61141516365117f0ead00d02648d198434c9cb0541b43d04a1e5687
|
|
| MD5 |
8b3888ed09ba90c795cb0d1772591b6d
|
|
| BLAKE2b-256 |
7f76441a6ad1854d6e0e2d674952e5a62a9d0a5444cd089427b876d972a1b7f0
|
File details
Details for the file onyx_solana-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: onyx_solana-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 329.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
494701eed40bf3157935ad9c0c0eb45c712f4ceb36fcc7e88c8214c4eb7a7543
|
|
| MD5 |
46c7e054b957ce5b7b1119a82796848e
|
|
| BLAKE2b-256 |
618eff76ec7dc03fa471c9a958beb89e6617845c016075f413e662146c70ecda
|
File details
Details for the file onyx_solana-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: onyx_solana-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 329.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b665f0d6bb7fd10656ceb3a0024f4bcb43230564e7f1c3d2fc577ab9b28942b2
|
|
| MD5 |
d163b4053b720bba5d6216c2e8ee0645
|
|
| BLAKE2b-256 |
831abe30d35fc0f52792799c0d0672b2be7d3bde3a26225deea363d1dce7b9b6
|