Skip to content

Workshop Recap: Gasless MetaTransactions with OpenZeppelin Defender

Workshop Recap: Gasless MetaTransactions with OpenZeppelin Defender

The workshop was recorded on the 11th February 2021 and led by Santiago Palladino – Lead Developer at OpenZeppelin.

The workshop covers the following:

  • Intro to MetaTransactions
  • How to accept meta-txs in a contract using OpenZeppelin Contracts
  • Relay meta-txs using Defender Autotasks and Relayers
  • Send meta-txs from your dApp

You can watch the video, view the slides, try the demo app and setup your own relayer and app using the code from the workshop.

Why Defender?

Setting up a Relayer in OpenZeppelin Defender automatically generates and stores a private key specifically for your use in a secure vault, so you don’t need to worry about securing keys on your servers.

A Defender Relayer will also automatically pick up the best gas price for your transaction, manage nonce locks, and resubmit your transactions with updated gas prices during network congestion. Relayers also provide high availability by broadcasting your transactions via multiple providers.

Defender Autotasks are serverless functions that work in tandem with Relayers, allowing you to define custom logic for triggering transactions. Autotasks can be triggered via a webhook, allowing you to receive a signed payload from a user, running your logic to decide whether to relay the meta transaction, and easily invoking a Relayer to send it.

This allows you to set up a fully secure, reliable, and highly-available meta-tx engine specific for your application, with no gas fees overhead, and without having to roll out your own infrastructure.



20210211 – Defender meta-txs workshop.pdf

Demo app

You can use the demo app to register a name in the names registry contract using meta-transactions.

  1. Open app:
  2. Connect MetaMask to xDai network and change to xDai network (no xDai required).
  3. Enter a name to register and sign the metatransaction in MetaMask.
  4. Your name will be registered, showing the address that created the metatransaction and the name.

Code for the workshop

The workshop code consists of a sample names registry contract, that accepts registrations for names either directly or via a meta-transaction, along with a client dapp, plus the meta-transaction relayer implementation.

The code can be found in the OpenZeppelin workshops mono-repository:

See the instructions in the repository to run the workshop code.

Learn more

Learn more about OpenZeppelin Defender:
Sign up for free:
Apply for mainnet access:
Ask questions on the community forum: