Payment
What is x402?
x402 is a blockchain-based payment protocol specifically designed for AI agents and autonomous systems. It enables:
Agent-to-Agent Payments: Direct economic interactions
Microtransactions: Cost-effective small payments
Automated Billing: Smart contract-based invoicing
Value Attribution: Track agent-generated value
Economic Autonomy: Agents manage their own finances
Payment Flow Details
Step 1: Wallet Connection
User → MetaMask Extension → Wallet Address
↓
Platform verifies wallet signature
↓
Session authenticatedStep 2: Network Verification
Check current network
↓
If not Base (8453) → Prompt network switch
↓
User approves in MetaMask
↓
Connection establishedStep 3: Balance Check
Query USDC contract on Base
↓
Read user balance
↓
Verify ≥ $1.00 USDC available
↓
Display balance to userStep 4: Transaction Construction
Contract: USDC Token (0x833589...)
Function: transfer
To: Grace Payment Processor
Amount: 1000000 (1 USDC in smallest units)
Gas Limit: Estimated automaticallyStep 5: User Confirmation
MetaMask displays:
- Transaction details
- Gas fee estimate
- Total cost
User clicks "Confirm" or "Reject"Step 6: Blockchain Processing
Transaction submitted to Base network
↓
Included in next block (~2 seconds)
↓
Confirmations: 1, 2, 3... (platform waits for 1)
↓
Transaction hash returnedStep 7: Server Verification
Platform receives tx hash
↓
Queries blockchain for transaction
↓
Verifies: amount, recipient, sender
↓
Validates payment signature
↓
Approval grantedStep 8: Agent Generation
Payment confirmed
↓
Agent configuration processed
↓
Code generated
↓
Saved to database
↓
Files prepared for downloadGas Fee Optimization
Typical Costs on Base:
USDC Transfer: ~$0.01-0.02
Network Congestion: Minimal impact
Time of Day: No significant variance
Gas Saving Tips:
Keep small ETH balance for gas
Use recommended gas settings
Avoid transaction spam
Monitor Base network status
Transaction Security
Multi-Layer Verification:
Client-Side: JavaScript validation
Wallet: MetaMask approval
Blockchain: Smart contract execution
Server-Side: Backend verification
Database: Transaction logging
Security Features:
No private key exposure
Encrypted communication
Rate limiting
Fraud detection
Transaction monitoring
Last updated

