Why are blockchain transaction fees not fixed?

published on 28 June 2024

Popular credit card or bank providers charge constant fees on transactions. Prominently, Stripe charges 2.9% + $0.30 for making a transaction. Why are blockchain transaction fees so much more complex, and why do I have to pay $20 to transfer ETH on Wednesday afternoon, while I can get a $3 transaction fee on Friday morning?Let’s take a step back and talk about physical limitations:

  1. Network Limitations: When you send a transaction from Berlin, your transaction needs to propagate globally to a number of validators. These could be in Singapore, New York, and London. It would take 3 milli-seconds for the network-packet to just arrive in Singapore. Blockchains are much more complex than that though, in that multiple validators need to simulate your transaction. This means that after your transaction ends up in Singapore, it will need to propagate further to New York, and London. Each network roundtrip latency only adds further waiting-time for your transaction to be executed.
  2. Computational Limitation: Blockchain validators ensure decentralization by simulating and validating every individual transaction that occurs in a block. Although validators typically have strong computing abilities, it may take multiple milliseconds to re-run and simulate your transaction. For simple transfers, this may only take less than 1ms, but imagine you make a complex swap on 1inch, routing your swap through UniswapCurve and Balancer. All of a sudden, your transaction is not simple anymore, touching multiple contracts, such as the Uniswap Router, the Uniswap V3 Pool contract, and Curve and Balancer contracts.

Now, a couple of milliseconds may not sounds like much. But what if you have hundreds of users submitting transactions simultaneously, globally, from multiple locations at the same time? Similar to a traffic jam, the system gets congested. So how does Ethereum and other blockchains address this?

Variable transaction costs, a.k.a. Gas

Simple. The user who pays the most, wins the transaction. This is also known as an auction model. In the early days of ethereum, this would be all to it. There would be gas auctions. If you wanted to arbitrage multiple exchanges or do some MEV (something that only a single user would do), you would have to pay exorbitant amounts to validators to accept your transaction. This is also known as bribing. Of course, this would result in extremely volatile gas prices. One moment you could be paying 5$ (in ETH). The next, could could be paying 50$ (in ETH).

Of course, this was not quite efficient. As such, a number of Ethereum Improvement Protocols (EIP) came out, proposing improvements on this mechanism. The most notable mechanism in the recent past was EIP-1559.

So what is Gas?

The key points of EIP-1559 included the following, as was shortly discussed in our previous article:

(1) Introduction of a BaseFee: Similar to how users would have to bribe validators with Ethereum (to guarantee fast execution of their transaction, namely in the next block), the concept of a basefee was introduced. This basefee was “the bare minimum” that every transaction inside a block would have to pay. For each stand-alone block, the basefee is a fixed number. For block number 20138882 it would be approximately 0.000000006102064422 ETH. Put more easily, this corresponds to 6102064422 wei, or 6.1 giga-wei (gwei). Gas is typically annotated in gwei, due to the readability.

1_PedW5v1lLnXLV_DoSAIwoQ-dx0tg

The biggest innovation in EIP-1559 is to reduce the extreme volatility of gas-prices. This was achieved by the 12.5%-rule. If the last block was “full” (we will talk about what constitutes a full block in a future post), then the minimum amount that users have to pay for the same transaction increases by 12.5%. All of a sudden you pay 12.5$ for a swap that would have costed you 10$ previously. If a block is empty, you pay 8.75$ for a swap, that would have previously cost you 10$ (assume that the Ethereum price has not changed for convenience sake).

With this mechanism, volatility was largely capped.

(2) Introduction of a PriorityFee: As was the case in the previous Ethereum version, some notion of “Urgency” was still missing. It was used a lot by arbitrage bots, who would want to outcompete each other. Or, if you really want to execute your transaction in the next 20 seconds, rather than potentially waiting 5 minutes, you would have the possibility to incentivize the validator to execute your transaction faster. This is a more specialized feature that common user’s wouldn’t have to know of. Typically, blocks have enough space that if you pay the basefee, and a “minimal” transaction fee, your transaction would go through (in other words, would your transaction would be included in the block).

We’ve included a diagram that shows you how transactions fees deviate, and how successful EIP-1559 was. Blue dots show the BaseFee that was paid for each block. Red shows the median PriorityFee that was paid for each block. This is data collected over 2 years.

1_QWw38Oa-8U7fPzOiiABtrQ-2g1zz

As you can seen in the correlation-plot below, most of the Ethereum gas fee is already paid in the BaseFee. As such, a user does not need to worry about how much to bribe the validator to ensure that their transaction executes as soon as possible. Instead, the BaseFee gives a pretty good idea about what the full transaction cost may be. This is especially true if you are not trying to build an arbitrage-bot (more on this in future posts).

1_bR7ZrMMSuth72aumdJ024w-0igj8

So what do I pay when I pay gas?

This was a lot to digest. So, what do I pay when I pay gas? You incentivize a validator to simulate and validate your transaction. The Ethereum BaseFee establishes a common market price that is widely accepted as the amount that is required. You can further speed up your execution times if you bribe the validator, but this is typically not required.

You can read more about the exact details of what constitutes an Ethereum EIP-1559 transaction in the revm documentation (this is literally the list of bytes that gets sent around through your Ethernet cable). If you also want to learn more about how Ethereum prices different types of transaction, you can read more about the cost of each “OpCode” here.

It’s interesting to observe that most blockchains are tackling the same problem. Some of the main difference between different chains is the way they handle transaction fees. This is out of scope for today, but we will write about this in the future.

GasStation’s Contribution

Although we see great efforts to reduce gas fees once and for all, we believe that with physical limitations of network & compute, and the ever-increasing adoption of blockchain technology, gas auctions will always exist. Our mission is to to remove these complexities from every-day users and protocols who do not care about technical details of the blockchain, but strive for financial freedom in their lives, and explore novel use-cases with cutting-edge technologies. Our first product is GIX, a composable rebase ERC-20 token that represents the price of Gas on the Base Chain.

Do you share our mission or have feedback? Follow us on X.com and join our discussions on Telegram, we are constantly looking for input and would love to hear yours!

Read more

Built on Unicorn Platform