Skip to main content

Privacy SDK for Solana with optional x402 payment support - Python interface with Rust cryptographic backbone

Project description

Nyx Privacy

The Dark Layer for the Agentic Web.

Nyx Privacy 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, Nyx Privacy 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.

Documentation License: MIT Python 3.12+ Rust

The Trinity (Core Features)

1. The Nyx Shield (Privacy Primitives)

Turn public capital into private state. Nyx Privacy 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. Nyx 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. Nyx 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."

Nyx Privacy 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 nyx-privacy

Basic Usage

from nyx import NyxClient
from solders.keypair import Keypair

# Initialize the Dark Layer
client = NyxClient(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/nyxprivacy/nyx-privacy.git
cd nyx-privacy

# 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 Nyx 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.

Nyx 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

Supported Networks (x402)

Nyx Privacy 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.


Nyx Privacy - The Dark Layer for the Agentic Web. Privacy for the Machine Economy.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nyx_privacy-0.1.0.tar.gz (213.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nyx_privacy-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl (329.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

nyx_privacy-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl (329.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

nyx_privacy-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl (329.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

nyx_privacy-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl (329.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

Details for the file nyx_privacy-0.1.0.tar.gz.

File metadata

  • Download URL: nyx_privacy-0.1.0.tar.gz
  • Upload date:
  • Size: 213.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for nyx_privacy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f3950d57430def480e9c040f01c6a7aca900b49af9eeea56c89bcea6d6fa27e9
MD5 743bb120ef86126bddf1838f36616c68
BLAKE2b-256 5f89b6142115948a5998ea999455d6646fdeda5a97eaab4a88a5442269f37703

See more details on using hashes here.

File details

Details for the file nyx_privacy-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for nyx_privacy-0.1.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 892426c2bba5e54ecba2d79f69c979a6f9ba4c5d296d2b9306bd8ecf669a6ceb
MD5 05981ed6ca665ba0729f2cf6ce3fe5b1
BLAKE2b-256 6832601abc6ef9f1909291c80b9a1eb8a75de9bd6664f43fb40d1d4627f28b30

See more details on using hashes here.

File details

Details for the file nyx_privacy-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for nyx_privacy-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a56c5816cf9fa8f6d80c3bb88a852c9b974a04bd8507a2c56f9eca0721f74ab4
MD5 bf2517d814006b64431b881adee8a429
BLAKE2b-256 0dca39f5d4ddaef6458e5374b38014bca3fca6a918fd44bd54d6b2eadebcdf08

See more details on using hashes here.

File details

Details for the file nyx_privacy-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for nyx_privacy-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6365ca453f692c4ab9affc8e6f7883fb611a30a5be57a4d70c82b1ec185d958a
MD5 a8b6a9c42c7466042c1481ce102bb3dc
BLAKE2b-256 7c75fad0617918e84261355d1c09d0526d9b82909752719b622bae0ab11b9a71

See more details on using hashes here.

File details

Details for the file nyx_privacy-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for nyx_privacy-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d1bedf6bfd829473ab4b7fdcfaee32a5c205dc1d1b7afbc7b4060ea9b191ffa0
MD5 76751ea875cdd541e4a3e5127c5bf1cd
BLAKE2b-256 b20556acb3f672f75d43993b3823a0c3eb78eb425de12a64f7286cffdb9c0886

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page