Ethereum Basics: What Is Gas And What Is It Used For?

in #ethereum6 years ago

Making transactions with Ethereum can be a very confusing task. It can also be frustration because screwing up can fail your transaction and you can lose your transaction costs. But if you follow a few easy guide lines you will have no problem with sending your Ethereum to another adress.

What is the purpose of gas?


Gas is a way to purchase computing power from miners. You pay the miners to execute smart contracts which includes transactions because transactions are just an easy form of a smart contract. This is also the reason you have to enter a gas limit if you send a transaction. Since paying gas is paying for the execution of a smart contract and you want to avoid infinite loops in the code to be executed indefinetly you have to set a gas limit. This will make sure that the smart contract will stop being executed at a certain point.

What does this mean in practice?


In practice you have to pay attention to two different parameters when sending Ether to another address, the gas limit and the gas price. The gas limit is the parameter that can cause the transaction to fail. If the gas limit is too low the transaction won't get filled and you will lose the amount you already paid for the transaction. For a regular transaction a gas limit of 21000 will be enough to make a fast and secure transaction in most cases. If you want to make a transaction to an ico you will have to enter a much higher gas limit. A usual rate would be 300000 but you should look at the website of the ico first, they will usually tell you what gas limit to enter.

The second parameter you can very is the gas price. This decides how much Ether you pay for the gas. The higher you set this price the higher the price of your transaction will become. A higher gas price will lead to a faster transaction. A low gas price will lead to a longer transaction time. It is important that the gas price doesn't have any impact on whether the transaction goes through or not but it only impacts how long the transaction will take.

This means that if your transaction is not urgent you can safe money by setting the gas price low but you should never try to safe money on the gas limit because that could cause your transaction to fail. A very helpful website is https://ethgasstation.info/ . This site shows you which gas price you should currently enter for a slow, an average or a fast transaction. If you have enough time I would recommend using the safelow gas price.

DQmeVCv1Rz2YZ5w6QCgJhb2Cvrm5E9R2RB5xnVv36cE92pU_1680x8400.png
If you liked the article please upvote, comment or follow us!

Read our latest post about Blockchain 3.0:
https://steemit.com/blockchain/@cryptoinvesthub/what-is-blockchain-3-0-and-why-is-there-so-much-hype-around-it

Sort:  

Very nice summary, I have uselessly wasted eth trying to figure this out myself ; ) This is very helpful.

I hope it wasn't too much money :) I am glad I could help and I hope none of your transactions will fail in the future!

Good job, I have been confused in the past about what to do when making a transaction but now I feel like I know the basics. Thank you!

Thanks. I am happy that you feel comfortable transacting eth now ;-)

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by apartphilosopher from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Coin Marketplace

STEEM 0.19
TRX 0.19
JST 0.033
BTC 89479.36
ETH 3038.26
USDT 1.00
SBD 2.80