A modern, secure dApp for managing and transferring ERC20 tokens with privacy using Paillier homomorphic encryption. This application ensures that both token balances and transfer amounts remain private and hidden from block explorers and the mempool.
- 🔒 Secure Token Transfers: Uses Paillier encryption for confidential balances and transfer amounts
- 🪙 Token Management: Use default token or deploy your own ERC20 token
- 👛 Wallet Integration: Seamless connection with popular wallets via RainbowKit
- 📊 Real-time Updates: Live transaction history and balance updates
- 🎨 Modern UI: Clean, professional interface styled with Tailwind CSS
- ♿ Accessibility: Full keyboard navigation and ARIA support
- Framework: Next.js 15
- Language: TypeScript
- Styling: Tailwind CSS
- State Management: React Query
- Blockchain Integration:
- wagmi
- RainbowKit
- viem/ethers.js
- Smart Contracts: Custom Paillier homomorphic encryption contract
- UI Components: shadcn/ui
- Node.js 18.17 or later
- A modern web browser
- A Web3 wallet (MetaMask, Rainbow, etc.)
- Clone the repository:
git clone <repository-url>
cd base-erc20-poc
- Install dependencies:
npm install
# or
yarn install
# or
pnpm install
- Set up your environment variables:
cp .env.example .env.local
Edit .env.local
with your configuration:
NEXT_PUBLIC_DISCRETE_ERC20_FACTORY_ADDRESS
: Address of the deployed ERC20 Factory contractNEXT_PUBLIC_PAILLIER_ADDRESS
: Address of the deployed Paillier encryption contract
Paillier Encryption Keys:
NEXT_PUBLIC_PUBLIC_KEY_N
: The modulus n of the Paillier public keyNEXT_PUBLIC_PUBLIC_KEY_G
: The generator g of the Paillier public keyPAILLIER_LAMBDA
: The lambda value of the Paillier private key (keep this secret!)PAILLIER_MU
: The mu value of the Paillier private key (keep this secret!)
Network:
ALCHEMY_API_KEY
: Your Alchemy API key for Base Sepolia network access
.env.local
file or share your private keys. The private key variables (PAILLIER_LAMBDA
and PAILLIER_MU
) should be kept secure and only used in a trusted environment.
- Start the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
- Open http://localhost:3000 with your browser to see the application.
- Connect Wallet: Click the "Connect Wallet" button in the header to connect your Web3 wallet.
- Select/Deploy Token:
- Use the default token, or
- Deploy your own ERC20 token by providing token details
- View Balance: Your encrypted token balance will be displayed and automatically updated
- Send Tokens: Use the transfer form to send encrypted tokens to any address
- Track History: View your transaction history in real-time
npm run build
: Create production buildnpm run lint
: Run ESLintnpm run format
: Format code with Prettiernpm run test
: Run tests (if configured)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.