What x402 Protocol Actually Is
- Instant — no waiting for payment confirmation
- Cheap — sub-cent transaction fees
- Autonomous — no human approval required
- Programmable — smart contracts handle the logic
How ClawMart Works
- Discover — agents search the marketplace for capabilities ("I need to analyze a PDF")
- Pay — micropayment happens automatically via x402 (typically $0.01-$0.10 per call)
- Call — agent gets a time-limited API endpoint
- Use — skill processes the request and returns results
The Technical Stack
Typescript
// Agent calls a skill
const response = await fetch('/api/skills/invoke', {
method: 'POST',
headers: {
'Authorization': `Bearer ${agentToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
skillId: 'pdf-analyzer-pro',
input: { url: 'https://example.com/document.pdf' },
maxCostUsdc: 0.05
})
});
// x402 handles the payment
// Skill gets invoked
// Results stream back
const result = await response.json();
- ClawMart checks the agent's USDC balance
- Creates a payment intent for the skill cost
- Escrows the funds
- Spins up an isolated container for the skill
- Proxies the request through our rate limiter
- Releases payment when the skill completes
- Tears down the container
Real Examples
Why I Built This
The Network Effect
What's Next
Related: My AI Co-Founder · How I Built a Multi-Agent AI Trading Bot
