Ethereum's platform appeared at the end of 2013 as an idea of the then-unknown 19-year-old Vitalik Buterin. In just five years, Ethreum became the most successful infrastructure project in the field of blockchain on which currently, hundreds of projects in various spheres are built.
In its essence, Ethereum is a platform that allows people and organisations to create decentralised applications and work with smart contracts. To motivate the participants in its network, Ethereum gives out well thought-through stimuli. The notion of ether gas is an integral part of this system.
Ethereum Virtual Machine (EVM)
Basically, Ethereum's virtual machine is a medium in which it is possible to execute smart contracts. It is formed and supported by each member of the Ethereum network. This platform allows smart contracts to own and fulfil their three basic properties:
They are deterministic: or, to always give the same results when the same parameters are set.
Can be terminated: or, there are ways in which you can prevent entering into an endless loop. Different taxes and timers solve this issue and do not allow the loss of many resources.
Can be isolated: it is impossible for viruses and bugs in a particular contract to influence the whole system.
Although simple in its goals, Ethereum's virtual machine is effective in reaching them and thanks to it, smart contracts can be fulfilled securely.
Gas in the context of Ethereum is a unit and a measurement for the computing power that is needed to execute certain operations in the EVM. This computing power is provided by the miners in the system, and since they use energy to produce it, they are rewarded with gas. Of course, the more energy is required for the execution of an operation (for example, a transaction or a smart contract), the more gas is needed.
It is important to point out that in reality, gas does not exist. In other words, it is not possible to own gas, and gas is not a type of token. The value of each unit of gas is expressed in ether (ETH).
It is only logical to ask why does a term such as gas exist and why aren't taxes paid directly in ether? There are a few important reasons that create the need for the term gas – and they are theoretical, financial and computational.
The general purpose of gas is related to the alignment of the stimuli of the different members of the network. Through gas, miners in the network are stimulated to work for the benefit of the network, and users are encouraged not to write low-quality codes or act in an ill-manner since this would lead to financial loss. This way, all the members of the network work towards a common goal – for the network to be as safe and secure as possible.
The financial purpose of gas is to stimulate miners to provide their computing power for the benefit of the system, helping out for the execution of transactions and smart contracts. More complex operations require more computing power, and this makes the reward higher. Also, if a user wants their transaction to be executed faster, they can pay more so that it is executed with a priority before the others in the waiting line. This purpose of gas will become even more important when Ethereum transitions to proof of stake algorithm.
The computing purpose is related to an old issue in computer theory. Can a program continue to work infinitely, considering only its description and its input value, or stop? One of the first people to face this issue was Alan Turing in the distant 1936. He managed to prove that there is no single solution from a machine to this issue. This is a serious issue that gets a partial solution in the Ethereum network through the gas. Thanks to the so-called gas limit that is set for each operation, malware or bugs cannot lead to infinite loops. Even if a miner starts processing such a transaction, when the gas limit is reached, the program will stop, and the miner will be rewarded for their effort.
Components of gas
Gas can be divided into three essential parts. These are gas cost, gas price and gas limit.
Gas cost is the units needed for a particular operation to be executed. This information is compiled at the creation of the Ethereum platform, and its details can be found in the Ethereum Yellow Paper. For example, the price of an operation of "adding" is always 3 gas, and a transaction is at least 21 000 gas, regardless of the cost of an ETH in dollars. These values are not easily changed and are kept constant, while the price of gas can vary and in this way, could respond to the volatility of the market value of ether and the workload on the network. This separation of the price of an operation in the net from the volatility of the cost of ether is the main reason why operations are not directly paid in ether.
Gas price is the value of one unit measured in ether. It is interesting to point out that just as the smallest part into which 1 BTC can be divided is 1 satoshi, with ETH, the smallest unit into which it can be divided is the so-called wei. 1 wei is a tiny part of an ETH, or more particularly, 1x10^-18 ETH or 0.000000000000000001 ETH. There are sites where you can check the average sum in ether that has to be paid so that a transaction is executed speedily. The larger the amount spent, the more priority could be given to the transaction in question by the miners, and so it will be finalised faster.
This is the reason why sometimes the so-called "gas wars" occur when investing in ICOs. It happens when the investors are racing to buy a limited amount of tokens by paying enormous amounts for their transactions, knowing that only the transactions that are approved the fastest will be successful. It reaches the point where thousands of dollars are paid for a single operation. A worthy example of that is BATs (Basic Attention Token) ICO, which raised 35 million dollars for 24 seconds, and one of the investors had to pay more than $ 6000 for their transaction to ensure their participation.
A gas limit is the maximum amount of gas that a single participant in the network is willing to pay for their transaction. A gas limit is freely determined by the users in each transaction, and it usually is an amount that is higher than the gas that is used for the deal in the end. In case the limit is reached, the transaction will be recorded as unsuccessful, but the miners will keep the taxes paid up to this moment. It exists so that it protects both the users, preventing losses of more substantial sums, and the miners, by ensuring that loss of energy caused by mistakes in the code or ill-intentioned attacks is not excessive.
By introducing the notion of gas, the Ethereum platform successfully solves a number of issues and motivates the different participants on the network to act in its favour. It is also true that for blockchain and decentralised apps to reach a more significant number of people, there is a need for gas management in the Ethereum network to be significantly simplified. With the entrance of more people and institutions into the blockchain field, such improvements are only a matter of time.
Stay informed with the development of the blockchain industry and the cryptocurrency market. Subscribe to our newsletter here.
The news and other materials, published here, are for educational purposes only and do not provide recommendations or suggestions related to making deals with cryptocurrency, crypto tokens or other products of the blockchain technology. The products of blockchain technology (cryptocurrency, crypto tokens, smart contracts and others) are not regulated or protected by the legislations of the EU or the Republic of Bulgaria at present. Deals with products of blockchain technology (cryptocurrency, crypto tokens, smart contracts and others) have a high degree of risk.