Onboarding new users to Ethereum today is like dumping someone in a foreign country and expecting them to find their way around. The language doesn’t make any sense and getting seemingly basic things done often requires long explanations from a friend who has been around the block.
There’s an intimidating learning curve that needs to be tackled by new users aiming to perform basic actions like purchasing a token on an exchange like Uniswap. If we want to onboard the world to Ethereum, the experience needs to feel familiar to average people.
One of the most difficult and scary concepts for new Ethereum users to understand is “gas”.
“What is gas? Is it different than Ether? How is the total gas calculated? Why would I pay a high gas price vs a low gas price? Am I paying too much? Too little?”
Expecting new users to learn the implications of gas price on their transactions before ever using Ethereum is out of the question. MetaMask, one of the leading wallets on Ethereum, has made a step in the right direction by hiding the concept of gas in their advanced options.
Users understand what a transaction fee is and showing them a range of fees along with their speeds is a great way to communicate to the user that a higher fee means a faster transaction. This allows the user to choose the best gas price for them without sending them down the proverbial “rabbit hole” to figure out what gas is. But why do we have to present the user with a choice at all? Can’t the best gas price be chosen for them?
MetaMask’s solution to abstract away gas works decently well under normal network conditions but breaks down when the network gets congested. The reason transaction fees are not hidden from the user outright is that choosing the wrong fee can have fairly serious consequences. Picking too low of a gas price can mean your transaction will remain pending for hours, days, or even indefinitely but using too high of a gas price is a waste of the user’s hard-earned money.
The gas price needs to be high enough for the transaction to get mined in a reasonable amount of time but not too much higher than that. With constantly fluctuating gas prices, transactions getting stuck due to inadequate fees are inevitable and present an entirely new user experience problem to solve.
MetaMask solves this problem by allowing users to sign new transactions with higher and higher gas prices until the transaction gets mined. At this point, though, the abstraction is broken. The user has been presented with a screen labeled “Customize Gas” and now must become familiar with the intricacies of how gas works to understand why their transaction is frozen and how changing the gas price will help get it unfrozen.
Worst of all, the user’s wallet is completely disabled until the issue is resolved. If we want to truly abstract gas away from the user, we must be able to get transactions mined at competitive rates without disrupting the user with frozen transactions.
Transaction Spectrum Signing
Luckily, it’s possible to take advantage of some of Ethereum’s transaction mechanics to achieve exactly that. Instead of users signing single transactions, wallets can move to a model where users sign multiple transactions with a spectrum of gas prices (e.g. 1 Gwei, 2 Gwei, 4 Gwei, 8 Gwei, 15 Gwei, 20 Gwei). The transactions should be identical in every other way but the gas price. This can be done after a single transaction approval from the user. The Ethereum protocol guarantees that only one of these transactions will succeed because the transactions all share the same nonce and are from the same user. On top of that, if multiple transactions with the same nonce are all submitted simultaneously, only one will be processed and the rest will simply be purged from the transaction pool without ever costing the user a cent wei.
Now that the wallet has a spectrum of gas prices pre-approved, the wallet can find the best price for the user by broadcasting transactions with higher and higher gas prices automatically until the transaction is successfully mined.
Best of all, transactions will only get frozen if the absolute maximum gas price a user is willing to pay is still too low for the current market conditions. Users should be willing to set fairly high maximum gas price though because the user knows the wallet will still try to get the best gas price possible. This is all done without making any sacrifices regarding the decentralization of the wallet. We call this technique “Transaction Spectrum Signing”.
Gas Spectrum Transactions as Meta Transactions
This technique is not only limited to browser based wallets like MetaMask, but could be implemented in hardware wallets and even with “meta transactions”. The concept of meta transactions is an emerging design pattern that takes advantage of signed messages in order to separate the party making the transaction from the party paying for it. A community has formed around the idea, largely spearheaded by the unrelenting work of the MetaCartel. There are also a handful of talented teams working on bringing meta transactions into production including TabooKey, Zeppelin, Burner Wallet, Universal Login, Abridged, Portis, Pillar, and Groundhog. A full explanation of meta transactions is out of the scope of this blog post but to learn more, check out Austin Griffith’s excellent explanation here.
Meta transactions are paid for by a party called the “relayer”. The relayer takes the transaction data and packages it into an actual Ethereum transaction from the relayer’s account. Meta transactions provide several advantages over regular transactions such as allowing the user to pay fees in tokens other than ETH and enabling users to hold their funds in contracts rather than keys. However, relying on a single relayer to make transactions would make for a very centralized system. Members of the TabooKey team very cleverly solved the problem of relaying meta transactions in a decentralized way and are launching the Gas Station Network in partnership with Zeppelin.
In the Gas Station Network, users choose from a network of relayers to create their transaction. It’s important for a user to know if a relayer will in fact make their transaction so, on top of the relayer broadcasting the transaction, they return it to the user to be verified and possibly re-broadcasted. This model presents some interesting problems when an inadequate gas price is used though. In order for a user to increase the gas price of a frozen transaction they must either 1) get a second transaction created by the same relayer (assuming they’re still available) or 2) broadcast a new transaction from a different relayer causing the original transaction to revert and wasting the original transaction fee.
Gas Spectrum Transactions can be introduced to the Gas Station Network model as well. Users can request transactions with a full spectrum of gas prices from the relayer up front including a transaction to simply cancel the intended action. The relayer’s reward could slightly decrease as the gas price increases to disincentivize the relayer from simply broadcasting the transaction with the highest gas price. Then, software on the user’s side can find the best gas price for the user without relying on the relayer to be responsive. Also, a user would be able to cancel a pending transaction without the relayer’s permission and without causing transaction fees to go to waste. All of this can be done without putting any additional risk on the user or the relayer because only one transaction in the spectrum will ever be mined.
If we want to onboard mainstream users to Ethereum, we need to provide users with familiar experiences that don’t require technical knowledge or difficult decisions. Only advanced users in rare circumstances should be exposed to gas and Gas Spectrum Transactions allow us to do exactly that. At Authereum, we plan on using Gas Spectrum Transactions to completely abstract gas away from users while still keeping their transaction costs low. We would love to see this become an industry standard and bring Ethereum one step closer to mainstream adoption.
Many thanks to Miguel Mota and Shane Fontaine for helping put this together. We’re a group of engineers focused on rethinking how users interact with Ethereum. To hear more about more solutions like this you can follow us here on Medium, follow us on Twitter @authereum, or subscribe to our mailing list. To get in touch with me personally, you can find me on Twitter @whinfreychris.