Skip to content

Anomic-Cash/.github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Anomic Protocol πŸ›‘οΈ

Decentralized ZK-SNARK Privacy Mixer β€” Anonymous transactions on Ethereum & L2 networks

License: MIT TypeScript Solidity Circom


About

Anomic Protocol is a Tornado Cash-inspired decentralized privacy mixer using ZK-SNARK (Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge) to enable anonymous ETH, ERC20, and native token transactions across Ethereum and Layer 2 networks.

Key Features

  • πŸ” Zero-Knowledge Proofs β€” Groth16 + BN128 curve
  • 🌐 Multi-chain β€” Ethereum, Linea, Base, Arbitrum, Optimism, Polygon, BSC
  • ⚑ Client-side Proving β€” ZK proofs generated in browser via snarkjs
  • πŸ”’ Mathematical Privacy β€” No link between deposit & withdrawal addresses
  • πŸ›οΈ DAO Governance β€” ANC token with voting, staking, and anonymity mining
  • πŸ”„ Relayer Support β€” Privacy-preserving withdrawals without connecting wallet

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              ANOMIC PROTOCOL                                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   User      β”‚    β”‚   Frontend  β”‚    β”‚  Relayer    β”‚    β”‚  Blockchain β”‚ β”‚
β”‚  β”‚  (Wallet)   │───►│  (React)    │◄──►│ (Edge Func) │───►│  (EVM L2s)  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                            β”‚                   β”‚                   β”‚        β”‚
β”‚                            β–Ό                   β”‚                   β–Ό        β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚                    β”‚  ZK Prover  β”‚            β”‚           β”‚  Verifier   β”‚ β”‚
β”‚                    β”‚  (snarkjs)  β”‚            β”‚           β”‚ (Groth16)   β”‚ β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚           β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                 β”‚                  β”‚        β”‚
β”‚                                                 β”‚           β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”‚
β”‚                                                 β”‚           β”‚ AnomicMixer β”‚ β”‚
β”‚                                                 β”‚           β”‚ (MerkleTree)β”‚ β”‚
β”‚                                                 β”‚           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                 β”‚                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚                           Backend (Supabase)                           β”‚ β”‚
β”‚  β”‚  Edge Functions: deposit, withdraw, relayer, shielded-transfer        β”‚ β”‚
β”‚  β”‚  Database: pools, deposits, nullifiers, merkle_tree, governance       β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

ZK-SNARK Technology

How It Works

  1. Deposit: User generates secret + nullifier, computes commitment = Poseidon(nullifier, secret), sends ETH to mixer
  2. Merkle Tree: Commitment inserted into incremental Merkle tree (height=20)
  3. Withdraw: User creates ZK proof proving knowledge of secret/nullifier without revealing them
  4. Verification: On-chain Verifier checks proof, prevents double-spending via nullifier hash

Cryptographic Stack

Component Implementation
ZK Protocol Groth16
Curve BN128
Hash Function Poseidon (zk-friendly)
Merkle Tree Incremental, height=20
Public Inputs 6 (root, nullifierHash, recipient, relayer, fee, refund)
Proof Size 256 bytes

Files

  • contracts/Verifier.sol β€” Groth16 verifier (auto-generated by snarkJS)
  • contracts/AnomicMixer.sol β€” Main mixer with Merkle tree
  • src/lib/zkProver.ts β€” Client-side proof generation
  • src/lib/zkCrypto.ts β€” Poseidon, Merkle tree, note generation
  • public/circuits/ β€” WASM, zkey, verification key

Deployed Contracts (V2)

Verifiers

Network ChainId Verifier Address
Ethereum 1 0x9a5537156388306dbc66EB3357317c86802BE6b7
Linea 59144 0x2218163979Fb6FDC209781e1355EbB61675841A7
Base 8453 0x2218163979Fb6FDC209781e1355EbB61675841A7
Arbitrum 42161 0xc877340291Df1a2ef545C8B6508B851457C4D428
Optimism 10 0x69C7CB6b0cAE5ACF725aFDf5CB274106082EF6b4
Polygon 137 0xDEaD89EfAF73663a7F0398e0DfB3289EA6C5E9DD
BSC 56 0x798C4B97Ac52118eBa5A106c21637EbAa3a335c8
Sepolia 11155111 0x9CeF18fFC3f8B7415bb06c3403893E856C1E8f91

