Gasless x402 facilitator using ERC 4337 Smart Accounts + Account Abstraction
x402-gasless is an early-stage JavaScript project in the AI payments / x402 ecosystem. It currently has 1 GitHub stars and 0 forks.
Gasless transactions for x402 payments using Alchemy's Account Abstraction
Enable your users to pay with USDC without worrying about gas fees. Fork this repo, add your Alchemy API key, and deploy in 5 minutes.
⚠️ Beta Software - Core functionality is tested and working with real Alchemy Account Abstraction integration. The demo client demonstrates actual gasless transactions. Test thoroughly in your environment before production use. Report issues →
# Install globally
npm install -g x402-gasless
# Or use npx (no installation needed)
npx x402-gasless setup
npx x402-gasless start
# 1. Clone the repo
git clone https://github.com/usmaneth/x402-gasless
cd x402-gasless
# 2. Install dependencies
npm install
# 3. Setup (interactive wizard)
npm run setup
# Prompts for Alchemy API key and creates Gas Manager policy
# 4. Start the facilitator
npm run dev
# Server running at http://localhost:3000 ✅
Understanding "Gasless":
Gasless ≠ Free — Here's what it means:
Think of it like Amazon Prime:
Example Transaction:
User wants blockchain data from Vend (costs 0.01 USDC)
Traditional:
- 0.01 USDC for data ✓
- ~$0.02 ETH for gas ✗ (user needs ETH!)
With x402-gasless:
- 0.01 USDC for data ✓
- $0.00 ETH for gas ✓ (Alchemy sponsors it!)
Your Costs (Platform Operator):
Client (Smart Wallet) → Resource Server (Vend) → x402-gasless Facilitator → Alchemy Gas Manager → Blockchain
Test the complete gasless flow with our ready-to-run demo:
cd examples/demo-client
npm install
cp .env.example .env
# Edit .env with your Alchemy API key and private key
npm start
The demo shows:
POST /verifyVerify a UserOperation signature and payment details.
curl -X POST http://localhost:3000/verify \
-H "Content-Type: application/json" \
-d '{
"x402Version": 1,
"paymentHeader": "base64-encoded-userop",
"paymentRequirements": {
"scheme": "aa-erc4337",
"network": "base-sepolia",
"maxAmountRequired": "10000",
"payTo": "0x...",
"asset": "0x..."
}
}'
POST /settleSettle a verified payment by submitting to blockchain with gas sponsorship.
GET /supportedGet list of supported payment schemes and networks.
GET /healthHealth check endpoint.
Auto-configured out of the box:
All USDC contracts pre-configured!
x402-gasless/
├── src/
│ ├── index.js # Express app entry point
│ ├── config.js # Smart configuration
│ ├── logger.js # Logging setup
│ ├── routes/ # API endpoints
│ ├── services/ # Core business logic
│ ├── middleware/ # Express middleware
│ └── utils/ # Utilities
├── scripts/
│ ├── setup.js # Interactive setup
│ ├── create-policy.js # Create Alchemy Gas Manager policy
│ └── test-connection.js # Test Alchemy connection
├── docs/ # Documentation
├── examples/ # Integration examples
└── tests/ # Test suite
# Run in development mode (auto-reload)
npm run dev
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Test Alchemy connection
npm run test-connection
# Create Gas Manager policy
npm run create-policy
npm run deploy:railway
docker build -t x402-gasless .
docker run -p 3000:3000 --env-file .env x402-gasless
Make sure to set these in your deployment platform:
ALCHEMY_API_KEYALCHEMY_GAS_POLICY_IDNODE_ENV=productionPORT=3000 (or your preferred port)Contributions welcome! Please read our Contributing Guide first.
MIT - Fork freely!
Built with ❤️ for the x402 community
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
A payments protocol for the internet. Built on HTTP.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
Self-healing infrastructure for AI agent payments. 90.3% auto-recovery.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.