Zero-Knowledge Privacy Layer for Rayls Protocol
RaylsShield adds privacy-preserving capabilities to cross-chain messaging on Rayls using ZK-SNARKs (Groth16 proofs). Send encrypted transactions across blockchains while maintaining verifiability and compliance.
Rayls Testnet (Chain ID: 123123)
| Contract | Address | Explorer |
|---|---|---|
| Groth16Verifier | 0xaF7B67b88128820Fae205A07aDC055ed509Bdb12 |
View |
| RaylsShield | 0x71E3a04c9Ecc624656334756f70dAAA1fc4F985D |
View |
Network Details:
- RPC:
https://devnet-rpc.rayls.com - Explorer:
https://devnet-explorer.rayls.com - Chain ID:
123123 - Gas Token: USDgas
Blockchain technology promises transparency, but this comes at the cost of financial privacy. Every transaction, balance, and interaction is publicly visible on-chain. This creates several critical problems:
For Individuals:
- No Financial Privacy: Anyone can track your entire transaction history, balance, and spending patterns
- Front-Running Risk: Public transactions enable MEV attacks and front-running
- Identity Correlation: Public addresses can be linked to real-world identities
For Institutions:
- Competitive Intelligence Leaks: Competitors can see trading strategies, positions, and settlements
- Regulatory Uncertainty: Privacy solutions like Tornado Cash were sanctioned for lacking compliance
- Adoption Barriers: Cannot meet regulatory requirements while maintaining privacy
For the Industry:
- Mass Surveillance: Complete financial transparency is incompatible with individual rights
- Limited Enterprise Adoption: Fortune 500 companies won't use blockchain where competitors see everything
- Regulatory Crackdown: Privacy-focused projects face sanctions without compliance mechanisms
Existing privacy solutions have critical flaws:
| Solution | Privacy | Compliance | Cross-Chain | Status |
|---|---|---|---|---|
| Tornado Cash | β Yes | β No | β No | |
| Aztec | β Yes | β No | π‘ Complex | |
| Privacy Coins | β Yes | β No | β No | |
| RaylsShield | β Yes | β Yes | β Yes | β Compliant |
The market needs a solution that provides:
- Provable Privacy: Cryptographically guaranteed confidentiality
- Verifiable Compliance: Prove regulatory adherence without revealing data
- Cross-Chain Support: Privacy shouldn't be limited to a single blockchain
- Institutional Grade: Enterprise-ready with proper compliance tools
RaylsShield solves this by combining Zero-Knowledge Proofs with AML compliance checks, enabling true privacy while proving regulatory compliance mathematically.
We envision a future where privacy and compliance coexist seamlessly on-chain.
Year 1: Foundation & Adoption
- β Q1 2025: Launch RaylsShield v1 on Rayls Devnet (Complete)
- π Q2 2025: Security audit by Trail of Bits or similar
- π Q3 2025: Mainnet deployment on Rayls L1
- π€ Q4 2025: First institutional partnerships (target: 5 enterprises)
Year 2: Expansion & Features
- π Q1 2026: Multi-chain deployment (Ethereum, BSC, Polygon via Rayls)
- πΌ Q2 2026: Enterprise tier with KYC/AML integration
- π± Q3 2026: Mobile SDK for wallet integration
- π Q4 2026: Programmable privacy (privacy-preserving smart contracts)
Year 3: Industry Standard
- π’ Q1 2027: Bank-grade compliance dashboard
- π€ Q2 2027: AI-powered transaction privacy optimization
- π Q3 2027: Multi-jurisdictional compliance (EU, US, APAC)
- π― Q4 2027: 1M+ private transactions processed monthly
1. Privacy Innovation
- Advanced ZK circuits for complex financial instruments
- Recursive proofs for enhanced scalability
- Privacy-preserving DeFi protocols
2. Regulatory Leadership
- Work with regulators to define privacy standards
- Open-source compliance frameworks
- Industry-wide adoption of privacy + compliance
3. Enterprise Adoption
- Fortune 500 onboarding program
- Institutional-grade SLAs and support
- Private settlement networks for banks
4. Developer Ecosystem
- Privacy SDK for any blockchain
- No-code privacy integration tools
- Educational programs and grants
By 2027, we aim to make RaylsShield the de facto standard for:
- β Private institutional settlements
- β Compliant DeFi transactions
- β Cross-chain confidential messaging
- β Privacy-preserving enterprise blockchain
Success Metrics:
- π― 1M+ monthly active users
- π― 100+ enterprise integrations
- π― $10B+ in private transaction volume
- π― Compliance certified in 20+ jurisdictions
Privacy Fee Structure:
- 0.1% per private transaction
- Minimum fee: $0.50
- Maximum fee: $100 (capped for large transactions)
Revenue Distribution:
- 50% β Protocol treasury
- 30% β Liquidity providers / Validators
- 20% β Development fund
Example:
- Transaction: $10,000 β Fee: $10
- Monthly volume: $100M β Revenue: $100,000/month
- Yearly projection (Year 1): $1.2M ARR
Enterprise Features:
- White-label privacy integration
- Custom compliance rules
- Dedicated support & SLAs
- Private deployment options
- Advanced analytics dashboard
Pricing:
- Startup: $5,000/month (up to 1,000 txs)
- Growth: $15,000/month (up to 10,000 txs)
- Enterprise: Custom pricing (unlimited txs)
Target: 50 enterprise clients by Year 2 β $6M ARR
Developer Tools:
- Privacy SDK for dApp integration
- API access for automated compliance
- White-label UI components
Pricing:
- Free Tier: 100 proofs/month
- Pro: $500/month (10,000 proofs)
- Business: $2,500/month (100,000 proofs)
Target: 500 API customers β $1M ARR
Regulatory Solutions:
- Automated AML reporting
- Multi-jurisdiction compliance packs
- Real-time risk scoring
- Audit trail generation
Pricing:
- Basic: $1,000/month
- Advanced: $5,000/month
- Custom: $20,000+/month
Target: 100 compliance customers β $3M ARR
| Year | Transaction Fees | Enterprise | API/SDK | Compliance | Total ARR |
|---|---|---|---|---|---|
| Year 1 | $1.2M | $1M | $300K | $500K | $3M |
| Year 2 | $10M | $6M | $1M | $3M | $20M |
| Year 3 | $50M | $15M | $5M | $10M | $80M |
Total Addressable Market (TAM):
- Global blockchain transaction volume: $10 Trillion/year
- Privacy-sensitive transactions: ~5% β $500 Billion
- At 0.1% fee β $500M market
Serviceable Addressable Market (SAM):
- Cross-chain + compliance focus β $50B/year
- Institutional + DeFi segments β $5B/year
Serviceable Obtainable Market (SOM):
- Year 3 target: 5% market share β $250M/year
Phase 1: Early Adopters (Months 1-6)
- DeFi protocols needing privacy
- Crypto-native institutions
- Privacy-focused communities
Phase 2: Institutional Penetration (Months 6-18)
- Traditional finance (TradFi) partnerships
- Enterprise blockchain consortiums
- Regulatory pilot programs
Phase 3: Mass Market (18+ months)
- Wallet integrations (MetaMask, Trust Wallet)
- Exchange partnerships (Coinbase, Binance)
- Enterprise SaaS expansion
Moat 1: Technical Excellence
- First mover in ZK + Compliance + Cross-chain
- Patent-pending privacy architecture
- Open-source trust + proprietary optimization
Moat 2: Regulatory Relationships
- Early compliance certification
- Regulator advisory board
- Jurisdictional expansion ahead of competitors
Moat 3: Network Effects
- More users β better privacy set
- More chains β more use cases
- More integrations β higher switching costs
Moat 4: Brand & Trust
- Security audits by top firms
- Transparent operations
- Community governance
Potential Paths:
- Acquisition by major L1/L2 protocol ($500M-$2B valuation)
- Acquisition by enterprise blockchain company (IBM, Oracle)
- Strategic partnership with TradFi institution
- Token launch + DAO governance transition
- IPO (long-term, if SaaS revenue dominates)
Comparable Exits:
- Aztec Network: $100M valuation (Series B)
- Zcash: $2B peak market cap
- Tornado Cash: $1B+ TVL before sanctions
- Hidden Transaction Amounts: Cryptographic commitments hide actual values
- Private Recipients: Recipient addresses are hashed for privacy
- Secret Nullifiers: Prevent double-spending and replay attacks
- Cross-Chain Privacy: Maintain confidentiality across different blockchains
- AML Threshold Proofs: Prove
amount < $10,000without revealing exact amount - Regulatory-Friendly: Built for institutional use cases
- Verifiable On-Chain: All proofs verified via Groth16 verifier contract
- Audit Trail: Nullifier tracking provides compliance-friendly history
- Sub-Second Finality: Leverages Rayls L1's high-performance consensus
- Gas-Efficient: Optimized Solidity contracts (~272k gas per transaction)
- Fast Proof Generation: 1-2 seconds per proof
- Scalable: Cross-chain messaging via Rayls Protocol
# Clone the repository
git clone https://github.com/Abenavidese/rayls-shield-BA.git
cd rayls-shield-BA
# Install backend dependencies
cd backend
npm install# Start local Hardhat node (Terminal 1)
npm run node
# Run the demo flow (Terminal 2)
npm run demoDemo Output:
π‘οΈ RaylsShield - Zero-Knowledge Privacy Demo
β
Contracts Deployed
β
ZK Proof Generated
β
Private Message Sent Cross-Chain
β
Privacy Preserved!
π‘ Alice sent $7,500 to Bob - amount hidden from everyone!
# Development
npm run compile # Compile Solidity contracts
npm run circom # Compile Circom ZK circuits
npm run clean # Clean build artifacts
# Testing
npm test # Run all tests
npm run test:integration # Run integration tests (13 tests)
# ZK Proofs
npm run generate:proof # Generate a ZK proof
npm run generate:inputs # Generate valid circuit inputs
# Deployment
npm run node # Start local Hardhat node
npm run deploy:local # Deploy to local network
npm run deploy:devnet # Deploy to Rayls Devnet
# Demo
npm run demo # Run complete E2E demorayls-shield-BA/
βββ backend/ # Smart contracts and ZK circuits
β βββ contracts/
β β βββ RaylsShield.sol # Main privacy contract
β β βββ PrivacyVerifier.sol # Groth16 verifier (auto-generated)
β β βββ MockRaylsEndpoint.sol # Local testing mock
β β
β βββ circuits/
β β βββ privacy.circom # Core privacy circuit
β β βββ compliance.circom # AML compliance circuit
β β βββ privacy.wasm # Compiled witness calculator
β β βββ privacy.zkey # Proving key
β β βββ verification_key.json # Verification key
β β
β βββ scripts/
β β βββ generate-inputs.js # Generate valid circuit inputs
β β βββ generate-proof.js # ZK proof generation
β β βββ deploy.js # Contract deployment
β β βββ demo-flow.js # Complete demo workflow
β β
β βββ test/
β β βββ RaylsShield.test.js # Basic unit tests
β β βββ RaylsShield.integration.test.js # E2E tests (β
13 passing)
β β
β βββ hardhat.config.js # Hardhat + Circom configuration
β βββ package.json # Dependencies and scripts
β βββ .env.example # Environment variables template
β
βββ README.md # Project documentation
βββ FRONTEND.md # Frontend integration guide
βββ CONTRIBUTING.md # Contribution guidelines
βββ LICENSE # MIT License
The core privacy circuit (circuits/privacy.circom) uses:
- Poseidon Hash: ZK-friendly hash function
- Commitment Scheme:
commitment = Poseidon(secret, nullifier, amount) - Nullifier Hash:
nullifierHash = Poseidon(nullifier) - Recipient Hash:
recipientHash = Poseidon(recipient)
- Industry-standard ZK-SNARK system
- Proof generation: ~1-2 seconds
- On-chain verification: ~272k gas
- Proves knowledge of private inputs without revealing them
function sendPrivateMessage(
uint256 _dstChainId,
address _destination,
bytes calldata _encryptedPayload,
uint256[2] calldata _pA, // Proof point A
uint256[2][2] calldata _pB, // Proof point B
uint256[2] calldata _pC, // Proof point C
uint256[3] calldata _publicSignals // [nullifierHash, commitment, recipientHash]
) external payable;RaylsShield extends RaylsApp to leverage:
_raylsSend()for cross-chain messaging_raylsSendToResourceId()for resourceId-based routing- Rayls Endpoint integration for multi-chain support
npm testTest Results:
RaylsShield Integration Tests with ZK Proofs
β Deployment tests (3 passing)
β ZK proof generation and verification (2 passing)
β Send private messages (2 passing)
β ResourceId messaging (1 passing)
β Nullifier tracking (1 passing)
β Verifier management (3 passing)
β Complete E2E privacy flow (1 passing)
13 passing (11s)
npm run test:integrationTests include:
- Real ZK proof generation
- On-chain proof verification
- Cross-chain messaging simulation
- Nullifier replay prevention
- End-to-end privacy workflow
# Terminal 1: Start local node
npm run node
# Terminal 2: Deploy contracts
npm run deploy:local- Create
.envfile:
PRIVATE_KEY=your_wallet_private_key_here
RAYLS_ENDPOINT_ADDRESS=0x... # Get from Rayls team- Deploy:
npm run deploy:devnetRayls Devnet Details:
- Chain ID:
123123 - RPC:
https://devnet-rpc.rayls.com - Explorer:
https://devnet-explorer.rayls.com - Gas Token:
USDgas
- Hide trading amounts from competitors
- Prove compliance with AML regulations
- Maintain privacy while meeting regulatory requirements
- Send encrypted messages across blockchains
- Verify recipient without revealing identity
- Prevent double-spending with nullifiers
- Private institutional settlements
- Compliance-friendly privacy
- Rayls' sub-second finality for instant settlement
- Hidden liquidity provisions
- Anonymous yield farming
- Private DAO voting
- Privacy Circuit: 3 Poseidon hashes + 1 range check
- Compliance Circuit: Adds 2 comparison constraints for AML
- Witness Calculation: < 1 second
- Proof Generation: 1-2 seconds
- Proof Size: ~128 bytes
- Deploy RaylsShield: ~1,037,239 gas
- Deploy Verifier: ~390,033 gas
- Send Private Message: ~272,268 gas (avg)
- Update Verifier: ~30,588 gas
- β Groth16 ZK-SNARKs (industry standard)
- β Poseidon hash (ZK-optimized)
- β Nullifier system (replay protection)
- β OpenZeppelin contracts (battle-tested)
- β Reentrancy guards
- β Access control (Ownable)
- FRONTEND.md - Complete frontend integration guide with React examples
- NEXT_STEPS.md - Deployment guide and next steps
- CLAUDE.md - Development instructions
npm run generate:proofOutput:
β
Proof generated successfully!
Proof valid: β
YES
Solidity call data:
a: [...]
b: [...]
c: [...]
publicSignals: [nullifierHash, commitment, recipientHash]
const { generateProof, formatProofForSolidity } = require("./scripts/generate-proof");
// Generate proof
const { proof, publicSignals } = await generateProof({
secret: BigInt(123456789),
nullifier: BigInt(987654321),
recipient: BigInt("0x..."),
amount: BigInt(7500),
});
// Format for Solidity
const solidityProof = formatProofForSolidity(proof, publicSignals);
// Send private message
await raylsShield.sendPrivateMessage(
dstChainId,
destination,
encryptedPayload,
solidityProof.a,
solidityProof.b,
solidityProof.c,
solidityProof.publicSignals
);β Complete ZK Implementation
- Privacy circuit compiled and tested
- Compliance circuit with AML checks
- Real proof generation working
β Full Rayls Integration
- Extends RaylsApp correctly
- Cross-chain messaging implemented
- ResourceId support added
β Production-Ready Testing
- 13 comprehensive tests passing
- Real ZK proofs in tests
- End-to-end flow validated
β Developer Experience
- Easy proof generation scripts
- Comprehensive documentation
- One-command demo
- Rayls Litepaper
- Rayls Public Chain Docs
- Rayls DevNet DApp
- Rayls Explorer
- Rayls Proof-of-Usage
- Circom Documentation
- snarkjs Documentation
This is a hackathon project. Contributions, issues, and feature requests are welcome!
MIT License - See LICENSE file for details
- Rayls Team for the amazing L1 protocol
- Circom/iden3 for ZK circuit tooling
- OpenZeppelin for secure smart contract libraries
- Hardhat for development framework
For questions about RaylsShield:
- Check
IMPLEMENTATION_COMPLETE.mdfor detailed implementation notes - Review
CLAUDE.mdfor architectural decisions - Run
npm run demoto see it in action
Built with β€οΈ using Zero-Knowledge proofs, Rayls Protocol, and Solidity.
Perfect for: Institutional DeFi β’ Private Cross-Chain Messaging β’ Regulatory-Compliant Privacy β’ Confidential Settlements