What is gas and what causes it to fluctuate?
One of the most common questions we get at Gitcoin is about gas. This article aims to answer some of the questions and also talk about practical and theoretical aspects of the Ethereum gas market.
What is Gas?
Gas is a unit denoting price of computation on the Ethereum, paid in Ether by users to miners in order to utilize the computational power of the network. A gas limit is the maximum amount of computational units that is allowed for your particular transaction. The total cost of a transaction (the transaction fee) is the gas price (in Ether) multiplied by the gas limit. This is similar to paying for gas at the gas station — $3.50 (gas price) per gallon (unit). 10 units comes out to a transaction price of $35.
A “good” gas price is subjective. If you want your transactions to be confirmed faster, pay a higher gas price. Conversely, if you can wait, you can pay less. For example, at the time of writing this article, you can pay 4 Gwei per gas at the higher end to get your transaction mined and accepted in under 2 minutes, while at the safeLow price of 1.5 Gwei per gas, it could take up to 30 minutes to be confirmed.
The ETH paid for gas is a reward transferred to block miners responsible for confirming transactions and keeping the network online, reliable, and speedy.
Gas Price Fluctuations
If you’ve been active in the space for the last year, you probably know that gas prices fluctuate a lot.
A lower gas price is, obviously, preferred by most consumers since it allows for inexpensive transactions on the Ethereum blockchain. When the gas prices rise, it puts a strain on the entire network and hinders transaction activity, thus causing DApp usage to suffer.
One other effect of high gas prices is that it increases the profitability of being a miner. In theory, this creates further incentives for more miners to join the network, which will increase throughput.
So, why do gas prices fluctuate and what market activity sparks these fluctuations?
Let’s look at some historical causes of gas market fluctuations.
Cryptokitties, December 2017
Cryptokitties is an Ethereum based game in which users can collect, trade, and breed digital cats while maintaining immutable ownership of these cats on the blockchain. In December of 2017, the entire cryptocurrency market was at peak speculation. So, naturally, when Cryptokitties introduced a new investment vertical in the form of non-fungible assets, the market jumped all over it trying to buy as many as they could.
In the current state of Ethereum, the network can handle approximately 15 transactions per second. When Cryptokitties hit peak hype, the network transaction requests almost doubled — practically overnight — from around 622K to 1.07 Million. The Ethereum transaction mempool (where transactions live before they are processed) grew quickly with tons of backlogged transactions.
“Initially, CryptoKitties made the decision to depend completely on MetaMask, and funnel everybody through the MetaMask browser to use the dApp, and all of that traffic goes through Infura nodes on the backend. As a result, we were supporting all of that traffic. The network started to become really clogged. All of the blockchain read activity caused our daily requests to explode from 2 Billion/day to over 4 Billion/day… overnight!” — Michael Wuehler, Infura
When the transaction queue gets backed up like this, Ethereum miners alter their rig settings to only accept transactions with gas prices meeting a certain threshold. Consequently, the minimum gas price starts to rise. As more and more transactions became backlogged, the miner-accepted gas prices began skyrocket.
FCoin Exchange, July 2018
On Monday July 2nd, there was chatter about rising gas prices all over Ethereum’s subreddit. The gas price had shot up to roughly 30 Gwei overnight and was continuing to rise.
The image above is a screenshot from EthGasStation.info listing the top 10 Eth contracts by percentage of the total transactions on Ethereum. As you can see, highlighted in red, seven of the top ten contracts being called were new tokens.
Turns out a Chinese exchange called FCoin had started a voting process called cumulative deposits number ranking. This was a voting system designed to list new tokens on their exchange and operated by counting as each deposit to their exchange as a single vote. So instead of one user one vote, it was one deposit one vote. So, if I wanted to deposit a unit of token, instead of doing a single deposit, doing two deposits of 0.5 tokens got you two votes.
It wasn’t long before the network was filled with thousands and thousands of small token transactions, with the sole purpose of getting listed on Fcoin. Most of the people doing these transactions were paying a very high price per gas for their transactions to compete with other tokens.
The FCoin incentivization scheme crippled the network in the same way that Cryptokitties had done a few months before. The transaction mempool continued to grow, so consequently, miners raised their minimum gas prices to combat the situation.
IFish, July 2018
In July 2018, another story came to light. According to Team JUST’s Discord, 40% of Ethereum’s network capacity was being used by an ERC20 token called “IFishYunYu” with essentially no features that could justify the volume of trading around it.
One of the beautiful aspects of blockchains is that it allows us to investigate what exactly was going on.
It became clear that a single account was moving tokens around to generate fake volume, interest, and attention. This was a multi-sided scheme being run by a single party that was spending massive amounts of Ether (~50 ETH/hour) to fund this entire operation.
One of the accounts that were a part of this scheme also held EOS tokens which led many to believe that someone in the EOS network was also involved.
While there is strong evidence that someone who held EOS tokens was involved, there isn’t any strong evidence that they had malicious intent, nor is there any evidence that any of the Block Producers or the centralized organization behind EOS, Block One, was involved. Having EOS tokens in that particular wallet isn’t a good enough reason to blame Block One. The founder of EOS, Daniel Larimer, also denied any involvement.
Gas Moving Forward
Gas mechanics are an essential concept to understand if you’re a BUIDLer using the Ethereum network.
It is imperative that we do all we can to ensure a) our DApps scale gracefully and b) gas UX is easy to understand for end-users. This ensures the usability of the network and the DApps built upon it.
One such example is Gitcoin’s “Post Bounty” interface. We have done our best to make the gas price decision as simple as possible for new users when they publish a bounty.
The Long Term Roadmap For Scalability
Right now, the most promising long term solutions to network scalability are sharding, plasma, and PoS scaling efforts.
Sharding aims to lessen the amount of compute each node needs to perform. Similar to the same function within databases, sharding on Ethereum will allow nodes to implement “shards” of the blockchain, or smaller portions transactions, without the need to waste computation dealing with transactions outside of that shard. Vitalik gave a great analogy for sharding at Devcon3:
Imagine that Ethereum has been split into thousands of islands. Each island can do its own thing. Each of the island has its own unique features and everyone belonging on that island i.e. the accounts, can interact with each other and they can freely indulge in all its features.
Sharding and Proof of Stake (PoS) go hand-in-hand. A side effect of PoS is that it makes shards more secure. Sharding with the current PoW consensus on Ethereum could be potentially dangerous. For example, assume you are splitting the Ethereum chain into two shards; EA and EB. If shard EA is larger than EB, it will take up a larger portion of the hashpower. The EB shard, with a smaller portion of the hashpower, is now significantly more vulnerable to a 51% attack, thus making small shards vulnerabilities to the entire Ethereum network. With PoS consensus, this attack vector is less exploitable.
Plasma aims to move some transactions off-chain; similar to the Bitcoin Lightning Network. Plasma allows for the creation of “child chains”. Within child chains, users can transact freely with each other without interacting with the main Ethereum chain for each transaction. Then, at some time interval, child-chain state’s can be validated on the main Ethereum chain. This theoretically increases the transaction throughput for Ethereum without needing to validate each and every transaction on the main chain.
If implementation of these scaling solutions are successful, it will be increasingly difficult to cripple the Ethereum network. This future calls for even lower gas prices for all, even as the total number of Ethereum transactions continues to grow.
We hope this brief history and look ahead to the future provides perspective on why gas matters, how to use it, and what it may look like going forward.