DocsRelayer API

Docs/Developers

Relayer API

The endpoint the app uses to submit signed requests.

Request#

The app signs a ForwardRequest in the browser and posts it here. All numbers are sent as strings.

HTTP
POST /api/relay
Content-Type: application/json

{
  "request": {
    "from": "0xYourAddress",
    "to": "0x0382…AE43 (Scarf)",
    "value": "0",
    "gas": "214000",
    "nonce": "7",
    "data": "0x…encoded sendMessage(…)"
  },
  "signature": "0x…EIP-712 signature"
}

If gas is "0" or missing, the relayer estimates it and adds 80,000. With a Paymaster configured it calls Paymaster.relay(); otherwise it calls Forwarder.execute() directly and pays the gas itself.

Response#

200 OK
{ "hash": "0x…transaction hash" }

The relayer waits for the transaction to be mined before responding.

Errors#

StatusBodyCause
400Invalid JSONThe body isn't valid JSON.
400Missing request or signaturefrom, to, data or the signature is missing.
503Relayer not configured (RELAYER_PRIVATE_KEY)The server has no relayer key.
503Forwarder not configuredNo Forwarder address is set.
500The error messageThe transaction reverted, for example a bad signature or an unregistered recipient.