Natural Language Crypto Transactions on Celo MiniPay
AI-powered transaction assistant built as a Celo MiniPay MiniApp with conversational interface
Check out the live demo of LeftAI: π Click here to try it out
π± MiniPay MiniApp: This is a Celo MiniPay MiniApp optimized for mobile! Open the link in MiniPay browser for the best experience.
LeftAI is built as a Celo MiniPay MiniApp - a mobile-first application optimized for MiniPay's mobile wallet ecosystem. The interface provides an intuitive, chat-based interaction for crypto transactions on the go.
LeftAI also works as a Progressive Web App, providing a seamless experience across desktop and mobile browsers with full wallet integration.
We noticed that blockchain transactions are still too complex for mainstream adoption. Users need to:
- Copy-paste long wallet addresses (prone to errors)
- Calculate amounts manually
- Navigate multiple DeFi protocols
- Understand complex terminology
"What if you could just say 'Send $10 to Alice' and it happens?"
That question sparked LeftAI. By combining natural language processing with AI function calling (powered by Phala's confidential computing network), contact management, and smart contract automation, we created an interface where anyone can execute crypto transactions as easily as sending a text message.
This exploration led us to build LeftAI as a Celo MiniPay MiniApp - a mobile-first, PWA-optimized application that:
- Understands natural language commands using RedPill AI (Phala Network)
- Resolves contacts automatically with @mentions (like Twitter/Slack)
- Converts USD to crypto using $ notation for intuitive amounts
- Splits bills intelligently with AI-powered calculation
- Enables CELO staking through custom smart contracts
- Executes transactions securely with MetaMask integration
- Provides real-time feedback with explorer links and confirmations
- Works seamlessly on mobile as a MiniPay-integrated PWA
- Send crypto using plain English: "Send $10 to @Alice Johnson"
- AI extracts parameters and prepares transactions
- Smart parameter collection for missing information
- Type
@to select contacts with autocomplete - No more copy-pasting addresses
- Contact names automatically resolve to wallet addresses
- Type
$10to send 10 USDC - Simple 1:1 conversion for easy mental math
- Supports USDC, CELO, cUSD, cEUR
- "I paid $60 for dinner with @Bob and @Carol, split it equally"
- AI calculates individual shares
- Sends payment requests to all participants
- Notification system for requests
- "I want to stake 10 CELO to earn rewards"
- Custom SimpleStaking contract (1:1 CELO:stCELO)
- Single transaction, no complex steps
- Deployed at:
0x95Cb4F3CA3c7B5d1fD2577Ce47F65c15b4521Fa7
- View USDC and CELO balances
- Direct link to Celoscan explorer
- Real-time balance updates
Clone the repository and start the development server:
git clone https://github.com/derek2403/token2049.git
cd token2049/frontend
npm install
npm run devCreate a .env.local file in the frontend directory:
# RedPill AI API (Phala Network)
REDPILL_API_KEY=your_redpill_api_key_here
# Layerswap API
LAYERSWAP_API_KEY=your_layerswap_api_key_here
# Squid Router API
SQUID_INTEGRATOR_ID=your_squid_integrator_id_hereDeploy the SimpleStaking contract:
cd contract
npm install
# Add your PRIVATE_KEY to .env
npm run deploy:stakingβββββββββββββββββββ
β User Input β
β "Send $10 to β
β @Alice" β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β Frontend Processing β
β β’ @ β Wallet Address β
β β’ $ β USDC Amount β
ββββββββββ¬βββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β RedPill AI (Phala) β
β β’ Parse intent β
β β’ Extract parameters β
β β’ Call function β
ββββββββββ¬βββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β Smart Contract Execution β
β β’ Transfer USDC β
β β’ Stake CELO β
β β’ Request Payment β
ββββββββββ¬βββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β Blockchain Confirmation β
β β’ MetaMask signature β
β β’ Transaction on Celo β
β β’ Explorer link β
βββββββββββββββββββββββββββββββ
- Next.js 15 - React framework with App Router
- Wagmi 2.x - React Hooks for Ethereum
- RainbowKit - Wallet connection UI
- Viem - TypeScript interface for Ethereum
- TailwindCSS - Utility-first styling
- Framer Motion - Animations
- Radix UI - Accessible components
- shadcn/ui - UI component library
- RedPill AI (Phala Network) - Confidential AI computation
- OpenAI-compatible API - Function calling interface
- Layerswap API - Cross-chain bridging
- Squid Router - DEX aggregation
- Celoscan API - Blockchain data
- Solidity 0.8.20+ - Smart contract language
- Hardhat - Development environment
- OpenZeppelin - Secure contract libraries
- Celo Mainnet - Deployment network
- Celo - Layer 1 blockchain
- Celo MiniPay - Mobile wallet integration
- USDC - Primary stablecoin
- RainbowKit - Multi-wallet support (MiniPay, MetaMask, etc.)
- ERC-4626 - Vault standard
Address: 0x95Cb4F3CA3c7B5d1fD2577Ce47F65c15b4521Fa7 (Celo Mainnet)
A simple 1:1 staking contract for CELO tokens:
stake()- Deposit CELO, receive stCELO (1:1)unstake(uint256)- Burn stCELO, receive CELO back- ERC20 compliant stCELO token
View on Celoscan: 0x95Cb...1Fa7
LeftAI uses function calling to execute blockchain operations:
Input: "Send $10 to @Alice Johnson"
AI Calls: transfer_funds(destinationAddress, amount: "10", tokenSymbol: "USDC")
Result: Transfers 10 USDC to Alice's walletInput: "I paid $60 for dinner with @Bob and @Carol, split it equally"
AI Calls: request_payment(fromAddresses: [Bob, Carol], individualAmounts: {Bob: 20, Carol: 20}, tokenSymbol: "USDC")
Result: Sends payment requests to Bob and Carol for 20 USDC eachInput: "I want to stake 10 CELO to earn rewards"
AI Calls: stake_celo(amount: "10")
Result: Stakes 10 CELO via SimpleStaking contract, receives 10 stCELO- Autocomplete: Type
@to search contacts - Auto-resolve: Frontend replaces
@Alice Johnsonwith0x1C4e...D6C6 - Cursor-like UX: Dropdown with fuzzy search
- USD notation:
$10automatically converts to10 USDC - 1:1 ratio: Simple mental math
- Multiple tokens: Supports USDC, CELO, cUSD, cEUR
User Input β Contact/USD Replacement β RedPill AI β Function Call β Validation β Confirmation UI β MetaMask β Blockchain
-
AI Chat Processing
/pages/api/chat.js -
Squid Router Integration
/pages/api/squid-route.js
/pages/api/squid-status.js -
Notification System
/pages/api/notifications.js
-
Transfer Logic
/lib/llmActions/executeTransfer.js -
Payment Requests
/lib/llmActions/requestPayment.js -
CELO Staking
/lib/llmActions/stakeCelo.js -
Function Registry
/lib/llmActions/index.js
-
SimpleStaking Contract
/contract/contracts/SimpleStaking.sol -
Deployment Scripts
/contract/scripts/deploySimpleStaking.js
token2049/
βββ frontend/ # Next.js application
β βββ components/ # React components
β β βββ navbar.js # Navigation with balance modal
β β βββ contact-autocomplete.js
β β βββ notification-toast.js
β βββ pages/
β β βββ index.js # Landing page with demo
β β βββ chat.js # Main chat interface
β β βββ api/ # API routes
β βββ lib/
β β βββ llmActions/ # AI function definitions
β β βββ currencyUtils.js
β β βββ swapUtils.js
β βββ hooks/
β β βββ useContacts.js
β βββ public/
β β βββ data/
β β βββ contacts.json
β βββ .env.local # Environment variables
β
βββ contract/ # Smart contracts
βββ contracts/
β βββ SimpleStaking.sol
βββ scripts/
β βββ deploySimpleStaking.js
βββ deployments/
βββ simple-staking.json
-
Send Funds
Send $0.01 to @Alice Johnson -
Split Bills
I paid $60 for dinner with @Bob Smith and @Carol Lee, split it equally -
Stake CELO
I want to stake 1 CELO to earn rewards
cd frontend
npm run build
# Deploy to Vercel
# Access via MiniPay browser or any mobile deviceMiniPay MiniApp Integration:
- Built as a Celo MiniPay MiniApp optimized for mobile wallet experience
- Works as a Progressive Web App (PWA)
- Supports MiniPay wallet alongside MetaMask and other Web3 wallets
cd contract
# Add PRIVATE_KEY to .env
npm run deploy:staking

