x402 Protocol

Core Equations Driving Frictionless Payments

The x402 protocol transforms HTTP 402 into a real-time micropayment standard, enabling machine-to-machine (M2M) commerce with sub-centennial latency and near-zero cost.

Below are the foundational equations governing its economics, routing, and settlement, optimized for XorraBet’s autonomous betting agents.

Payment Trigger Condition

When a resource is protected, the server returns HTTP 402 if:

  • ( u ): User or AI agent

  • ( r ): Requested resource

  • ( s ): Service provider

  • ( v ): Value in USDC (e.g., $0.001)

  • ( P ): On-chain payment tx

Cost Efficiency vs. Traditional Payment Rails

Savings per 1M calls (@ $0.01 each):

S=1,000,000×((0.029×0.01+0.30)−0.0001)=$32,890

Agent Payment Automation (Pseudocode Logic)
if (response.status === 402) {
  let amount = parseFloat(headers.get('x402-amount'));
  let token  = headers.get('x402-currency'); // e.g., 'USDC'
  let to     = headers.get('x402-address');
  
  tx = await wallet.send(to, amount, token); // Base L2
  retryWithHeader('x402-token', tx.hash);
}
Settlement Finality on Base (L2)
XorraBet Agent Economy Example
HTML Snippet: x402 Paywall for Live Odds API

For XorraBet: Every odds update, AI bet, or on-chain RNG roll uses x402 -autonomous, instant, and under 1/10th of a penny. This will be the backbone of future agentic DeFi gambling.

Last updated