Skip to main content
The b402 Relayer is the smart contract that enables gasless token payments across EVM chains. It verifies EIP-712 signatures and executes authorized token transfers, with the facilitator paying gas on behalf of the user. The Relayer is deployed on each supported chain (currently BNB Chain and Base).

How It Works

  1. User signs off-chain. The user signs an EIP-712 TransferWithAuthorization message specifying the token, amount, recipient, nonce, and time window.
  2. Facilitator relays on-chain. The facilitator submits the signed authorization to the Relayer contract’s transferWithAuthorization() function and pays the gas.
  3. Contract executes transfer. The Relayer verifies the signature, checks nonce uniqueness and time constraints, then calls transferFrom() on the token contract.

Contract Interface

The Relayer exposes three functions:
// Execute a signed token transfer
function transferWithAuthorization(
  address token,
  address from,
  address to,
  uint256 value,
  uint256 validAfter,
  uint256 validBefore,
  bytes32 nonce,
  bytes signature
) external;

// Check if a nonce has been used
function authorizationState(
  address from,
  bytes32 nonce
) external view returns (bool);

// Check if a token is whitelisted
function isTokenWhitelisted(
  address token
) external view returns (bool);

EIP-712 Domain

The Relayer uses this EIP-712 domain for signature verification:
{
  "name": "B402",
  "version": "1",
  "chainId": 56,  // Use 8453 for Base
  "verifyingContract": "0xE91b564EB8DFF305Ff8efA332f84c487b9da5171"
}
For Base, use chainId: 8453. The Relayer address is the same on all supported chains.

Security Features

Nonce-based replay protection. Each nonce (random bytes32) can only be used once per signer. The Relayer tracks used nonces and rejects duplicates. Token whitelisting. Only approved tokens can be transferred through the Relayer. This prevents unauthorized token interactions. Signature verification. The Relayer recovers the signer from the EIP-712 signature and verifies it matches the from address.

Contract Addresses

ContractAddressNetwork
B402 RelayerV30xE91b564EB8DFF305Ff8efA332f84c487b9da5171BNB Chain Mainnet
B402 RelayerV30xE91b564EB8DFF305Ff8efA332f84c487b9da5171Base Mainnet

Prerequisites for EOA Users

Before making a payment through the Relayer, the user must approve the Relayer contract to spend their tokens:
// One-time approval per token
const token = new Contract(USDT_ADDRESS, ['function approve(address,uint256) returns (bool)'], wallet);
await token.approve(RELAYER_ADDRESS, ethers.MaxUint256);
This approval only needs to happen once per token. After approval, all future payments through the Relayer are gasless for the user. Smart wallet users do not need this step. Approvals are batched into the UserOperation.