Skip to main content

Architecture (ERC-2771)

This page describes the ERC-2771 proof-of-concept flow as used with Watr testnet-style deployments: a user signs typed data, a relayer pays gas, and the forwarder delivers the call to an ERC-2771-aware recipient contract.

Personas and roles

  • End user (Transaction Signer)
    • Signs an EIP-712 meta-transaction request
    • Does not need to hold the native gas token for the transaction flow
  • Relayer (Gas payer)
    • Holds native gas token
    • Submits execute(...) transactions to the forwarder
  • Trusted forwarder
    • Verifies signature, nonce, and deadline
    • Appends the original sender to calldata and calls the recipient
  • Recipient contract
    • Uses ERC2771Context and _msgSender() to attribute actions to the user

High-level flow

ERC-2771-GaslessMetaTransaction

Key implementation constraints

  • Forwarder domain name must match signing:
    • EIP-712 domain name is part of what the user signs.
    • The signing code must match the forwarder deployment name.
  • Recipient contracts must use _msgSender():
    • Any access control or attribution based on msg.sender must be migrated.

See also

References