Zero-Knowledge Proof System
This document provides an in-depth technical explanation of StyxPay's zero-knowledge proof implementation for transaction privacy and settlement.
Table of Contents
Overview
StyxPay employs zero-knowledge proofs (specifically ZK-SNARKs) to enable private, verifiable transactions on Solana while maintaining regulatory compliance and auditability.
Key Properties
Privacy: Transaction amounts and parties remain confidential
Verifiability: Proofs can be verified without revealing underlying data
Succinctness: Proofs are small (~200 bytes) and fast to verify (~5ms)
Non-interactivity: No back-and-forth communication required
ZK-SNARK Stack
ZK-SNARK Implementation
Proving System: Groth16
We use Groth16 for its optimal proof size and verification time.
Characteristics:
Proof Size: 128 bytes (2 G₁ points + 1 G₂ point)
Verification Time: ~2-5ms
Proving Time: ~50-200ms (depends on circuit size)
Setup: Requires trusted setup ceremony
Trade-offs:
✅ Smallest proof size
✅ Fastest verification
❌ Circuit-specific trusted setup
❌ Not updatable
Elliptic Curve: BN254
BN254 (also known as BN128) provides 128-bit security level.
Parameters:
Point Representations:
Transaction Settlement Flow
Phase 1: Transaction Initiation
Data Structure:
Phase 2: Authorization Check
Backend validates against user's authorization policy:
Phase 3: ZK Proof Generation
Generate proof that transaction is valid without revealing details.
Public Inputs:
Private Inputs (witness):
Proof Generation Code:
Phase 4: On-Chain Verification
Submit proof to Solana program for verification.
Solana Program Instruction:
Phase 5: Settlement Execution
Cryptographic Primitives
1. Pedersen Commitments
Used to commit to transaction amounts.
Definition:
Where:
GandHare elliptic curve pointsamountis the secret valueblinding_factoris random field element
Implementation:
Properties:
✅ Hiding: Cannot deduce
amountfromC✅ Binding: Cannot find different
amount'that produces sameC✅ Homomorphic:
C₁ + C₂ = (a₁ + a₂)·G + (r₁ + r₂)·H
2. Poseidon Hash Function
ZK-friendly hash function optimized for proving.
Specification:
Implementation:
Advantages:
10x fewer constraints than SHA-256 in circuits
~50 constraints per Poseidon hash
Constant-time execution
3. Nullifiers
Prevent double-spending without revealing transaction ID.
Generation:
Properties:
Each transaction produces unique nullifier
Cannot link nullifier to transaction without secret
Can verify nullifier hasn't been used before
4. Merkle Trees
Prove account existence without revealing entire state.
Tree Structure:
Implementation:
Circuit Design
R1CS (Rank-1 Constraint System)
All computations in ZK-SNARKs are expressed as quadratic constraints:
Where A, B, C are linear combinations of variables.
Transaction Circuit
Circuit Constraints:
Balance Check:
Commitment Consistency:
Merkle Proof Verification:
Nullifier Uniqueness:
Range Proofs:
Complete Circuit
Circuit Complexity
Constraint Count:
Balance check: 2 constraints
Commitment: 150 constraints (elliptic curve ops)
Merkle proof (depth 20): 1,000 constraints (50 × 20)
Nullifier: 50 constraints
Range proof: 64 constraints
Total: ~1,266 constraints
Performance:
Proving time: ~50ms
Verification time: ~2ms
Proof size: 128 bytes
Public input size: 128 bytes
Proof Generation
Setup Phase (One-Time)
Proving Phase
Proof Serialization
Verification Process
Off-Chain Verification
On-Chain Verification (Solana)
Optimized Pairing Check
Privacy Guarantees
Information Leaked
Public Information:
Nullifier (unlinkable to transaction)
Commitment (hiding transaction amount)
Merkle root (reveals total number of accounts, not balances)
Policy hash (reveals which policy, not its contents)
Private Information (never revealed):
Transaction amount
Sender identity
Receiver identity
Account balances
Merkle path (account position in tree)
Security Assumptions
Discrete Logarithm Problem: Cannot solve
xing^x = hDecisional Diffie-Hellman: Cannot distinguish
(g^a, g^b, g^ab)from(g^a, g^b, g^c)Trusted Setup Security: Toxic waste properly destroyed
Collision Resistance: Poseidon hash is collision-resistant
Attack Resistance
Replay Attacks:
Prevented by nullifier tracking
Each nullifier can only be used once
Stored in Solana account state
Double Spending:
Prevented by nullifier uniqueness
Cannot create two transactions with same secret
Merkle root prevents unauthorized balance modifications
Linkability Attacks:
Transactions cannot be linked to same user
Nullifiers are pseudorandom
Commitments hide amounts
Timing Attacks:
Constant-time arithmetic operations
No branching based on secret data
Side-channel resistant implementation
Performance Benchmarks
Proof Generation
Proof Verification
On-Chain Storage
Scalability
Future Improvements
1. Plonk/Halo2 Migration
Benefits:
Universal trusted setup
Updatable circuits
Better recursion support
Trade-offs:
Larger proof size (~400 bytes)
Slower verification (~5-10ms)
2. Recursive Proofs
Prove multiple transactions in one proof:
Benefits:
Constant verification time
Batch settlement
Lower gas costs
3. Bulletproofs for Range Proofs
Replace range proof constraints with Bulletproofs:
Benefits:
No trusted setup
Logarithmic proof size
Better for large ranges
4. zkEVM Integration
Run StyxPay logic in zkEVM:
Benefits:
Smart contract programmability
Easier auditability
Ethereum compatibility
Related Documentation
Last Updated: January 2026 Version: 1.0.0 Authors: StyxPay Security Team
Last updated