A cross-chain bridge that enables private transfers from Solana (SOL/USDC) to Zcash shielded addresses.
- Node.js 18+ and Bun 1.2+
- Docker and Docker Compose
- Solana CLI and Anchor CLI (optional, for program deployment)
# Run automated setup
bun run setup:windows
# Or manually:
bun install
docker-compose up -d
bun run db:push# Run automated setup
chmod +x setup.sh
./setup.sh
# Or manually:
bun install
docker-compose up -d
bun run db:push-
Update
.envwith your Zcash RPC credentials:ZCASH_RPC_URL=http://localhost:18232 ZCASH_RPC_USER=zcashrpc ZCASH_RPC_PASSWORD=your_password RELAYER_Z_ADDRESS=your_z_address
-
Set up Zcash testnet node (see DEPLOYMENT.md)
-
Deploy Solana program (if not already deployed):
cd packages/solana anchor build anchor deploy --provider.cluster devnet # Update ZWAP_PROGRAM_ID in .env
Start all services:
# Terminal 1: Start relayer
bun run relayer
# Terminal 2: Start frontend
bun run dev:webVisit http://localhost:3000
- DEPLOYMENT.md - Detailed deployment guide
- doc.md - Technical specification
- ARCHITECTURE_VERIFICATION.md - Architecture review
User Wallet (Phantom)
↓
Frontend (Next.js)
↓
tRPC API + PostgreSQL
↓
Relayer Service
↓
Solana Program ←→ Zcash RPC
- ✅ SOL and USDC deposits on Solana
- ✅ Automatic ZEC transfer to shielded addresses
- ✅ Real-time status tracking
- ✅ Event-driven relayer with idempotency
- ✅ Admin recovery functions
- ✅ Type-safe API with tRPC
# Database
bun run db:push # Push schema
bun run db:studio # Open Drizzle Studio
# Development
bun run dev # Start all services
bun run dev:web # Frontend only
bun run relayer # Relayer only
# Code quality
bun run check # Lint and format
bun run check-types # Type checkingzwap/
├── apps/
│ └── web/ # Next.js frontend
### Live Mode Configuration
Set these environment variables to enable real fees and Zcash RPC:
- `USE_LIVE_RATES=true` — enable live fee estimation
- `HELIUS_API_KEY=<your_key>` — Helius Priority Fee API key
- `NEXT_PUBLIC_SOLANA_RPC_URL=https://<cluster>.helius-rpc.com/?api-key=<your_key>` — Solana RPC (mainnet/devnet)
- `SOLANA_CLUSTER=mainnet` — cluster hint for services
- `ZCASH_RPC_URL=http://127.0.0.1:8232` — zcashd JSON-RPC endpoint
- `ZCASH_RPC_USER=<user>` — zcashd RPC username
- `ZCASH_RPC_PASS=<pass>` — zcashd RPC password
- `AUTO_GEN_ZADDR=true` — allow backend to generate shielded addresses via RPC
- `DEMO_PRIVACY_PREMIUM=0.0005` — relayer premium fallback (scaled by speed)
Notes:
- Speed tiers map to priority fee percentiles: slow≈p50, normal≈p75, fast≈p95, with fallbacks.
- If Helius or zcashd are unavailable, the backend uses safe demo estimates.
### Quick Start (live)
```bash
$env:USE_LIVE_RATES="true"
$env:HELIUS_API_KEY="<your_key>"
$env:NEXT_PUBLIC_SOLANA_RPC_URL="https://mainnet.helius-rpc.com/?api-key=<your_key>"
$env:SOLANA_CLUSTER="mainnet"
$env:ZCASH_RPC_URL="http://127.0.0.1:8232"
$env:ZCASH_RPC_USER="rpcuser"
$env:ZCASH_RPC_PASS="rpcpass"
$env:AUTO_GEN_ZADDR="true"
bun dev
├── packages/ │ ├── api/ # tRPC API + Relayer │ ├── db/ # Database schema (Drizzle) │ ├── solana/ # Anchor program + Client SDK │ └── zcash/ # Zcash RPC client ├── DEPLOYMENT.md # Deployment guide └── setup.sh/ps1 # Setup scripts
## 🧪 Testing
1. Connect Phantom wallet (Devnet)
2. Get devnet SOL from https://faucet.solana.com/
3. Enter amount and Zcash Z-address
4. Submit deposit
5. Monitor status page for ZEC transfer
## ⚠️ Important Notes
- **Testnet only** - Not production-ready
- **Centralized relayer** - Single point of trust
- **Fixed exchange rates** - Hardcoded for demo
- **No atomic swaps** - Separate transactions
## 🔐 Security
This is a **hackathon/demo project**. For production:
- Implement proper key management
- Add monitoring and alerting
- Use dynamic exchange rates
- Conduct security audit
- Implement multi-relayer setup
## 📝 License
MIT
## 🤝 Contributing
This is a hackathon project. Feel free to fork and experiment!
## 🐛 Troubleshooting
**Database connection failed**
```bash
docker-compose restart
docker logs zwap-postgres
Relayer not detecting deposits
- Verify ZWAP_PROGRAM_ID matches deployed program
- Check Solana RPC connection
- Ensure program is initialized
Zcash RPC errors
- Verify zcashd is synced
- Check RPC credentials
- Ensure relayer Z-address has balance
For more help, see DEPLOYMENT.md
Built with ❤️ for cross-chain privacy