Tech Stack

Layer Technology
Frontend React 18, Vite, TypeScript, Tailwind CSS, shadcn/ui
Web3 ethers.js v6, WalletConnect v2, snarkjs, circomlibjs
Backend Supabase (Edge Functions, PostgreSQL, Realtime)
Smart Contracts Solidity 0.8.x, Hardhat, OpenZeppelin
ZK Circuits Circom 2.x, Groth16 (BN128)
BTC Support bitcoinjs-lib, CoinJoin protocol

Quick Start

Prerequisites

  • Node.js β‰₯ 18 (recommended 20+)
  • npm β‰₯ 9
  • Circom 2.x (for ZK circuits)

Installation

# Clone repository
git clone https://github.com/anomic-protocol/anomic-protocol.git
cd anomic-protocol

# Install dependencies
npm install

# Copy environment file
cp .env.example .env

# Start development server
npm run dev

Build for Production

npm run build
npm run preview

Development Commands

# Run tests
npm test

# Compile contracts
npx hardhat compile

# Deploy to testnet
npx hardhat run scripts/deployL2Pools.js --network sepolia

# Deploy to mainnet
npx hardhat run scripts/deployL2Pools.js --network linea
npx hardhat run scripts/deployL2Pools.js --network ethereum

# Sync contracts to frontend
npm run sync:zkprover

# Verify ZK alignment
npm run verify:zk-alignment

Project Structure

anomic-protocol/
β”œβ”€β”€ contracts/              # Solidity smart contracts
β”‚   β”œβ”€β”€ AnomicMixer.sol    # Main mixer with Merkle tree
β”‚   β”œβ”€β”€ Verifier.sol       # Groth16 verifier
β”‚   β”œβ”€β”€ AnomicCash.sol     # ANC token (ERC20)
β”‚   β”œβ”€β”€ AnomicGovernance.sol
β”‚   └── ...
β”œβ”€β”€ src/                   # Frontend (React + TypeScript)
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ zkProver.ts   # ZK proof generation
β”‚   β”‚   └── zkCrypto.ts   # Poseidon, Merkle tree
β”‚   β”œβ”€β”€ components/
β”‚   └── pages/
β”œβ”€β”€ public/
β”‚   └── circuits/          # ZK circuit artifacts
β”‚       β”œβ”€β”€ withdraw.zkey
β”‚       β”œβ”€β”€ withdraw.wasm
β”‚       └── verification_key.json
β”œβ”€β”€ scripts/               # Deployment scripts
β”œβ”€β”€ supabase/             # Edge functions & database
β”œβ”€β”€ docs/                 # Documentation
└── circuits/             # Circom ZK circuits

Documentation

Document Description
ZK Architecture Complete ZK-SNARK technical docs
Deployment Guide L2 networks deployment
Trusted Setup MPC ceremony guide
Security Checklist Production security
Comparison vs Tornado Cash Feature comparison

Security

  • βœ… ReentrancyGuard on all critical functions
  • βœ… Pausable by governance in emergencies
  • βœ… Merkle root history (30 roots circular buffer)
  • βœ… Nullifier double-spend protection
  • βœ… Fee caps and validation
  • βœ… OpenZeppelin contracts
  • βœ… Slither static analysis
  • ⚠️ Audits: Always audit before production use

Fee Structure

Withdrawals support dynamic fees based on delay (better privacy = lower fee):

Delay Fee
≀ 1 hour 3.0%
≀ 12 hours 2.5%
≀ 24 hours 2.0%
≀ 48 hours 1.75%
> 48 hours 1.5%

Fee distribution:

  • 50% β€” ANC Pool (buyback/treasury)
  • 25% β€” Relayer (if used)
  • 20% β€” Stakers (via StakingRewards)
  • 5% β€” DAO (governance)

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/xxx)
  3. Commit your changes (git commit -m 'Add xxx')
  4. Push to the branch (git push origin feature/xxx)
  5. Open a Pull Request

License

MIT License β€” see LICENSE for details.


Links


Built with πŸ”’ and Zero-Knowledge Proofs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors