DocsGasless messaging

Docs/How it works

Gasless messaging

How a message gets on-chain without you paying gas.

The flow#

  1. 1

    You sign

    Your wallet signs an EIP-712 ForwardRequest describing the exact contract call.
  2. 2

    The app relays

    The app posts the request and signature to its relayer at /api/relay.
  3. 3

    The Paymaster submits

    The relayer calls Paymaster.relay(), which runs the request through the Forwarder.
  4. 4

    The Forwarder checks

    It verifies your signature and nonce, then calls Scarf with your address attached.
  5. 5

    Scarf records it

    It reads you as the sender (ERC-2771), stores the message and emits MessageSent.

The signed request#

FieldMeaning
fromYour address.
toThe Scarf contract.
valueETH sent with the call (for ETH payments).
gasGas limit: an estimate plus 80,000.
nonceYour next Forwarder nonce. A request can only run once.
dataThe encoded call, such as sendMessage(…).

Because the signature covers every field, a relayer can't change the message, the recipient or the amount, and can't replay it.

Who pays#

The relayer pays the gas, and the Paymaster refunds it a fixed amount per message from its own balance: RELAYER_REIMBURSEMENT_WEI (0.00005 ETH by default), capped by the Paymaster's maxReimbursementPerTx (0.01 ETH by default). Anyone can top up the Paymaster with deposit() or a plain transfer.