v1.0 Beta·EIP-712 + EIP-7702

Q402 Developer Docs

Everything you need to add gasless USDC payments to your product. One API, wallet-authenticated trial access, and zero gas for your users across live relay chains, plus Avalanche beta access by inquiry.

Overview

Q402 is a gasless transaction relay for EVM chains. Your users send USDC without ever needing BNB, ETH, or OKB for gas on live relay chains. You integrate one API. The rest is invisible. Avalanche is available as a beta onboarding track by inquiry.

What is an API?

An API is just a URL your server calls. Like ordering food at a restaurant — you send a request ("here's a user's signed transaction"), Q402's server handles the work, and sends back a result ("done, txHash: 0xabc..."). No blockchain expertise needed on your end.

Protocol
EIP-712 + EIP-7702
Settlement token
USDC · USDT
Gas source
Your gas pool

How It Works

Three actors. One transaction. Zero gas for your users on live relay chains, with Avalanche beta requests handled manually.

A
User signs an authorization (no gas, no blockchain)
Using their wallet (e.g. MetaMask), the user signs a typed message saying "I allow transferring X USDC to address Y". This is purely a cryptographic signature — no transaction is sent, no gas is needed.
B
Your server calls POST /api/relay
You pass the user's signature to Q402's API. That's it — one HTTP call. Q402 verifies the signature, checks your gas tank, constructs the on-chain transaction, and submits it.
C
Gas is deducted from your gas pool, USDC lands in recipient wallet
Q402 uses your pre-funded gas pool to pay the network fee. The USDC moves on-chain, verifiable on BscScan / Etherscan / OKLink. User sees zero gas cost.
// Full flow
User wallet → signs EIP-712 → your frontend
Your backend → POST /api/relay → Q402 API
Q402 → uses gas pool → on-chain TX
Chain → confirms TX → recipient gets USDC

Quick Start

Get your first gasless transaction running in under 5 minutes.

0 · Start the free trial

json
// From the dashboard
// 1. Connect your wallet
// 2. Click "Authenticate Wallet"
// 3. Sign the challenge message
// 4. Copy the current trial API key to your backend only

1 · Load the SDK

html
<script src="https://q402.io/q402-sdk.js"></script>

2 · User signs (client-side, zero gas)

javascript
const q402 = new Q402Client({
  chain: "bnb", // "bnb" | "eth" | "xlayer"
});

const prepared = await q402.preparePayment({
  to: recipientAddress,
  amount: "50",
  token: "USDC",
});
// Send "prepared" to your backend. Do not store your API key in the browser.

3 · Submit from your backend

typescript
// POST to Q402 relay — Q402 handles the rest
const res = await fetch("https://q402.io/api/relay", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    apiKey: process.env.Q402_API_KEY,
    ...prepared,
  }),
});
const data = await res.json();
// { success: true, txHash: "0xabc123...", chain: "bnb", blockNumber: "38482910" }
Tip
That's the full integration. The user never touches BNB, ETH, or OKB. Gas is deducted from your pre-funded gas pool automatically, and your API key stays on your backend.

Gas Pool

Q402 uses a gas pool model for live relay chains. You deposit native tokens (BNB, ETH, OKB) into the Q402 relayer address shown in the dashboard. Every relayed transaction debits actual native gas from the wallet-linked tank.

Deposit

Send native tokens (BNB / ETH / OKB) to the relayer address shown in your dashboard. Balances are tracked against the wallet that authenticated the current trial key.

Preflight + auto-deduction

Before broadcast, Q402 estimates the native gas cost for the specific chain, applies a safety margin, and rejects the relay if your tank would fall short. Successful relays deduct the actual gas cost afterward.

Verification

After sending funds, paste the native transfer transaction hash into the dashboard to claim the deposit. Self-serve withdrawals are currently disabled while the safer flow is being rebuilt.

Important
If your gas pool is empty, transactions will fail. Deposit from a supported wallet, then claim the confirmed transfer by transaction hash in the dashboard. Avalanche beta requests do not use this self-serve gas pool flow.

Authentication

All relay requests require your API key in the apiKey field of the request body. Keep that key on your backend only. Trial access is wallet-authenticated: connect your wallet in the dashboard, request a challenge, sign it, and reveal the current API key for that wallet.

json
// POST /api/auth/challenge
{
  "address": "0xYourWallet..."
}

// Response
{
  "message": "Sign this message to start your Q402 free trial. ...",
  "expiresIn": 600
}
json
// POST /api/keys/provision
{
  "address": "0xYourWallet...",
  "signature": "0xSignedChallenge..."
}

