x402 · USDC on Base + Solana

x402-account-link

A one-time account linking vault for agent flows. Credentials go in once, AES-256-GCM encrypted; agents get scoped, expiring access tokens out — paid per use, no API keys.

git clone https://github.com/nirholas/x402-account-link && npm install && npm run dev

Pricing

RoutePriceWhat you get back
POST /links$0.01Signed link record + HMAC proof (credential fingerprint, scopes, expiry). Credentials are encrypted at rest and never returned.
GET /links/:id/token$0.002Scoped, expiring access token (owner-wallet auth), returned in the response body.
GET /links/:id · POST /verify-token · POST /links/:id/revokefreeMetadata, token introspection, owner revocation.

How x402 works here

1 · 402

Request

Call a paid route. The vault answers 402 Payment Required with exact USDC payment requirements.

2 · Sign

Pay

The 402 offers two rails — USDC on Base and USDC on Solana. Your client signs whichever one its wallet supports and retries with X-PAYMENT.

3 · Settle

Verify

That rail's facilitator verifies and settles on-chain. The server holds no key and pays no gas.

4 · 200

Artifact

The signed link record or minted token arrives in the response body, receipt in X-PAYMENT-RESPONSE.

Quickstart

npm install && npm run dev                    # vault on :4036, both rails live

# to receive the funds yourself:
export PAY_TO_ADDRESS=0xYourEvmWallet         # USDC on Base
export SOLANA_PAY_TO_ADDRESS=YourSolanaWallet # USDC on Solana

# agent side — pays $0.01, gets the signed link record back
PRIVATE_KEY=0xAgentWallet npx tsx examples/agent-client.ts

Payment rails

RailNetworkAssetPays toFacilitator
EVMbase-sepolia (default) · baseUSDC0x40252CFDF8B20Ed757D61ff157719F33Ec332402x402.org/facilitator
Solanasolana (default) · solana-devnetUSDCWwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwWfacilitator.payai.network

Both entries appear in every 402. Pay in USDC on Base or Solana — your client picks the rail.