Discover more from Stackup
How meta-transactions enable a better way to pay for gas
A look into how relayers + smart contract wallets = low friction gas payments.
Imagine you just created a brand new wallet and got paid in USDC for the first time. You then try to spend your USDC at the store but it keeps getting rejected. On further investigation, you realise it’s because your new wallet doesn’t have any ETH to pay for the gas fees. To solve this you’d have to spend the extra effort (and fees) of transferring ETH to your wallet after purchasing it with fiat currency from a centralised exchange.
For the crypto native users, this process may seem obvious by now. But for the billions of potential users still to be onboarded, it’s quite cumbersome and inefficient. For example, most people today would use their credit cards and deal only in one currency. Even if a store doesn’t accept a currency, the conversion would automatically happen in the backend without manual intervention from the user. However it’s not currently that easy in crypto. In order to spend USDC we still need to hold the right amount of ETH to pay for gas. If your reserve of ETH runs out, then you’re effectively blocked from any further transactions until you top it back up again. This forces the user to manually have to deal with two different currencies.
Fortunately there is a solution. Gas-less transactions in combination with smart contract wallets can provide a way so that users don’t have to go through the effort of holding ETH for gas. Instead they could just pay for those transactions with the USDC (or any other currency) in their wallet. This enables a level of user experience where anyone can start using digital currencies without learning the details of an Ethereum transaction. But as usual, the challenge is doing this in a decentralised way that still inherits from Ethereum’s security.
It’s also important to note that a gas-less transaction doesn’t mean a free transaction. At the end of the day, someone has to pay the gas fees which is ultimately required to keep the network secure. Instead a gas-less transaction lets us be more flexible with how the gas is paid.
The current state of Ethereum accounts
There are currently two types of Ethereum accounts, a smart contract account and an externally owned account (EOA). Each EOA is associated with a private key which is used to access all our assets and initiate transactions on the blockchain. At the moment, Ethereum transactions can only be started and paid for by an EOA.
This makes a gas-less transaction a bit more complicated since somewhere in the process there needs to be an account that can initiate and pay for the transaction in ETH, even if that account isn’t ours.
An essential component for smart contract wallets
We can now start to see why gas-less transactions are crucial in enabling smart contract wallets. In this case we are expecting all of our assets to be managed by an on-chain contract. However, as mentioned above, only an EOA can initiate and pay for transactions which is a problem because our funds are now in a different account type. Which means we’ll need to somehow use an EOA with no ETH to invoke our smart contract wallet to carry out an action on the blockchain.
Enter meta-transactions and relayers
To solve this problem we can create a meta-transaction and pass it to a relayer. A meta-transaction is a transaction that has been cryptographically signed by a private key associated with our EOA. The meta-transaction is then sent off-chain to a network of relayers which is able to initiate and pay for the original transaction on our behalf.
The benefit here is that our EOA doesn’t need any ETH to create a meta-transaction. However, the relayer is by no means a free service and needs to be refunded for the gas used. This refund can come from our assets stored on our smart contract wallet. The added benefit here is that we also don’t necessarily have to hold ETH to make the refund. For example we could code logic to swap just the right amount of USDC for ETH and pay that to the relayer when required. This can all be done automatically so that an end user can just transact in USDC without having to worry about keeping their ETH reserves topped up for gas.
Keeping it decentralised
The final piece to this solution is making sure that this system is free from centralisation risks. Fortunately, OpenGSN is the most notable solution to a decentralised relayer network. In the long run, Ethereum upgrades for account abstraction (i.e. EIP-2938) could also make the need for relayers redundant. But until then, relayers are probably our best solution to enabling smart contract wallets and the improved UX that comes with it.