// Response
{
  "apiKey": "q402_live_YOUR_API_KEY",
  "plan": "trial",
  "isNew": true
}
json
// POST /api/relay
{
  "apiKey": "q402_live_YOUR_API_KEY",
  "chain":  "bnb",
  "token":  "USDC",
  ...
}
json
// POST /api/gas-tank/verify-deposit
{
  "apiKey": "q402_live_YOUR_API_KEY",
  "chain": "bnb",
  "txHash": "0xDepositTransactionHash..."
}
q402_live_*
Production key. Transactions hit mainnet. Keep this key private — it is tied to your gas tank.

API Reference

Base URL: https://q402.io/api

POST/auth/challenge

Generate a short-lived challenge message for a wallet. The client signs the returned message with personal_sign.

POST/keys/provision

Verify the signed challenge and reveal the current API key for that wallet, or provision a new trial key if none exists yet.

POST/relay

Submit a signed EIP-712 + EIP-7702 payload. Q402 verifies the signature and relays the transaction on-chain using your gas pool.

json
// Request body
{
  "apiKey":      "q402_live_YOUR_API_KEY",
  "chain":       "bnb",            // bnb | eth | xlayer
  "token":       "USDC",           // USDC | USDT
  "from":        "0xUserWallet...",
  "to":          "0xRecipient...",
  "amount":      "50000000",       // atomic units (6 decimals = 50 USDC)
  "nonce":       "0",              // sequential user nonce in delegated storage
  "deadline":    1751289600,
  "witnessSig":  "0xabc123...",
  "authorization": { ... }         // EIP-7702 authorization object
}

// Response 200
{
  "success":        true,
  "txHash":         "0xdef456...",
  "chain":          "bnb",
  "blockNumber":    "54540550",
  "tokenAmount":    50,
  "gasCostNative":  0.000021,
  "method":         "eip7702"
}

// Response 402
{
  "code":                   "GAS_TANK_INSUFFICIENT",
  "error":                  "Insufficient gas tank on eth. Deposit more native gas before relaying this payment.",
  "chain":                  "eth",
  "availableBalanceNative": "0.00031",
  "estimatedGasNative":     "0.00041",
  "requiredBalanceNative":  "0.00075",
  "recommendedTopUpNative": "0.00044"
}
POST/gas-tank/verify-deposit

Claim a native-token gas deposit with the exact transaction hash. The sender wallet must match the wallet linked to the provided API key.

json
// Request body
{
  "apiKey": "q402_live_YOUR_API_KEY",
  "chain": "bnb",
  "txHash": "0xDepositTransactionHash..."
}

// Response 200
{
  "credited": true,
  "message": "Deposit claimed and credited to your gas tank.",
  "balances": {
    "bnb": 0.125
  },
  "deposit": {
    "chain": "bnb",
    "token": "BNB",
    "amount": 0.125,
    "txHash": "0xDepositTransactionHash..."
  }
}
GET/relay/info

Returns the relayer (facilitator) wallet address. Required for SignatureBasedExecutorV2 signing on every live 7702 chain (`bnb`, `eth`, `xlayer`) — include this address in your EIP-712 payload before submitting.

json
// GET /api/relay/info
{ "facilitator": "0xRelayerAddress..." }

Chain Support

Same API and signing model across live relay chains. Avalanche stays visible as a beta onboarding path, but it does not use the standard Q402 self-serve relay flow today.

Chainchain paramChain IDStatusAvg gas/tx
BNB Chain
bnb56Mainnet Live~$0.001
Ethereum
eth1Mainnet Live~$0.19
X Layer
xlayer196Mainnet Live~$0.001
Avalanche
avax43114BetaInquiry only
Arbitrum
arbitrum42161Coming Soon
Scroll
scroll534352Coming Soon
Note
Gas costs are deducted from your gas pool on live relay chains, not from Q402's pocket and not from your users. Relay preflight estimates required native gas per chain before broadcast. Avalanche remains available as a beta inquiry-only path because it does not currently support the standard Q402 / EIP-7702 self-serve relay flow.

EIP-712 Signing

Q402 uses EIP-712 typed structured data signing — the same standard used by Uniswap, Compound, and major DeFi protocols. The user signs a human-readable message. No gas. No blockchain interaction.

Domain Separator

typescript
// Contract addresses per chain
const CONTRACTS = {
  bnb:    "0x2Eb0c999Ac01098Da44763Aa7E87479d905ecdC7",
  eth:    "0x2Eb0c999Ac01098Da44763Aa7E87479d905ecdC7",
  xlayer: "0xf3eDaCAa8A247B8B8F898FAFA5AEd8E161ADc72a",
};

// SignatureBasedExecutorV2 uses a fixed domain across live chains
const domain = {
  name:              "SignatureBasedExecutorV2",
  version:           "2",
  chainId:           56,              // 1=ETH, 56=BNB, 196=X Layer
  verifyingContract: CONTRACTS.bnb,
};

Type Definition

typescript
const types = {
  TransferAuthorization: [
    { name: "owner",       type: "address" },
    { name: "facilitator", type: "address" },
    { name: "token",       type: "address" },
    { name: "recipient",   type: "address" },
    { name: "amount",      type: "uint256" },
    { name: "nonce",       type: "uint256" },
    { name: "deadline",    type: "uint256" },
  ],
};

