Relayers
Use Engine as a relayer to sponsor gas for transactions on behalf of your users. Users sign a transaction with their own wallet (no gas required), and pay gas fees with an Engine backend wallet.
Removing the need for your users to get gas greatly improves the user experience and reach of your dApp.
Enable users to claim, transfer, list, or burn NFTs with no gas. Learn more about gasless transactions.
- Your Engine instance has a backend wallet with funds.
- The target contract must support one of:
*The target contract must trust a forwarder that implements the verify
and execute
methods, like thirdweb's default forwarder (0xd04f98c88ce1054c90022ee34d566b9237a1203c).
- Native to Engine dashboard and select your Engine instance.
- Navigate to the Configuration section.
- Under Allowlisted Domains, enter your application domain(s).
- Include local or development environments for testing.
- Navigate to Engine dashboard and select your Engine instance.
- Navigate to the Explorer section.
- Select Add relayer.
- Provide the following details:
- Chain: The chain where contracts will be called.
- Backend Wallet: The backend wallet that will submit meta-transactions to the forwarder. Ensure this wallet has sufficient gas funds.
- Label: A descriptive name for this relayer.
- Allowed Contracts: (Optional) A list of contract addresses this relayer is allowed to submit transactions to.
- Allowed Forwarders: (Optional) A list of forwarder addresses this relayer is allowed to submit transactions to.
The relayer will be assigned a URL in this format: https://<engine_url>/relayer/<relayer_id>
Use the Connect SDK to prompt the user to sign transactions and send it this relayer.
First wrap your app with <ThirdwebProvider>
:
Next prompt the user to connect a wallet. See ConnectButton for customization options.
This example will call the claim
method on an NFT Drop contract:
Render a <TransactionButton>
to prepare a transaction to be relayed via Engine.
Alternatively submit transactions to your relayer from your backend. This approach allows you to apply server-side validation or business logic before submitting the transaction to be relayed.
-
Prompt the user to sign a transaction.
- This step does not require gas.
- The signature must match the format that the forwarder expects.
-
Call your backend with this signature.
-
Call Engine from your backend:
POST https://<engine_url>/relayer/{relayer_id}