hood402

The x402 payment rail for USDG on Robinhood Chain (chain ID 4663).
Spec-conformant exact/EIP-3009 server middleware, a paying client, and a self-hostable
facilitator. Gasless USDG micropayments over plain HTTP 402 — no accounts, no API keys, no
subscriptions. hood402 follows the standard x402 protocol
wire format exactly, so it interoperates with the wider x402 client ecosystem, not just its
own client.
Docs: https://github.com/nirholas/robinhood-chain-x402 (the reference pages under
docs/ render from the repo; the hosted docs site is not published
right now, so the repo is the canonical source).
Why EIP-3009, and how we know
USDG (Paxos Global Dollar) is a facet/diamond-router stablecoin. Its base implementation
doesn't expose EIP-3009 directly, but getFacet(bytes4) proves the facet is registered —
verified live against both networks:
npm run verify:usdg
robinhood (chain 4663) — USDG 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
getFacet(transferWithAuthorization) -> 0x780d30b6a89BC9Eef953a543aA288c3B05b01309 [OK]
getFacet(receiveWithAuthorization) -> 0x780d30b6a89BC9Eef953a543aA288c3B05b01309 [OK]
getFacet(authorizationState) -> 0x780d30b6a89BC9Eef953a543aA288c3B05b01309 [OK]
DOMAIN_SEPARATOR() -> 0x7a3d7400b27830f4f91c2c16a082486d67c1befecaec2f53b33f1f35d5b62036
Expected domain: name="Global Dollar", version="1"
robinhood-testnet (chain 46630) — USDG 0x7E955252E15c84f5768B83c41a71F9eba181802F
getFacet(transferWithAuthorization) -> 0x08f560a85db40a7d4ac49b4F44f1D38e5B8aB811 [OK]
...
PASS: USDG EIP-3009 facet registration confirmed on both networks.
The EIP-712 domain separator was reconstructed offline (name="Global Dollar",
version="1") and matches the live DOMAIN_SEPARATOR() on both chains exactly. This is
the load-bearing decision behind hood402: settlement is the standard, gasless
transferWithAuthorization path — the same mechanism USDC uses, and the one x402's exact
scheme is designed around. No custom scheme, no proxy contract, no Permit2 fallback needed.
See Blockscout — mainnet USDG
and docs/index.html for the full write-up.
Install
npm install hood402 viem
Node ≥ 20. To work against an unreleased change instead, install from a checkout:
npm i ../robinhood-chain-x402.
Packages in this repo
| Path | What it is |
|---|
hood402 (this package) | Protocol types, the exact/EIP-3009 scheme, verifyPayment/settlePayment, and the hood402/server + hood402/client subpath exports |
facilitator/ | A standalone, self-hostable facilitator service — /verify, /settle, /supported, /metrics, an idempotent SQLite ledger, and a Dockerfile |
Quickstart — server
import express from 'express'
import { paywall } from 'hood402/server'
const app = express()
app.get('/premium', paywall({
price: '0.01', // USDG
payTo: '0xYourReceivingAddress',
network: 'robinhood', // or 'robinhood-testnet'
facilitator: 'https://your-facilitator.example.com',
}), (req, res) => {
res.json({ data: 'unlocked after a settled USDG payment' })
})
No facilitator? Pass wallet (a viem WalletClient holding a gas key), account, and
reader (a viem PublicClient) instead — the server verifies and settles locally:
import { createPublicClient, createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { robinhood } from 'viem/chains'
import { paywall } from 'hood402/server'
const account = privateKeyToAccount(process.env.FACILITATOR_PRIVATE_KEY as `0x${string}`)
const transport = http('https://rpc.mainnet.chain.robinhood.com')
app.get('/premium', paywall({
price: '0.01',
payTo: '0xYourReceivingAddress',
network: 'robinhood',
wallet: createWalletClient({ account, chain: robinhood, transport }),
account: account.address,
reader: createPublicClient({ chain: robinhood, transport }),
}), (req, res) => res.json({ data: 'unlocked' }))