Signing with ethers.js

typescript
const signature = await signer.signTypedData(domain, types, {
  owner:       userAddress,
  facilitator: relayInfo.facilitator,
  token:       usdcAddress,
  recipient:   recipientAddress,
  amount:      ethers.parseUnits("50", 6),
  nonce:       currentNonce,
  deadline:    Math.floor(Date.now() / 1000) + 3600,
});
Note
EIP-7702 note: BNB Chain, Ethereum, and X Layer share the same SignatureBasedExecutorV2 relay path. Avalanche beta access is handled separately by inquiry and does not use this standard self-serve path today.

Error Codes

Errors currently return an HTTP status plus a JSON body with a stable code and human-readable error. Handle the status code first, branch on code, and log or surface the message string.

401
API_KEY_REQUIRED
The request omitted apiKey where one is required.
401
API_KEY_INVALID
The key does not exist or has already been deactivated.
401
API_KEY_ROTATED
The key is no longer the current key for the wallet subscription.
403
SUBSCRIPTION_EXPIRED
The current subscription window has expired.
400
CHAIN_UNKNOWN
The chain parameter is missing or not one of avax / bnb / eth / xlayer.
400
CHAIN_UNSUPPORTED
The chain is visible in product messaging but not currently live for institutional relay.
400
TOKEN_UNSUPPORTED
Only USDC and USDT are accepted on supported chains.
400
ADDRESS_INVALID
The payer address is missing or malformed.
400
RECIPIENT_INVALID
The recipient address is missing or malformed.
400
AMOUNT_INVALID
The amount is missing, malformed, or negative.
400
AMOUNT_TOO_LOW
The amount is zero when zero-value relay is not allowed.
400
NONCE_INVALID
The delegated storage nonce is not an integer string.
400
DEADLINE_INVALID
The deadline is missing or invalid.
400
WITNESS_SIG_INVALID
The EIP-712 witness signature is missing or not valid hex.
400
AUTHORIZATION_REQUIRED
The request omitted the EIP-7702 authorization object or delegated nonce.
400
AUTHORIZATION_TARGET_INVALID
The authorization target is not a valid address.
400
AUTHORIZATION_TARGET_MISMATCH
The authorization target is not the approved implementation for this chain.
400
AUTHORIZATION_CHAIN_MISMATCH
The authorization chainId does not match the requested chain.
400
AUTHORIZATION_NONCE_INVALID
The authorization nonce is not a non-negative integer.
400
AUTHORIZATION_YPARITY_INVALID
The authorization yParity is not 0 or 1.
400
AUTHORIZATION_SIG_INVALID
The authorization r/s fields are missing or not 32-byte hex values.
402
GAS_TANK_INSUFFICIENT
Q402 estimated the relay cost, applied a chain-specific safety margin, and found your tank below the required native balance.
400
RELAY_FAILED
The relay reached chain submission but the transaction failed or reverted.
503
RELAYER_UNAVAILABLE
Q402 could not complete relay preflight or submission because relayer infrastructure was unavailable.
400/409/500
DEPOSIT_TX_INVALID
The supplied native deposit transaction hash cannot be claimed for the current wallet session.

FAQ

Do users need BNB, ETH, or OKB to use Q402?
No. Users only need USDC (or USDT) in their wallet. All gas is paid from your gas pool. The user signs a message — that's it.
How does Avalanche access work today?
Avalanche is available as a beta inquiry-only path. Because Avalanche does not currently support the standard Q402 / EIP-7702 self-serve relay flow, access is reviewed manually instead of being enabled directly from the dashboard.
Who pays the gas fees?
You do — from your gas tank. Deposit native tokens from the dashboard, claim the confirmed transfer by transaction hash, and Q402 auto-deducts the exact gas cost per transaction.
Is Q402 non-custodial?
Yes. Q402 never holds user funds. The EIP-712 signature authorizes exactly one transfer from A to C. Q402 only pays gas and relays — it cannot redirect or intercept USDC.
What if a transaction fails?
If relay fails, the payload is discarded and no user funds are moved. Check the error code in the API response — common causes are insufficient gas tank balance or an expired deadline.
Can I use Q402 with tokens other than USDC?
Currently USDC and USDT are supported on all live chains. Additional ERC-20 token support is on the roadmap.
How do I get an API key?
Open the dashboard, connect your wallet, click Authenticate Wallet, and sign the challenge message. Q402 then reveals the current API key for that wallet, or provisions a new trial key if one does not exist yet.
Are Arbitrum and Scroll live?
Not yet. Arbitrum and Scroll support is coming soon.

Ready to start the free trial?

Connect your wallet, sign the challenge, and reveal your current API key without leaving the dashboard.

Talk to us