How Biconomy is saving gas fees on Ethereum

Sachin Tomar
Aug 29, 2020 · 6 min read

Other than Defi, by far the most talked-about topic in the space currently is transaction fees on Ethereum. Just by looking at the chart, the spike in fees in the past month makes the CryptoKitties surge of 2017 look like nothing. So much so, that total revenue to Ethereum miners increased over 1,400% this quarter, and miners netted a total of $6 million in transaction fees on August 13th alone!

While the market is waiting for solutions namely, Eth 2.0 and potentially EIP 1559, which allows for more predictable gas fees — Layer 2 solutions are one of the main ways to reduce the gas fee burden. At Biconomy, we deploy and manage scalable meta transaction relayer infrastructure that is compatible with any Layer 1 and Layer 2, and since we support Ethereum and experiencing the high gas fees that come along with it, we took it upon ourselves to tackle this issue!

Within our relayer infrastructure, we have been integrating the following strategies to optimise for gas:

  1. Relaying multiple transactions together in batches
  2. Implementing strategies to buy gas futures via gas token that can result in upto 50% saving in gas when prices go insane
  3. Play the system, i.e. pay the minimum optimal gas price to get your transaction included in the next block

We make heavy use of the latter and feel it’s an underappreciated technique, especially as most people just use the fastest gas price or even overpay in terms of gas price to get their transactions to settle faster on the blockchain.

We believe you should never overpay for your transactions and we are implementing the above measures to save gas on all Biconomy enabled transactions.

Just the right gas

Over the past three months since our beta launch, we’ve been honing in our strategy on how to optimally pay gas fees whilst ensuring they settle quickly on-chain. We’ve been mainly supporting high profile projects such as Curve Finance and Idle Finance where these applications have been benefiting from an efficient transaction highway that sets optimal gas prices that do not overcharge developers for their meta transactions.

Our gas price optimisation algorithm got battle-tested when #Yam farmers went ham. We were able to set gas prices 109 gwei lower than the average during this period — saving tons of Ether. Most overpaid transactions came largely from well known and influential exchanges — who would pay anything to have their transactions mined.

At Biconomy, we decide the gas price in a simple yet more efficient way. We send the transaction with the medium speed gas price taken from multiple gas oracles and monitor it. If the transaction is not included in a block within a certain time period, we bump up gas price. We strive to ensure transactions are included within 2 minutes once initiated (more data on this below).

This approach allows us to save some gas when compared to other transactions which always tend to overpay. More importantly, it really alleviates the impacts of gas wars on-chain. We are continuously improving our gas optimisation algorithm by looking at new ways of doing it. For example, through various machine learning models built on historical transaction data.

Beating fast gas prices 💪

The data below compares Biconomy transactions with the 2nd, 3rd, and 4th highest gas price transactions within the same block.

Here are our findings which you can verify on-chain too.

We did not compare with the highest gas price transaction in the block as there are some transactions with an exceptionally high gas price, like this transaction https://etherscan.io/tx/0x5570cdb6fd4eb3a5376936c334d2b03e300aa99550a1e0f3fa2af22f6ec8514d This transaction paid 2431 Gwei 😳 which would not be fair for the comparison.

And How about transaction confirmation times?

On average, transactions relayed by Biconomy in the 99th percentile take 65 seconds and transactions in the 90th percentile take 23 seconds to get included in the block.

Why is all this important?

Not only are we saving tons of money, our techniques reduce the amount of stuck transactions during highly congested periods. Getting it right both ways is crucial, both for seasoned DeFi experts trading on time-critical opportunities and low margins; and new users, who’d be put off by high fees.

We’ve all been there, when we’ve been frustrated with setting low gas fees and having to deal with a stuck transaction. With Biconomy we do not only guarantee transactions won’t get stuck but guarantee they’ll settle within our predefined intervals.

An user transactions got stuck and ultimately reverted because of deadline and price change

Ultimately, sending transactions quickly and at a reasonable price has become quite difficult even making wallets such as Argent who recently announced that they will be stopping the subsidization of user gas fees. This is a problem because meta transactions have proven to increase users on a platform, increase retention, and ultimately provide seamless experiences.

How much further can Biconomy save gas fees?

Although we believe gas prices will be super low in the future, we have been increasingly fine-tuning various gas optimization methods to not just enable meta transactions at scale, but also reduce gas fees in general — as usage and demand of the network grows. What is important to note is that with Biconomy’s relayers, there is no gas overhead, making it extremely efficient.

Optimally picking the right gas fee and bumping up the gas is one piece of a bigger puzzle. Through some cool techniques we’re currently testing internally, we reckon we could increase gas cost savings to up to 50%.

Next in our pipeline is transaction batching on smart contracts where we leverage our relayer infrastructure to significantly reduce the gas cost for ERC 20 transactions. We have been continuously performing internal tests and finding gas fees can be saved up 50% using batching. Here are some of the stats:

We’re super excited to be rolling out these additional savings in the coming weeks/months — so watch this space! We definitely do not want to see these gas prices again:

Follow us on twitter and join our telegram channel to get the latest updates.

Appendix

We extracted above data from the following ethereum blocks:

10654896, 10654819, 10654724, 10654648, 10640807, 10637791, 10637315, 10636740, 10635266, 10634287, 10655918, 10655194, 10655059, 10654907, 10654735, 10654565, 10654012,10628824, 10655002, 10654977, 10654957, 10654931, 10654923, 10654895, 10654722, 10654720, 10654695, 10661223, 10661168, 10656895, 10654924, 10654886, 10654447

Biconomy

Simplifying Web 3 Experiences