EIP-712 Signatures

MetaTxGateway uses the EIP-712 standard for secure, structured meta-transaction signing. This ensures signatures are valid, replay-protected, and compatible with wallets.

EIP-712 Domain

EIP712Domain(
    string name,      // "MetaTxGateway"
    string version,   // "1"
    uint256 chainId,  // Network chain ID
    address verifyingContract // Contract address
)

MetaTransaction Type

MetaTransaction(
    address to,
    uint256 value,
    bytes data
)

Batch MetaTransactions Type

MetaTransactions(
    address from,
    MetaTransaction[] metaTxs,
    uint256 nonce,
    uint256 deadline
)

Signing a Batch (Frontend Example)

Signature Verification (Contract)

The contract verifies the signature using the EIP-712 domain and the batch data. The signature must match the from address and current nonce.

Security

  • Nonce and deadline prevent replay attacks.

  • Only the user who signed the batch can authorize execution.

  • All meta-transactions in the batch are covered by a single signature.


Related Topics:

Last updated