Note
Gasless service is a premium feature in limited release. If you're interested in this feature, contact your Customer Success Manager.
Ethereum and gas fees
On Ethereum-based chains, any transaction that alters the state of the public ledger, such as transferring tokens, deploying smart contracts, or interacting with dApps, requires a fee known as gas. Gas fees ensure users pay for the computational resources their transactions consume.
Gas fees are essential for:
- Compensating validators: Miners and validators are rewarded with gas fees for using their resources to validate and secure the network.
- Preventing spam: Attaching a cost to transactions discourages spamming and excessive network load.
- Prioritizing transactions: Users can opt to pay higher gas fees for quicker transaction processing during high network congestion.
Gas fees vary based on the complexity of a transaction, with simple transfers costing less and smart contract deployments costing more. This fee structure sustains Ethereum's decentralized, secure nature by incentivizing participants to contribute processing power.
Learn more about Ethereum's gas fees and how they are handled in Fireblocks.
Gasless transactions on Ethereum
Gasless transactions allow users to broadcast transactions to the Ethereum network through an intermediary instead of paying for gas from their own wallets. On Ethereum, this is facilitated through standards, such as ERC-3009 or ERC-2771, which draft options for intermediaries to express transactions on behalf of the user to enable seamless interactions.
Gasless transactions come with several significant advantages that enhance user interactions within blockchain ecosystems:
- Improved User Experience: Users can interact with blockchain protocols without the friction of managing gas fees, making the process smoother and more intuitive.
- Increased Accessibility: By removing the need for users to hold ETH for gas, gasless transactions lower the entry barrier and enable more users to participate in blockchain activities.
ERC-2771 for gasless tokenization
Fireblocks uses ERC-2771 to allow you to deploy gasless contracts for your tokenization activities. ERC-2771 uses the following components:
- User: The initiator of the transaction who signs the message.
- Trusted Forwarder: The intermediary contract that verifies and forwards the signed transaction.
- Target Contract: The contract that processes the forwarded transaction and authenticates the sender’s identity using the appended data.
Trusted forwarders
ERC-2771 introduces the concept of trusted forwarders, which are intermediary contracts that handle user transactions before forwarding them to the target contract. This standard ensures that the target contract can verify the identity of the original sender, even though the transaction is forwarded by the intermediary.
Key points include:
- User Authentication: The target smart contract can authenticate users as if they were directly interacting with it, even though the transaction is forwarded.
- Structured Gasless Interactions: ERC-2771’s framework standardizes transaction forwarding, making it an efficient solution for gasless dApp interactions.
Differences between ERC-3009 and ERC-2771
- ERC-20 transfer focus: ERC-3009 is designed to facilitate gasless ERC-20 token transfers, enabling relayers to submit signed user intents while supporting flexible compensation models. However, it does not incorporate a trusted forwarder setup.
- Trusted forwarder framework: ERC-2771 provides a straightforward mechanism for appending and reading the sender’s address in forwarded transactions, streamlining gasless execution.
Gasless contract flow
- User Signing: The user signs the transaction message with their private key, specifying the function and parameters they want to execute on the target contract.
- Off-chain Forwarder: The signed payload is sent to an off-chain wallet or service that holds gas (ETH). It prepares the transaction by appending the signed payload to the forward request. This forward request is sent to the trusted forwarder contract.
- Forwarder Verification: The signed message is part of a call to the trusted forwarder contract, which verifies the signature's authenticity.
-
Transaction Forwarding: The forwarder contract then communicates the transaction to the target contract and appends the original sender’s address to the msg.data. The target contract must understand ERC-2771.
Important
The target contract must trust the forwarder address. Otherwise, malicious forwarders could submit fraudulent transactions to the target contract that may cause loss of funds. For this reason, Fireblocks only uses its own trusted forwarder contract.
- Processing by Target Contract: The target contract processes the transaction, extracts the original sender’s address, and verifies that the forwarder is trusted by checking its address against a pre-approved list.
Who really pays for gas?
A common misconception is that no gas fees are paid at all during gasless transactions. In reality, gas fees are still required for transactions to be executed on the Ethereum network. Although the original sender does not directly pay for the gas, the cost is covered by another party such as:
- Relayers: Third-party relayers often pay gas fees on behalf of the user and may be reimbursed through alternative methods, such as token-based compensation.
- Operators: In some cases, the dApp or a specialized service provider covers the gas fees to create a seamless user experience.