CastPay enables seamless, ETH-free USDC transfers via social usernames, reducing friction in crypto payments on social platforms.
CastPay allows Farcaster users to send USDC payments using simple commands like @username /pay 5 USDC without needing to hold ETH for gas fees. The system uses a Stylus-based Paymaster contract on Arbitrum to sponsor gas fees, making crypto payments as easy as sending a message.
Traditional crypto payments on social platforms face several barriers:
- Gas Fee Friction: Users need to hold native tokens (ETH) to pay gas fees, creating a poor UX
- Complex Addresses: Wallet addresses are hard to remember and type, especially on mobile
- Multiple Steps: Current payment flows require multiple app switches and confirmations
- Technical Barriers: Users need deep crypto knowledge to navigate gas prices and network fees
CastPay eliminates these barriers through:
- Account Abstraction: ERC-4337 compatible smart accounts remove gas fee requirements
- Social Identity: Pay using familiar @usernames instead of complex wallet addresses
- Gasless Transactions: Stylus Paymaster sponsors all gas fees from USDC balance
- Native Integration: Seamless Farcaster Mini App experience without leaving the social platform
- Instant Settlement: Sub-5 second transaction completion with immediate confirmation
This creates a Web2-like payment experience while maintaining full crypto ownership and transparency.
- Gasless Payments: Send USDC without holding ETH
- Username-based Transfers: Pay using @usernames instead of wallet addresses
- Instant Transactions: Complete payments in under 5 seconds
- Farcaster Integration: Native mini app integration with Warpcast
- ERC-4337 Compatible: Built on Account Abstraction standards
- Stylus Paymaster: Efficient Rust-based smart contracts on Arbitrum
- Node.js 16+ and pnpm
- Warpcast account with linked wallet
- Arbitrum testnet ETH for initial setup
git clone https://github.com/your-org/castpay
cd castpay
pnpm install-
Start the frontend:
cd frontend pnpm dev -
Start the relayer service:
cd backend pnpm start -
Deploy contracts:
cd contracts/template cargo build --release # Deploy using your preferred method
- Enable CastPay Mini App in Warpcast
- Type
@username /pay [amount] USDCin a cast or DM - Confirm the payment in the popup modal
- Payment completes instantly without ETH fees
@alice /pay 10 USDC
This sends 10 USDC to the user @alice.
Farcaster CastPay Arbitrum
Mini App Relayer Blockchain
(Frontend) (Backend) (Contracts)
- Frontend: React-based Farcaster Mini App for user interface
- Backend: Node.js relayer service for transaction bundling
- Contracts: Stylus Paymaster contract written in Rust
- Integrations: Farcaster API for username resolution
castpay/
frontend/ # Farcaster Mini App UI
src/
App.tsx
components/
package.json
backend/ # Relayer service
src/
relayer.js
package.json
contracts/ # Smart contracts
template/
src/
lib.rs
Cargo.toml
scripts/ # Deployment scripts
Create .env files in the respective directories:
Frontend (.env):
VITE_RELAYER_URL=http://localhost:3001
VITE_CHAIN_ID=421614
Backend (.env):
PRIVATE_KEY=your_private_key
ARBITRUM_RPC_URL=https://sepolia-rollup.arbitrum.io/rpc
FARCASTER_API_KEY=your_api_key
The Paymaster contract is built using Arbitrum Stylus (Rust/WASM) and implements ERC-4337 standards:
- Validates user operations
- Sponsors gas fees by deducting from USDC balance
- Includes ~10% surcharge for sustainability
- Deployed on Arbitrum testnet
POST /send-payment- Submit a payment operationGET /payment-status/:txHash- Check payment statusGET /user-balance/:address- Get user USDC balance
{
"recipient": "@username",
"amount": "10.00",
"currency": "USDC",
"signature": "0x..."
}- No private keys stored by the application
- Rate limiting to prevent abuse
- Signature validation for all transactions
- Paymaster validates operations before sponsoring
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE for details