Back to Hub
Confidential Bank
Multi-user bank with deposits, withdrawals, and transfers
DeFi
Documentation
Confidential Bank
Multi-user bank with encrypted balances, deposits, withdrawals, and encrypted transfers between users - core DeFi primitive.
What You'll Learn
- Multi-user encrypted balance management
- Encrypted transfers between users
- Permission management for sender AND recipient
- CRITICAL: Cannot validate encrypted balances on-chain!
- Deposit/withdraw/transfer patterns
Core Patterns
Deposit
Loading...
Transfer (Critical: Both Users Need Permissions!)
Loading...
Critical Limitation
You CANNOT validate encrypted balances on-chain:
Loading...
Client-Side Usage
Loading...
Key Concepts
✅ Encrypted State - Balances never revealed on-chain ✅ Permission Management - Both parties in transfer need access ✅ Multi-User - Each user maintains separate encrypted balance ⚠️ No On-Chain Validation - Cannot check balance >= amount
Production Considerations
For production DeFi:
- Use FHESafeMath for safe arithmetic
- Implement ERC7984 standard for compatibility
- Add access control for admin functions
- Consider withdrawal limits and rate limiting
- Integrate with confidential tokens for real value
Quick Start
Loading...
Next Steps
- See
confidential-tokenfor ERC7984 standard implementation - See
sealed-auctionfor advanced DeFi patterns - See TEMPLATE_SPECIFICATIONS.md for FHESafeMath patterns
Loading...
