September 22, 2020

Everything you need to know about Ethereum gas

Before we go into detail about how the gas works in the Ethereum, we need to know some basic things about its ecosystem.

Ethereum has great computing power as if it were a big computer where all operations are executed, and it is known as Ethereum Virtual Machine or EVM.

It is not a central server but is composed of thousands of individual computers communicating with each other over the Internet.

Each of these computers is known as a node. They provide security to the network, have a full copy of the block chain, and are involved in the process of verifying transactions. Among them, there are also miners, who give up their computing power to execute transfers, intelligent contracts or Dapps (decentralized applications).

Maintaining these computers involves considerable economic expense. Maintenance, high energy consumption, stable internet connection, physical space and conditioning among others.

For this reason, the concept of gas was created to reward the miners.

Ethereum gas

indicador de nivel de gasolina

The Gas (Gwei) is the unit of measurement of the computational work to execute any operation in Ethereum, be it transactions, smart contracts or Dapps.

We could make a simile with the automotive world, where gas would be the fuel. It is clear to everyone that a Ferrari will consume much more fuel than a Seat Panda, in the same way that a complex intelligent contract that requires a lot of computing power to execute than a simple transaction will not consume the same gas.

But… if Ethereum uses the Ether as a currency, why isn't the Ether used to pay the commissions?

The answer is that Ether is a financial asset, and this causes its price to vary constantly and to be subject to the high volatility presented by the cryptocurrencies market.

In contrast, the cost of maintenance for the miners is fairly constant. Hardware or electricity prices are not as volatile.

To understand it better, let's take an example:

Let's imagine that a fixed fee of 0.01ETH per operation is established.

When Ether's value was 10€, the cost would be 0.01€. On the other hand, when it was at 1,000€ the cost would be 10€.

Not everyone would be willing to pay 10€ for a transfer, and let's not even imagine if Ether reaches new highs. That's why the Gas was created.

In summary, the Gas allows the computational cost to be independent of the value of the Ether.

What is the reason then that you are increasing the necessary gas so much?

There are two fundamental variables for calculating the gas required:

  • Size or complexity of the transaction:

The more processing power we need from the miners, the higher the amount to be paid. A simple transaction of a shipment of Ether between 2 wallets will not use the same resources as the execution of a smart contract.

  • Network congestion:

Although Ethereum 2.0 is on the horizon and that would solve the current scalability problems, at the moment Ethereum's resources are increasingly limited.

The higher the commission paid to the miners, the higher the priority in carrying out the operation. Therefore, when there is congestion in the network, whenever someone is willing to increase the commission he will go ahead.

Due to the exponential growth of decentralized applications, smart contracts, and tokens that use the Ethereum network, it causes stakeholders to increase their commissions to be able to perform their operations on the network, thus increasing the cost of gas to be paid.

Let's take Tether as an example, which is an ERC-20 token and therefore uses the resources of the Ethereum network. It is a stable currency backed by dollars. Because of this feature, it is widely used in the world of cryptocurrencies. At the time of writing, this currency has moved a total volume in 24h of almost 43 billion dollars, much higher than Bitcoin with 27 billion dollars.

Block explorer table

The Casper upgrade aims to address these scalability issues by changing its consensus protocol from proof of work to proof of stake, as it reduces or potentially eliminates hardware and energy costs and thereby reduces the amount of gas required to use your ecosystem.