Logo
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:

  1. Use FHESafeMath for safe arithmetic
  2. Implement ERC7984 standard for compatibility
  3. Add access control for admin functions
  4. Consider withdrawal limits and rate limiting
  5. Integrate with confidential tokens for real value

Quick Start

Loading...

Next Steps

  • See confidential-token for ERC7984 standard implementation
  • See sealed-auction for advanced DeFi patterns
  • See TEMPLATE_SPECIFICATIONS.md for FHESafeMath patterns
Loading...