Ethereum wallets in plain English (part 2)

Sepehr Vafaei

Don't fall behind. Increase your crypto knowledge.

I’m gonna talk about transaction fees and Gas. You’ll understand in a few minutes. While Bitcoin can be divided into 100,000,000 units with the smallest unit called a Satoshi, Ether can be divided into one quintillion units, 1 with 18 zeroes after it, and the smallest one called Wei.

The link to the previous part is at the end.

Wei is named after Wei Dai, a cryptography activist who is known for supporting the widespread use of strong cryptography and privacy-oriented technologies. Fees for transactions are usually calculated in Giga Wei. So, 1 quintillion Wei equals 1 Ether and 1 billion Wei equals one Giga Wei. There are also other names for different amounts of Wei, all named after famous cryptographers.

In Bitcoin, to send a transaction we need to add a miner’s fee to it. This way, we incentivize the miners to include it in a block. In Ethereum, we must keep miners incentivized as well, for their contribution of computing power to the Ethereum supercomputer.

Just like a car, the Ethereum network runs on Gas. Each line of code that needs to be executed by the network will take up a certain amount of gas. Run out of Gas and the code stops running. You specify how much Gas you’re going to use upfront, and you can’t refuel on the way. If your contract runs out of gas because it’s written inefficiently or you miscalculated, it will just stop in the middle of the road. This system motivates Smart contract programmers to keep their code clean and optimized since Gas costs money as we will soon learn. The Gas you pay goes to the miners, as they are the ones investing computing power to update the ledger of Ethereum transactions, like what goes on in Bitcoin.

Keep in mind that Gas isn’t something you can own, it’s just a unit of account to measure how much work is needed to run a line of code. Think of it as the equivalent of hours of labor. Gas is paid in Ether, Now you might be wondering why not just price execution of smart contracts in Ether and why do we need another virtual currency?

Ether’s price is constantly changing, and if we priced contracts in Ether the price would be different each time. Imagine we’d price painting our house at 2 Ether, sometimes it would cost us $1000 and other times $2000. With Gas, running the same contract several times will always bring back a fixed amount of Gas to be paid just like painting the same house takes the same number of hours every time. So how much gas do you need to run a line of code? Easy… there are predefined amounts for each action you want to run in your code. For example, sending Ether from one address to the other requires 21,000 gas units.

Now comes the tricky part. How much do you pay for a unit of gas? The price of 1 gas unit changes all the time depending on how crowded the network is. In the same way, an hour of labor would cost more if many people are looking for employees the Gas price rises when the network is crowded. The “standard” gas price is around 20 Giga Wei. You can consider this the average salary on the market for an hour of labor. If the Ethereum network is very busy and you want your contract to get priority in execution over other contracts you may overbid the gas price so that miners will have an incentive to include your contract in the next block. You’re basically saying I’m willing to increase your pay per unit of labor, so you’ll give my work priority. This is like how Bitcoin transaction fees rise when the network is crowded.

When you send a transaction in Ether you also need to specify a gas limit — meaning how much gas are you willing to use at maximum for running your lines of code. This is done to protect you from depleting your funds in case your code has an error and runs endlessly or inefficiently. You pay the full amount for your gas limit upfront and there’s no option for “refueling”. This can cause certain things to go wrong, for example: If you overpaid and your contract ended up using less gas — you’ll get refunded for the gas not used. However, if an operation ran out of gas mid-way it will halt, just like your car, and no Ether will be returned to you just like a gas station doesn’t refund you even if you didn’t have enough gas to get where you want to go. This can happen if, for example, your contract needs to do some recurring function that keeps on consuming gas and finally runs out. If you don’t include enough gas units for running your code no miner will pick up your transaction since it doesn’t have enough gas from the get-go.

If you choose enough units of gas but pay very little for each unit it may take a lot of time for your transaction to go through since miners will prioritize higher-paying transactions.

To conclude, in Ethereum fees are a general term that refers to the gas used multiplied by the gas price you were willing to pay. In other words — the hours of labor worked times the wage per hour. The higher you’re willing to pay per gas unit the more miners will compete for running your code, and the faster your transaction will be included in the blockchain. As you probably noticed Ethereum is a lot more complicated than Bitcoin mainly because it’s intended on executing much more complex functions than just sending money from A to B.

Stay tuned for more on cryptocurrencies. Be careful don’t lose your money in this volatile market and expect all sorts of fraud especially regarding cryptocurrencies.

Thanks for reading. I wish you a smile. I write on money mindset, healthy lifestyle, personal finance, and business. You can follow to stay updated.

Previous part

This is original content from NewsBreak’s Creator Program. Join today to publish and share your own content.

Comments / 0

Published by

Writing content that can help us have a better and more productive life financially & mentally.


More from Sepehr Vafaei

Comments / 0