Privacy-Preserving DeFi Swaps with Custom Identity Verification
ZKVault is a comprehensive DeFi protocol that combines zero-knowledge proofs for shielded swaps, advanced custom identity verification, and encrypted off-chain receipt storage using Filecoin/IPFS. The protocol integrates multiple cutting-edge technologies to create a privacy-first, Sybil-resistant trading environment with our own innovative on-chain identity system.
- π Zero-Knowledge Shielded Swaps: Privacy-preserving token swaps using zk-SNARKs
- π Custom Identity Verification: Advanced multi-method identity verification system
- π¦ Decentralized Storage: Encrypted receipt storage on Filecoin/IPFS via Lighthouse and Synapse
- π€ AI/ML Analytics: Dataset storage and analytics via Akave O3 S3-compatible API
- π Live Data Feeds: Real-world data integration with zkTLS cryptographic proofs
- ποΈ DataDAO Governance: Community-driven data sharing and monetization
- β½ Gasless Transactions: Meta-transactions via Gelato relayer network
- π― Airdrop Gating: Verified-human-only token distributions
- π₯ Social Verification: Community vouching system with trusted verifiers
- π Activity-Based Verification: On-chain behavior pattern analysis
- π° Stake-Based Verification: Economic incentives for honest verification
- π Biometric ZK Proofs: Privacy-preserving biometric verification
- βοΈ Multi-Signature Verification: Trusted verifier consensus system
- β° Time-Lock Verification: Commitment-based verification methods
- π Cross-Chain Verification: Multi-network identity proofs
- Smart Contracts: Solidity 0.8.19 with OpenZeppelin
- Frontend: React 19 + Vite + TailwindCSS
- Backend: Node.js + Express
- Blockchain: Ethereum, Polygon, Base, Filecoin
- Storage: Lighthouse (IPFS/Filecoin), Akave O3, Synapse SDK
- Identity: Custom Multi-Method Identity Verification System
- Privacy: Circom + SnarkJS for zero-knowledge proofs
- Data: zkTLS for verifiable real-world data feeds
- Node.js 18+ and npm
- Git
- MetaMask or compatible Web3 wallet
-
Clone the repository
git clone https://github.com/your-org/zkvault-custom-protocol.git cd zkvault-custom-protocol -
Install dependencies
# Install all dependencies (root, frontend, backend) npm run install:all # Or install individually: npm install # Root dependencies (Hardhat, etc.) cd frontend && npm install # Frontend dependencies cd ../backend && npm install # Backend dependencies
-
Environment setup
# Copy environment template cp .env.example .env cp frontend/.env.example frontend/.env # Edit .env files with your configuration # See "Configuration" section below for details
-
Compile smart contracts
npm run compile
-
Setup Akave Link API (for Akave track)
# Pull Akave Link Docker image docker pull akave/akavelink:latest # Run Akave Link container docker run -p 8000:8000 akave/akavelink:latest # Get wallet address and funds from faucet # Visit: https://faucet.akave.ai
-
Deploy contracts (optional for local development)
# Deploy to local hardhat network npm run deploy:localhost # Or deploy to testnets npm run deploy:sepolia npm run deploy:base-sepolia npm run deploy:filecoin
-
Start development environment
# Start both frontend and backend npm run dev # Or start individually: npm run frontend:dev # Frontend only npm run backend:dev # Backend only
-
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:3001
All mock data has been removed from the application. The following API keys are REQUIRED for the application to function:
-
Blockchain RPCs
- Alchemy or Infura for Ethereum/Polygon
- Base RPC endpoint
- Filecoin Calibration testnet RPC
-
Storage Services
- Lighthouse API key (for IPFS/Filecoin storage)
- Akave Link API setup (for native Akave decentralized storage)
- Synapse API key (for Filecoin warm storage)
-
Live Data APIs (REQUIRED - No Mock Fallbacks)
- News API key (for news sentiment analysis) - REQUIRED
- AlphaVantage API key (for financial data) - REQUIRED
- Polygon.io API key (for market data) - REQUIRED
- CoinGecko API (free tier available)
-
Custom Identity Verification
- No external dependencies required
- All verification logic is on-chain
Key environment variables to configure:
# Deployment
PRIVATE_KEY="your_private_key_here"
ETHEREUM_RPC_URL="your_ethereum_rpc_url"
POLYGON_RPC_URL="your_polygon_rpc_url"
BASE_RPC_URL="your_base_rpc_url"
FILECOIN_CALIBRATION_RPC_URL="your_filecoin_rpc_url"
# Storage
LIGHTHOUSE_API_KEY="your_lighthouse_api_key"
VITE_AKAVE_API_URL="http://localhost:8000"
VITE_AKAVE_WALLET_ADDRESS="your_akave_wallet_address"
SYNAPSE_API_KEY="your_synapse_api_key"
# Live Data
NEWS_API_KEY="your_news_api_key"
GELATO_API_KEY="your_gelato_api_key"
# Custom Identity Verification
# No additional configuration required - all on-chain!βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend β β Smart Contracts β
β (React) βββββΊβ (Node.js) βββββΊβ (Solidity) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Storage Layer β β Data Feeds β β Identity β
β (IPFS/Filecoin) β β (zkTLS) β β (Custom System) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- CustomIdentityVerification.sol: Advanced multi-method identity verification system
- ZKVaultCustom.sol: Main protocol contract with custom identity verification
- DataDAO.sol: Decentralized data sharing and governance
- DataCoin.sol: ERC-20 governance token with voting capabilities
- GasPoolDAO.sol: Gasless transaction funding and management
- PrivacyAuditSystem.sol: Privacy compliance and audit logging
- AirdropGating.sol: Verified-human-only token distributions (updated for custom verification)
- User Authentication: Custom identity verification system validates user through multiple methods
- Swap Initiation: User initiates privacy-preserving swap
- ZK Proof Generation: Client generates zero-knowledge proof
- Transaction Execution: Relayer submits transaction with proofs
- Receipt Storage: Encrypted receipt stored on Filecoin/IPFS
- Data Analytics: Anonymized data contributed to DataDAO
# Compile contracts
npm run compile
# Run tests
npm run test
# Deploy to local network
npm run deploy:localhost
# Deploy to testnets
npm run deploy:sepolia
npm run deploy:base-sepolia
npm run deploy:polygon-mumbai
npm run deploy:filecoincd frontend
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewcd backend
# Start development server
npm run dev
# Run in production mode
npm startDeploy contracts to all supported networks:
# Deploy to all testnets
npm run deploy:all-testnets
# Deploy to specific networks
npm run deploy:sepolia
npm run deploy:baseSepolia
npm run deploy:filecoin
# Verify contracts
npm run verify:sepolia
npm run verify:base
npm run verify:filecoinThe frontend can be deployed to Vercel, Netlify, or any static hosting service:
cd frontend
npm run build
# Deploy to Vercel
vercel --prod
# Or deploy to Netlify
netlify deploy --prod --dir=distDeploy the backend to any Node.js hosting service:
cd backend
npm run build # If you have a build step
npm start # Production start# Run all tests
npm test
# Run contract tests only
npx hardhat test
# Run with gas reporting
REPORT_GAS=true npx hardhat test
# Run coverage
npx hardhat coverageThe protocol is deployed and tested on:
- Ethereum Sepolia: For Ethereum compatibility testing
- Base Sepolia: For Base L2 functionality
- Polygon Mumbai: For Polygon scaling features
- Filecoin Calibration: For Filecoin storage integration
// Verify user identity
function verifyIdentityManual(string memory nationality, bytes calldata proof) external
// Execute verified swap
function swapWithVerifiedUser(address tokenIn, address tokenOut, uint256 amountIn) external
// Check verification status
function isUserVerified(address user) public view returns (bool)// Contribute data to DAO
function contributeData(string memory dataHash, uint8 dataType, bytes32 merkleRoot) external
// Claim rewards
function claimRewards() external
// Create governance proposal
function createProposal(string memory title, string memory description) externalGET /api/health - Health check
POST /api/swap/estimate - Estimate swap parameters
POST /api/swap/execute - Execute swap with proofs
GET /api/data/feeds - Get live data feeds
POST /api/data/contribute - Contribute to DataDAO
GET /api/storage/files - List stored files
POST /api/storage/upload - Upload to decentralized storage
- Zero-Knowledge Proofs: Privacy-preserving transaction validation
- Identity Verification: Sybil resistance via Self Protocol
- Encrypted Storage: AES-GCM encryption for sensitive data
- Access Control: Role-based permissions in smart contracts
- Audit Logging: Comprehensive privacy audit system
- Private Key Management: Never commit private keys to version control
- Environment Variables: Use environment variables for sensitive configuration
- Smart Contract Audits: All contracts should be audited before mainnet deployment
- Input Validation: Validate all user inputs on both frontend and backend
- Rate Limiting: Implement rate limiting for API endpoints
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Solidity: Follow Solidity Style Guide
- JavaScript/React: Use ESLint and Prettier configurations
- Documentation: Update README and inline comments for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Website: https://zkvault.app
- Documentation: https://docs.zkvault.app
- Discord: https://discord.gg/zkvault
- Twitter: https://twitter.com/zkvault_app
- GitHub: https://github.com/zkvault/protocol
This project meets all requirements for the following hackathons:
- β S3-Compatible API Usage: AI/ML datasets stored via Akave O3
- β Innovation: Decentralized analytics storage for DeFi
- β Realism: Practical use case for trading analytics
- β Lighthouse SDK Integration: Data tokenization and storage
- β DataDAO Implementation: Community data sharing with DataCoins
- β Live Data Integration: Real-world API feeds with zkTLS validation
- β Mainnet Deployment: Deployed to Base, Polygon, Filecoin networks
- β Synapse SDK Usage: Filecoin warm storage integration
- β USDFC Payments: Storage fees paid with USDFC tokens
- β Calibration Testnet: Deployed to Filecoin Calibration
- β Working Demo: Full frontend demo deployed
If you need help:
- Check the Documentation
- Search GitHub Issues
- Join our Discord
- Create a new issue with detailed information
- Self Protocol for identity verification infrastructure
- Lighthouse for IPFS/Filecoin storage solutions
- Akave for S3-compatible decentralized storage
- Synapse for Filecoin warm storage and payment rails
- OpenZeppelin for secure smart contract libraries
- 1inch for DEX aggregation capabilities
- Gelato for gasless transaction infrastructure
Built with β€οΈ by the ZKVault Team