In cryptoverse, there are many terms you need to get familiar with: blockchain, nodes, stablecoins, DeFi, NFTs… However, the one term that comes up in almost every situation is gas. We all know that in the real world gas is used to supply energy, but what does gas mean in crypto? In this article, the GetBlock team will talk about why crypto projects need gas, what it means, and how to check its price via the eth_gasPrice command.
What is gas in crypto?
To conduct a transaction on Ethereum, each user needs to pay a fee, which is used to cover the costs (computational resources) necessary to perform the operation. These fees are also known as ‘gas’. They are paid in tiny fractions of the Ether cryptocurrency called gwei (10-9 ETH). The Ethereum devs team compares crypto gas to how cars require gasoline to run.
Since gas is paid in Ether, other crypto projects may call it “transaction fees”, “miner fees”, and other similar names; however, its role remains the same. When the demand for the network’s validation requests decreases, gas prices are usually low; when the demand is high, gas prices tend to increase.
History of gas in crypto
On a proof-of-work (PoW) network, such as Bitcoin, gas is paid to miners as soon as they have finished validating a transaction for the end user. To do this, miners require powerful computing equipment, which can generate cryptographic hashes (random codes). The first miner to generate the same number of hashes as the final goal result gets to add a new block to the chain and receives all fees and rewards related to this transaction.
In a Proof-of-Stake (PoS) network, however, the mechanism works a little differently. After the completion of the Merge, Ethereum became a PoS blockchain and is now rewarding gas fees to validators (instead of miners) who first lock a certain amount of coins on the network in order to participate in the verifying process. Those with bigger funds have a higher chance of being selected; nevertheless, sometimes the random mechanism chooses those validators with fewer tokens to validate transactions and earn rewards.
Why are gas prices important?
Now, let’s break down some of the reasons why keeping track of gas prices can be fundamental for Web3 enthusiasts.
First and foremost, it is important to understand that gas fees are largely dependent on the network’s congestion and throughput.
There have been several historical precedents when gas prices seemed to spiral out of control. For instance, in mid-2020 the Ethereum network experienced major network congestion and transaction delays when the gas fees went up 4x due to MMM Global’s Bernie Madoff-style Ponzi scheme, according to which the company would receive up to 8.5% of all gas fees. Not to mention, in early 2021, due to network congestion, a single transaction would result in more than $60 in fees on UniSwap.
Typically, the gas limit is set at a minimum of 21,000 units and the base fee is 10 gwei. According to the Ethereum official documentation, this is how the gas fee is calculated:
“The total fee would now be: units of gas used * (base fee + priority fee) where the base fee is a value set by the protocol and the priority fee is a value set by the user as a tip to the validator.”
How to check gas prices
Essentially, there are a few ways of keeping up with gas fee prices: through price trackers, blockchain explorers, and GetBlock’s eth_gasPrice command.
All you have to do is copy the eth_gasPrice command and paste it into the terminal. The command returns a percentile gas unit price for the most recent 100 blocks. The result is displayed in wei – the smallest base unit in Ethereum. 1 gwei (gigawei) = 1 billion wei. The value returned is set between the minimum gas price and the maximum gas price limits, 1000 wei and 500 gwei respectively.
Take a look at the example:
Request
Result:
Therefore, GetBlock clients can easily check gas prices in a couple of clicks via the eth_gasPrice method.
Closing thoughts
Gas fees on Ethereum are deployed as a tool to guarantee the successful completion of each transaction. Fees are calculated based on the amount of blockchain traffic, the demand for transaction verification, and the number of available validators.