Skip to content

Quickstart

Get up and running with x402 RPC Proxy in minutes.

Prerequisites

Before you begin, make sure you have:

  • A Web3 wallet (MetaMask, Keplr, or similar)
  • Basic familiarity with blockchain RPCs
  • An API client (curl, Postman, or your preferred HTTP client)

Step 1 — Authenticate

x402 uses wallet-based authentication (SIWE / SIWC). First, request a nonce:

http
GET /auth/nonce?address=0xYourWalletAddress

You'll receive a nonce string. Sign it with your wallet, then exchange for a JWT:

http
POST /auth/login
Content-Type: application/json

{
  "address": "0xYourWalletAddress",
  "signature": "0x...",
  "message": "Sign in with Ethereum\n\nnonce: abc123"
}

Response:

json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_at": "2024-12-31T23:59:59Z"
}

Store the token — you'll use it in the Authorization header for all subsequent requests.


Step 2 — Top Up Credits

All RPC requests consume credits. Before making requests, purchase credits via the x402 payment flow.

Call the pricing endpoint to view available plans:

http
GET /pricing
Authorization: Bearer <your-token>

Select a plan and make an on-chain payment. Once confirmed, credits are issued to your wallet automatically.


Step 3 — Make Your First RPC Call

Send RPC requests to the /mcp endpoint using JSON-RPC 2.0:

http
POST /mcp
Authorization: Bearer <your-token>
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_blockNumber",
  "params": []
}

Response:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x12a05f2"
}

Step 4 — Check Your Balance

Monitor your remaining credits at any time:

http
GET /credits/balance
Authorization: Bearer <your-token>
json
{
  "address": "0xYourWalletAddress",
  "credits": 9850,
  "last_updated": "2024-06-01T10:32:00Z"
}

What's Next?

Built on open standards — JSON-RPC 2.0, HTTP 402, SIWx.