This document outlines the security architecture, threat model, and areas of focus for security auditors reviewing zRonin.
zRonin is a privacy-preserving smart contract system for QRL Zond, using:
- STARK proofs for zero-knowledge privacy
- Dilithium5 signatures for post-quantum authentication
- Poseidon hash for efficient in-circuit hashing
- Merkle trees for commitment tracking
TokenVault (Main Entry Point)
├── StarkVerifier (Proof Verification)
├── MerkleAccumulator (Commitment Tracking)
├── RelayAdapt (Relay Integration)
└── ZronToken (Governance Token)
-
Shield (Deposit):
- User deposits tokens to TokenVault
- TokenVault creates commitment (hash of note)
- MerkleAccumulator inserts commitment
- User receives encrypted note
-
Transfer (Private):
- User creates STARK proof of note ownership
- Proof includes nullifiers (to prevent double-spend)
- New commitments added for outputs
- Old nullifiers marked as spent
-
Unshield (Withdraw):
- User creates STARK proof with withdrawal request
- TokenVault verifies proof
- Tokens released to recipient
- Field: Goldilocks prime (2^64 - 2^32 + 1)
- Hash: SHA3-256 for Merkle trees, Poseidon for circuits
- FRI: Folding factor 2, 128-bit security target
- Fiat-Shamir: Transcript-based challenge derivation
- Public Key: 2592 bytes
- Secret Key: 4864 bytes
- Signature: 4595 bytes
- Security: NIST Level 5 (256-bit classical, 128-bit quantum)
- Parameters: t=3, rounds based on security level
- Field: SNARK-friendly prime
- Security: 128-bit collision resistance
-
Double-Spending
- Threat: Spending same note twice
- Mitigation: Nullifier tracking on-chain
-
Privacy Leakage
- Threat: Transaction linkability
- Mitigation: STARK zero-knowledge proofs
-
Proof Forgery
- Threat: Creating valid proofs without valid inputs
- Mitigation: Soundness of STARK system
-
Front-Running
- Threat: MEV extraction from privacy transactions
- Mitigation: RelayAdapt integration
-
Key Extraction
- Threat: Recovering spending keys from public data
- Mitigation: Dilithium5 post-quantum security
- Physical side-channel attacks
- Social engineering
- Zond network consensus attacks
- Key management by end users
| File | Priority | Focus Areas |
|---|---|---|
| TokenVault.hyp | Critical | Deposit/withdrawal logic, proof verification calls |
| StarkVerifier.hyp | Critical | Proof validation logic |
| MerkleAccumulator.hyp | High | Tree insertion, root computation |
| RelayAdapt.hyp | High | Relay integration, swap logic |
| ZronToken.hyp | Medium | Token economics, vesting |
| Module | Priority | Focus Areas |
|---|---|---|
| src/crypto/stark/ | Critical | Proof generation, FRI protocol |
| src/crypto/dilithium/ | Critical | Key generation, signing |
| src/engine/ | High | Transaction building, note encryption |
- Nullifier Uniqueness: Can two different notes produce the same nullifier?
- Commitment Binding: Is the commitment scheme binding?
- Proof Soundness: What is the concrete soundness error of the STARK system?
- Merkle Security: Are Merkle proofs validated correctly?
- Gas Griefing: Can users cause excessive gas consumption?
- Reentrancy: Are there reentrancy vulnerabilities in deposit/withdraw?
- Integer Overflow: Are arithmetic operations safe?
- Dilithium: 23 tests (key gen, sign/verify, address derivation)
- STARK: 24 tests (field arithmetic, FRI, prover/verifier)
- Merkle: 26 tests (tree operations, proofs)
- Poseidon: 17+ tests (hash operations)
- Notes: 27 tests (encryption, selection)
- Circuits: 23 tests (AIR constraints)
- Contract deployment verification
- Token operations
- Shield/unshield flow simulation
| Operation | Gas Cost |
|---|---|
| ZRC20 Transfer | ~52,000 |
| ZRC20 Approve | ~46,000 |
| Deploy TokenVault | ~1,486,000 |
| Deploy MerkleAccumulator | ~3,485,000 |
| Deploy StarkVerifier | ~957,000 |
- Proof Size: STARK proofs are larger than SNARKs (~100KB vs ~200B)
- Verification Cost: On-chain verification is more expensive
- Testnet: Not yet deployed to testnet
- Focus on cryptographic correctness - particularly FRI and Fiat-Shamir
- Review nullifier derivation - critical for double-spend prevention
- Analyze gas consumption - look for DoS vectors
- Check access controls - admin functions, pause mechanisms
- Verify Poseidon parameters - round numbers, constants
For security-related inquiries during the audit, contact the zRonin team through secure channels.
Document Version: 1.0 Last Updated: 2025-12-14