WhatsApp-integrated stablecoin remittance dApp on Base blockchain
Bridge African mobile money (M-Pesa via Flutterwave) to USDC on Base with a modern Next.js frontend featuring hybrid wallet support.
AfriBridge enables users to send money from African mobile money services to USDC on Base blockchain through:
- π± WhatsApp bot interface
- π§ Email-based wallet (Coinbase Smart Wallet)
- π Mobile wallets via WalletConnect
- π° M-Pesa integration via Flutterwave
- β‘ Fast & cheap transactions on Base L2
- Bridge Contract: Gas-optimized USDC bridge (~62k gas per transaction)
- Deployed & Verified: Base Sepolia testnet
- Security: OpenZeppelin AccessControl + ReentrancyGuard
- Express.js REST API with 10 endpoints
- WhatsApp bot with 7-state conversation flow
- Payment processing via Flutterwave
- USDC handling via Circle API
- Off-ramp service for withdrawals
- Error handling & retry mechanisms
- Next.js 14 with TypeScript
- Hybrid wallet support:
- Coinbase Smart Wallet (CDP) - Email login
- WalletConnect - Mobile wallets (MetaMask, Trust, etc.)
- Bridge contract integration
- Real-time transaction tracking
- Mobile-responsive design
- 56 automated tests (contracts + backend + bot)
- E2E flow simulation
- 100% contract coverage
- Integration test suite
Want to test AfriBridge quickly?
- π± Quick Start: QUICK_START_FOR_JUDGES.md - Test in 2 minutes
- π Full Demo Guide: DEMO.md - Comprehensive testing instructions
- π¬ Video Script: VIDEO_DEMO_SCRIPT.md - For creating demo videos
Live Links:
- π Backend API: https://afribridge-8np4.onrender.com
- π Smart Contract: 0xC3a201c2Dc904ae32a9a0adea3478EB252d5Cf88
- Node.js 18+
- npm or yarn
- Git
git clone https://github.com/big14way/AB.git
cd AB
npm installCreate .env in root:
# Blockchain
PRIVATE_KEY=your_wallet_private_key
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
BRIDGE_CONTRACT_ADDRESS=0xC3a201c2Dc904ae32a9a0adea3478EB252d5Cf88
USDC_ADDRESS_SEPOLIA=0x036CbD53842c5426634e7929541eC2318f3dCF7e
# Flutterwave (get from flutterwave.com)
FLUTTERWAVE_PUBLIC_KEY=your_public_key
FLUTTERWAVE_SECRET_KEY=your_secret_key
FLUTTERWAVE_SECRET_HASH=your_hash
# Twilio (get from twilio.com)
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886
# Circle (get from circle.com)
CIRCLE_API_KEY=your_api_key
CIRCLE_WALLET_ID=your_wallet_id
# Admin
ADMIN_API_KEY=your_secure_admin_keyCreate frontend/.env.local:
# WalletConnect (get free at cloud.walletconnect.com)
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id
# Bridge Contract
NEXT_PUBLIC_BRIDGE_CONTRACT_ADDRESS=0xC3a201c2Dc904ae32a9a0adea3478EB252d5Cf88
NEXT_PUBLIC_BASE_SEPOLIA_RPC=https://sepolia.base.orgnpm startBackend runs on http://localhost:3000
cd frontend
npm install
npm run devFrontend runs on http://localhost:3000
- Visit http://localhost:3000
- Click "Connect Wallet"
- Choose:
- Coinbase Smart Wallet (email login)
- WalletConnect (QR code for mobile wallets)
- Message the bot: "send"
- Enter amount in KES
- Provide recipient Ethereum address
- Confirm transaction
- Pay via M-Pesa/card
- Receive USDC on Base
- Connect wallet
- Click "Test Deposit"
- Enter recipient & amount
- Approve transaction
- View on BaseScan
βββββββββββββββββββββββββββββββββββββββ
β FRONTEND β
β Next.js + Wagmi + WalletConnect β
β ββ CDP (Email Wallet) β
β ββ WalletConnect (Mobile) β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββββββ
β BACKEND β
β Express API + WhatsApp Bot β
β ββ Flutterwave (M-Pesa) β
β ββ Circle (USDC) β
β ββ Bridge Service β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββββββ
β BRIDGE CONTRACT β
β Base Sepolia: 0xC3a201c...5Cf88 β
β ββ depositUSDC() β
β ββ withdrawUSDC() β
βββββββββββββββββββββββββββββββββββββββ
npm run test:allnpm run contracts:testExpected: 12 passing tests
npm testExpected: 44 passing tests
# Terminal 1
npm start
# Terminal 2
npm run test:e2enpm run contracts:deploy:sepolianpm run deploy:vercelSet environment variables in Vercel dashboard.
cd frontend
vercel --prodConfigure environment variables for production.
- Address:
0xC3a201c2Dc904ae32a9a0adea3478EB252d5Cf88 - Network: Base Sepolia (Chain ID: 84532)
- Explorer: View on BaseScan
- Base Docs: https://docs.base.org
- WalletConnect: https://cloud.walletconnect.com
- Coinbase CDP: https://docs.cdp.coinbase.com
- Flutterwave: https://flutterwave.com/documentation
- Circle: https://developers.circle.com
Blockchain:
- Solidity 0.8.20
- Hardhat
- OpenZeppelin
- Base (Ethereum L2)
Backend:
- Node.js 18+
- Express.js
- Twilio (WhatsApp)
- Flutterwave (Payments)
- Circle (USDC)
Frontend:
- Next.js 14
- TypeScript
- Wagmi 2
- Viem 2
- WalletConnect
Testing:
- Hardhat (Contracts)
- Jest + Supertest (Backend)
- Chai (Assertions)
- Lines of Code: ~7,100
- Smart Contracts: 1 (Bridge.sol)
- API Endpoints: 10
- Tests: 56 passing
- Test Coverage: >90%
- Files: 73+
- Non-custodial wallets
- Role-based access control
- ReentrancyGuard protection
- Input validation
- Rate limiting
- Secure environment variables
- Get professional smart contract audit
- Implement KYC/AML compliance
- Add transaction database
- Use multi-sig for admin
- Deploy to Base mainnet
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Base - Ethereum L2 network
- Coinbase - Smart Wallet infrastructure
- WalletConnect - Wallet protocol
- OpenZeppelin - Smart contract library
- Flutterwave - Payment processing
- Circle - USDC infrastructure
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- β Bridge contract deployed on Base Sepolia
- β Backend API with WhatsApp bot
- β Frontend with hybrid wallets
- β 56 automated tests
- Deploy to Base mainnet
- Add transaction database
- Implement Redis sessions
- KYC/AML compliance
- Admin dashboard
- Mobile app
- Multi-chain support
- Additional payment methods
- More African countries
- Fiat off-ramps
- Merchant API
Built with β€οΈ for Africa
Bridging traditional finance and DeFi, one transaction at a time.