Why We Need Ether as The Gas of The Ethereum Network

Conor Maloney
5 min readDec 23, 2018

--

Ethereum gas is a fundamental part of the network. It fuels every operation carried out on the blockchain, and without it, Ethereum simply wouldn’t function. But what is it, and why do we need to pay it in ether?

To answer these questions, it’s best to take a look at the anatomy of the Ethereum project and how it works. Let’s start with the platform itself.

Ethereum and Smart Contracts

Ethereum is a platform used for creating and running decentralized applications, the first and most prominent platform of its kind. DApps are comprised of application logic called smart contracts, autonomous pieces of code that are programmed to perform certain functions when triggered.

One example of a DApp use case is in weather derivatives — lets say a fisherman wants to take precautions against bad weather preventing them from working.

The fisherman could deposit funds into a DApp which reads the weather from a trusted source.In the event of a storm, for example, the weather report will trigger a smart contract to compensate the fisherman’s losses for that day.

DApps are typically made of many different smart contracts which communicate with each other, and they’re all written in Solidity, a blockchain programming language.

Smart contracts are executed in an Ethereum runtime environment called the Ethereum Virtual Machine or EVM. While they’re written in Solidity, a higher-level programming language suitable for coding, they are then compiled into machine code called EVM bytecode which is less legible for humans but more suitable for executing the contracts.

This bytecode contains operations, and each of these operations has a cost, which is measured in gas.

Gas

Gas is a unit of measuring the cost of computations on the Ethereum network.

For example, a particular operation in a smart contract could cost 2 gas, or 5 gas, while a set of operations could cost thousands.

So how do you pay the operation fees? In ether, the cryptocurrency native to the Ethereum network. The amount of gas required to fuel each operation is fixed, and there is actually a list of how much different operations cost published in the Ethereum Yellow Paper.

But the price of that gas is not fixed — it depends on the market value of ether.

Gas Price and Gas Limit

The gas price is measured in ether, and is determined by the senders who set a gas limit, the amount of gas they’re willing to pay for a transaction. Miners can then choose whether or not to enter that transaction into their block, so the price is essentially negotiated by both parties.

Just like with dollars and cents, it’s useful to break one ether down into smaller units for microtransactions — one billionth of an ether is called a GWei, the unit gas price is typically measured in. Here’s an example of a transaction fee:

The standard gas price for one gas is currently 8.14 GWei — that’s how much ether it costs to pay for one unit of gas. The standard gas limit is 21,000, so the price of a standard transaction is currently 21000 * 10 GWei, which is equal to .0021 ETH or $0.47 USD.

Why do we need ether to pay gas? Why not make gas its own currency?

At the moment, the standard cost of a transaction is $0.39 in USD. What if Ethereum suddenly increased in value tenfold, as is often seen in the crypto space?

Suddenly it would cost $3.90 just to send a transaction on the Ethereum network, making microtransactions totally unfeasible. It’s necessary to separate the gas cost from the price of ether so that the senders and miners can work out fair gas prices that enable the network to run smoothly.

Instead of making gas a currency, the developers made a system where the existing cryptocurrency could be used to pay for operations without inflation/deflation majorly affecting the cost of those operations. Much like the amount of fuel required to power a car engine is not dependent on the current price of that fuel, the amount of gas required to power an Ethereum operation is indifferent to the current market price of ether.

Why do we need to pay fees at all?

Image from Blockchain Council.

There are two reasons for this. At the moment, Ethereum uses the Proof of Work consensus. That makes it quite expensive for miners to validate transactions, and the fees help cover the costs of running the entire network.

Another reason is spam prevention. The EVM is a Turing Complete software, meaning it can theoretically solve any possible computational problem given enough time.

One feature of a Turing Complete program is the ability to run loops, coded instructions that will automatically repeat themselves a given number of times, be it 10, 100, 1000, etc. Programs without loop capabilities require developers to copy and paste a section of code each time they want it to repeat.

Enabling loops was seen by the developers as a necessary feature of a platform designing decentralized applications with such a vast amount of potential use cases, but it brought up a potential problem — denial of service attacks.

An attacker could potentially write spam programs designed to execute billions of operations in a row, over and over again, just to disrupt and congest the network. Attaching a cost to each operation makes a DoS attack unfeasibly expensive, protecting the network from malicious spam.

Recap

Gas is not a currency, but a unit which measures the cost of computation. It’s paid in ether, the currency on the Ethereum platform. The price of gas is determined by the sender of a transaction or operation, and ether is used to pay gas in order to protect the network from spam, pay for network costs, and allow for network users to set fair transaction fees.

--

--

Conor Maloney

Conor Maloney is a blockchain and content marketer and former journalist and editor at multiple outlets. Professional inquiries: https://www.writtencraft.com/