Skip to main content
Need help? Join the Discord for the assistant and get latest updates.

Technical Architecture Overview

On Prism, X402 is implemented using EIP-3009 compatible tokens and a facilitator service:
  1. Define payment requirements - The seller defines payment requirements (amount, asset, network, expiry, nonce scope)
  2. Sign authorization - The buyer signs an EIP-712 typed transferWithAuthorization payload
  3. Validate and verify - The facilitator validates the signature and checks chain state (nonce status, balances)
  4. Execute on-chain - The facilitator submits an on-chain transaction to the X402 token contract
  5. Distribute funds - After confirmation, the facilitator triggers Spectrum Registry for revenue splitting
This keeps settlement logic and on-chain orchestration in one place while your application stays focused on business behavior.

Component Overview

Wallets

Create and sign EIP-3009/EIP-712 authorizations

Facilitators

Verify and settle authorizations on-chain

Spectrum

Distribute settled amounts according to configured rules

EIP-3009 Explained

The FD X402 Token (fd-x402-coin) supports EIP-3009, which adds gasless, authorization-based transfers to ERC-20:

Core Functions

  • transferWithAuthorization - Transfer tokens based on signed payloads
  • receiveWithAuthorization - Receive tokens based on signed payloads

Authorization Components

Each authorization includes:
{
  "from": "0x...",           // Authorizer address
  "to": "0x...",             // Recipient address
  "value": "1000000",        // Token amount (wei)
  "validAfter": 0,           // Earliest valid timestamp
  "validBefore": 1735689600, // Expiry timestamp
  "nonce": "0x..."           // Unique replay protection
}
The contract tracks authorization state by (authorizer, nonce) so each authorization can only be used once.

Key Properties

Users sign authorizations; facilitators pay gas to execute transfers on-chain
Nonce-based mechanism ensures each authorization can only be used once
validAfter and validBefore timestamps limit authorization lifetime

EIP-712 Signatures

EIP-712 defines how clients sign structured data for authorizations:

Domain Structure

The domain includes:
  • name - Token name
  • version - Contract version
  • chainId - Network chain ID
  • verifyingContract - X402 token contract address

Type Definition

const TRANSFER_WITH_AUTHORIZATION_TYPEHASH = {
  TransferWithAuthorization: [
    { name: "from", type: "address" },
    { name: "to", type: "address" },
    { name: "value", type: "uint256" },
    { name: "validAfter", type: "uint256" },
    { name: "validBefore", type: "uint256" },
    { name: "nonce", type: "bytes32" }
  ]
}
Wallets and agents use this specification to produce signatures that the X402 token and facilitator can verify reliably.

Seller Wallets

Seller wallets must:
  • Hold balances of the X402 token on supported networks
  • Be addressable by the token contract (EOA or smart account)
  • Integrate with treasury and reporting systems

Wallet Types

On Prism, seller wallets can be:

Plain EOAs

Traditional externally owned accounts

Smart Accounts

Managed by Smart Wallet Server

MCP Wallets

Controlled through MCP servers for agentic flows
For agentic scenarios, combine seller wallets with MCP servers (e.g., FD X402 Wallet) so agents can reason about balances and authorizations without direct key access.

Authorization Format

A complete X402/EIP-3009 authorization includes:
FieldTypeDescription
fromaddressAddress authorizing the transfer
toaddressRecipient address
valueuint256Token amount in wei
validAfteruint256Earliest timestamp when valid
validBeforeuint256Expiry timestamp
noncebytes32Unique identifier for replay protection
v, r, sbytesSignature components
The facilitator combines this structured data with the signature to recover the signer and validate bounds.

Settlement Process

The X402 Facilitator settlement pipeline:
1

Receive authorization

Receive the signed authorization payload from client
2

Validate

Validate structure, signature, and temporal bounds
3

Query chain state

Check nonce status and balances on-chain
4

Submit transaction

Submit transferWithAuthorization to X402 token contract
5

Wait for confirmation

Wait for transaction receipt and confirm success
6

Trigger distribution

Call Spectrum Registry with payment metadata to execute distribution
7

Return result

Return deterministic result (success or error) to the caller

Spectrum Registry

Spectrum Registry is the on-chain distribution layer that X402 plugs into after settlement.

What is Spectrum?

Distribution Configurations

Stores configurations that define how payments are split across multiple recipients

Post-Settlement Splits

Executes automated splits when called by the facilitator

How It Works

In a typical X402 flow on Prism:
1

Create configuration

The seller or platform creates a Spectrum configuration with target addresses and weights
2

Reference in payments

X402 payments reference this configuration ID
3

Execute settlement

After transferWithAuthorization succeeds, the facilitator calls Spectrum with payment metadata and configuration ID
4

Distribute funds

Spectrum executes the distribution on-chain and emits events for reconciliation

Implementations

Location: fd-prism-spectrum-evmA Solidity contract with minimal proxy forwarders so each provider gets a unique payment address. Payments sent to that forwarder are automatically received by Spectrum and distributed according to the configured structure.Component Types:
  • Basis points components - Percentage-based splits (e.g., 500 = 5%)
  • Percentage components - Percentage values with decimal precision
  • Fixed amount components - Fixed token amounts to specific recipients per settlement
Location: fd-prism-spectrum-svmA Solana program offering the same fee and distribution model with atomic settlement in a single transaction.Component Types:
  • Basis points components - Percentage-based splits (e.g., 500 = 5%)
  • Percentage components - Percentage values with decimal precision
  • Fixed amount components - Fixed token amounts to specific recipients per settlement
This gives you a cross-chain-consistent way to express platform fees, affiliate payouts, facilitator revenue, and seller proceeds.

Security Model

Key security properties for X402 on Prism:

Replay Protection

Nonce tracking in the token contract ensures each authorization can only be used once

Signature Validation

EIP-712 typed signatures are validated against the token’s domain and types

Time-Bounded Authorizations

validBefore bounds authorization lifetime and reduces exposure

Scoped Facilitator

The facilitator is stateless and focused solely on verification and settlement, reducing attack surface

Spectrum Separation

Distribution logic is isolated from payment execution, simplifying audits and change management
Combine these security properties with robust operational practices:
  • Logging and monitoring
  • Rate limiting
  • Secure key storage
  • Regular security audits

Next Steps