Insider
Insider
Sep 27 · 2 min read

Simply put, “Gas” is the fee for performing an operation (such as a transaction or smart contract execution) on the Ethereum network.

While gas is the unit by which transaction costs are measured, it only exists as a unit of measurement and the actual cost must be paid for using Ether (ETH).

The reason for this is to separate the cost of computation from the value of Ether (ETH). Meaning that while the price of Ether (ETH) can fluctuate, the cost of performing transactions on the Ethereum network can remain steady.

Every operation takes a certain amount of gas to complete. This is divided into gas ‘cost’ and gas ‘price’.

‘Gas cost’ is the amount of gas required to complete a transaction. For instance, a standard transfer of Ether (ETH) requires 21,000 gas, while more complex transactions require more.

Users set what is known as a ‘gas limit’, which is the maximum amount of gas they are willing to spend on a transaction.

Applying a gas limit creates a safety net that protects users from burning through all their Ether (ETH) trying to perform an operation with errors or executing a faulty smart contract.

For example, setting a limit of 21,000 gas for a standard transaction ensures there is enough gas for the operation while preventing more from being used if an error occurs.

‘Gas price’ is the amount you are willing to pay for each unit of gas.

When setting gas prices, users are recommended to review current prices to understand how their transaction will be prioritized. Miners tend to prioritize transactions with higher gas prices and may outright ignore ones with too low a price.

So the total cost for an operation is calculated as:

Gas Used x Gas Price

For example, let’s say we wanted to send a friend some Ether (ETH). A standard transfer requires 21,000 gas. If we set the gas price as 6 Gwei (a unit of Ether), the transaction cost would be calculated as:

21,000 x 0.000000006 (6 Gwei)

= 0.000126 ETH

DRIVE Insider

Industry insight and the latest from the DRIVE team

Insider

Written by

Insider

wearedrive.com — Check us out!

DRIVE Insider

Industry insight and the latest from the DRIVE team

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade