create account

Ethereum "Gas" - How it Works by tomshwom

View this thread on: hive.blogpeakd.comecency.com
· @tomshwom · (edited)
$0.20
Ethereum "Gas" - How it Works
## Purpose
---
Understanding how gas works is crucial for Ethereum users interested in participating in **ICOs**, using **smart contracts**, and even making simple **transfers** between wallets.  In this post, I hope to explain what gas is and how it works.  Skip to the end for a simple summary of things.  To start off, we need to understand some basics about the Ethereum Virtual Machine.

## Ethereum Virtual Machine and Gas
---
The Ethereum Virtual Machine (EVM) is a major part of the Ethereum ecosystem, but I'll be heavily glossing over this so we can focus on how it relates to **gas**. In short, **the EVM is an environment where arbitrary code of smart contracts and other operations can be executed.**  Every node in the Ethereum network executes operations within the EVM to ensure redundantly correct execution and relies on consensus to agree on the answer.

All transactions,  from simple transfers to ICO smart contracts, require some amount of operations to perform.  Each of these operations has an associated cost in **gas**.  Thus, simple transactions like transfers will require less gas to perform than more intense smart contracts.

For example, a simple operation like ```if(var > 1)``` may cost 1 gas, but a more complex operation to store a variable could cost 100 gas.  **The cumulative sum of all the operations is the total gas cost for the transaction.**  

## Gas Limit
---
When on a site like MyEtherWallet, you're going to see a field called **Gas Limit**.  This corresponds the the **MAXIMUM** amount of gas you are willing to spend on the transaction.  
Important to note:
* Different types of transactions will require different amounts of gas to complete
* Providing too little gas will result in a failed transaction, **the fees are kept by the miner**
* Extra, unspent gas is refunded automatically

#### What happens if I specify too little gas?
Your transaction will start to be executed, but will eventually run out of gas and be stopped.  When this happens, **you will not get back ether spend on the gas used, but since the transaction did not complete, the blockchain does not reflect a transfer, so the main funds essentially never left the wallet.**

#### So I should always specify a large gas limit since I'll be refunded?
No. The minimum gas limit for transaction is 21000 + the amount to execute any fallback functions if it's sent to a contract, but the actual blocks *also* have a gas limit that specifies the maximum amount of gas all transactions in the block can consume.  This is comparable to Bitcoin's block size in bytes, but ether miners have the option to increase or decrease the gas limit of blocks so that they are propagated quickly.  You cannot exceed this amount if you wish for your transaction to be processed.  Also, miners only get paid for the actual gas consumed by a transaction, so putting a high value for the gas limit fills up the block gas limit, but isn't computationally-dense enough for miners to want.

## Gas Price
---
**Gas price** is the amount of ether you are willing to spend on every unit of gas.  Yes, you determine the price of gas AND maximum amount of gas you want to spend on performing a transaction on the Ethereum network.  Although gas limit is just a simple quantity, gas price is measured in ether (specifically some amount of wei, usually gwei).  The value of gas is driven by the market and the nodes that prioritize higher gas prices when mining transactions.  The current gas price can be seen on [Etherscan](https://etherscan.io/chart/gasprice) or [EthGasStation](http://ethgasstation.info).  As I mentioned, gas price is usually some amount of gwei.  Wei is the smallest unit of ether, and gwei is simply 1000000000 wei.  To put this in perspective, check out this code below:

```
var unitMap = {
    'wei':          '1',
    'kwei':         '1000',
    'ada':          '1000',
    'femtoether':   '1000',
    'mwei':         '1000000',
    'babbage':      '1000000',
    'picoether':    '1000000',
    'gwei':         '1000000000',
    'shannon':      '1000000000',
    'nanoether':    '1000000000',
    'nano':         '1000000000',
    'szabo':        '1000000000000',
    'microether':   '1000000000000',
    'micro':        '1000000000000',
    'finney':       '1000000000000000',
    'milliether':   '1000000000000000',
    'milli':        '1000000000000000',
    'ether':        '1000000000000000000',
    'kether':       '1000000000000000000000',
    'grand':        '1000000000000000000000',
    'einstein':     '1000000000000000000000',
    'mether':       '1000000000000000000000000',
    'gether':       '1000000000000000000000000000',
    'tether':       '1000000000000000000000000000000'
};
```
<sub>*from https://github.com/ethereum/web3.js/blob/0.15.0/lib/utils/utils.js#L40*</sub>

## Setting Gas Limit and Gas Price
---
If you're using MetaMask, you will see something like this when trying to send Ether:

<center>![](https://steemitimages.com/DQmT5V9qtMk6pjqgusnwCGtkiGKMyNnV6WoENR5c4rKz2Wr/image.png)</center>

Here you can see that the gas limit has been set to 31500 and the gas price at 20 gwei.  This means we are only willing to spend a maximum on 31500 gas at the price of 20 gwei / gas on the transaction.  ```31500 x 20 gwei = .000630 ether.```

MyEtherWallet has the Gas Limit field, <strike>but no Gas Price for their transactions.</strike> 
 <sub><strike>*I assume they calculate Gas Price depending on the market value</strike></sub>

<center>![](https://steemitimages.com/DQmQ5Tmk1XPyTYFQZq6Qp5AqXQ21H5aEtogQ8z2TdJkbsZM/image.png)</center>

***Edit-** MEW has a slider at the bottom right of the site for adjusting gas price.*
<center>![](https://steemitimages.com/DQmb3YJSJigZ4ki2gs4qn1tzG1WEpTptYh2uY3ViggiWFaG/image.png)</center>

## Summary
---
* Transactions on the Ethereum network require fees in the form of **gas**.  The amount of gas depends on the amount of computation required to complete the transaction.  
* **Gas Limit** is the maximum amount of gas allotted to the transaction, 21000 being sufficient for simple transfers and much higher amounts for transfers to **smart contracts** like those in ICOs. 
* Insufficient gas in the Gas Limit will result in a failed transaction, the fee paid will be lost, but the ether transferred never leaves the wallet since the blockchain was never updated. 
* **Gas Price** is the price of each gas unit measured in a fractional amount of ether, typically gwei.  Gas price varies, but 20-30 gwei is average as of writing this.  
* Current Gas Price can be checked online ( [Etherscan](https://etherscan.io/chart/gasprice) or [EthGasStation](http://ethgasstation.info) ), and the Gas Limit for things other than simple transfers can only be known by looking at the smart contract code or by looking at what the organization behind the ICO / smart contract says is appropriate for their smart contract.

#### Handy Sites
[EthStats](https://ethstats.net/)
[Etherscan](https://etherscan.io/chart/gasprice)
[EthGasStation](http://ethgasstation.info)
[Ethereum and ERC20 token wallet, MyEtherWallet](https://www.myetherwallet.com/)
[MetaMask Chrome Plugin](https://metamask.io/)


<sub> **Consider leaving a like or even resteem if you found this helpful!  If you're really crazy, my MEW address is  0x5B13430b6D2E327DFCDB93D7430FC6e9a2E63E74.  Please feel free to leave corrections and comments below :)** </sub>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 85 others
properties (23)
authortomshwom
permlinkethereum-gas-how-it-works
categoryethereum
json_metadata{"tags":["ethereum","cryptocurrency","blockchain","tutorial","beginner"],"image":["https://steemitimages.com/DQmT5V9qtMk6pjqgusnwCGtkiGKMyNnV6WoENR5c4rKz2Wr/image.png","https://steemitimages.com/DQmQ5Tmk1XPyTYFQZq6Qp5AqXQ21H5aEtogQ8z2TdJkbsZM/image.png","https://steemitimages.com/DQmb3YJSJigZ4ki2gs4qn1tzG1WEpTptYh2uY3ViggiWFaG/image.png"],"links":["https://etherscan.io/chart/gasprice","http://ethgasstation.info","https://github.com/ethereum/web3.js/blob/0.15.0/lib/utils/utils.js#L40","https://ethstats.net/","https://www.myetherwallet.com/","https://metamask.io/"],"app":"steemit/0.1","format":"markdown"}
created2017-05-26 01:43:21
last_update2017-05-28 09:04:36
depth0
children74
last_payout2017-06-02 01:43:21
cashout_time1969-12-31 23:59:59
total_payout_value0.153 HBD
curator_payout_value0.043 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7,405
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id3,802,365
net_rshares139,630,464,595
author_curate_reward""
vote details (149)
@aindriu80 · (edited)
https://www.binaryforextrader.com
👎  
properties (23)
authoraindriu80
permlinkre-tomshwom-ethereum-gas-how-it-works-20171115t221307113z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1","links":["https://www.binaryforextrader.com"]}
created2017-11-15 22:13:09
last_update2017-11-15 22:14:03
depth1
children0
last_payout2017-11-22 22:13:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length33
author_reputation4,241,768,371
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,510,855
net_rshares-12,189,608,925
author_curate_reward""
vote details (1)
@beesic ·
$0.03
This article is very helpful, voted to help writer continuing to post such articles.
👍  , ,
properties (23)
authorbeesic
permlinkre-tomshwom-ethereum-gas-how-it-works-20171127t181249824z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-27 18:12:51
last_update2017-11-27 18:12:51
depth1
children0
last_payout2017-12-04 18:12:51
cashout_time1969-12-31 23:59:59
total_payout_value0.022 HBD
curator_payout_value0.007 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length84
author_reputation677,217,252
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id21,697,801
net_rshares12,190,019,721
author_curate_reward""
vote details (3)
@crazyduck ·
$0.02
Thank you. This was the first time ever I have a clear understanding of GAS and Gwei. So far I just used to go with the default values everywhere.
👍  
properties (23)
authorcrazyduck
permlinkre-tomshwom-ethereum-gas-how-it-works-20170919t184406415z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-19 18:44:06
last_update2017-09-19 18:44:06
depth1
children1
last_payout2017-09-26 18:44:06
cashout_time1969-12-31 23:59:59
total_payout_value0.018 HBD
curator_payout_value0.005 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length146
author_reputation148,529,891
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,353,932
net_rshares9,505,913,054
author_curate_reward""
vote details (1)
@tomshwom ·
If you don't need your transaction to go through super fast, you can put 0 gwei and it will be mined in 5-7 minutes completely **for free**.  Check out http://ethgasstation.info/ and see the pools accepting 0 gwei as their minimum. (right now it's 13% of blocks being mined by pools that accept 0 gwei)
👍  
properties (23)
authortomshwom
permlinkre-crazyduck-re-tomshwom-ethereum-gas-how-it-works-20170919t190143180z
categoryethereum
json_metadata{"tags":["ethereum"],"links":["http://ethgasstation.info/"],"app":"steemit/0.1"}
created2017-09-19 19:01:42
last_update2017-09-19 19:01:42
depth2
children0
last_payout2017-09-26 19:01:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length302
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,355,313
net_rshares0
author_curate_reward""
vote details (1)
@davenavarro ·
Thanks very informative and to the point....
properties (22)
authordavenavarro
permlinkre-tomshwom-ethereum-gas-how-it-works-20180124t224339961z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-24 22:43:42
last_update2018-01-24 22:43:42
depth1
children0
last_payout2018-01-31 22:43:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length44
author_reputation43,419,243,058,982
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id32,036,362
net_rshares0
@dive-into-crypto ·
$0.05
This post has helped me to understand gas and gwei. thanks.
👍  
properties (23)
authordive-into-crypto
permlinkre-tomshwom-ethereum-gas-how-it-works-20180128t160326791z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-28 16:03:27
last_update2018-01-28 16:03:27
depth1
children0
last_payout2018-02-04 16:03:27
cashout_time1969-12-31 23:59:59
total_payout_value0.036 HBD
curator_payout_value0.009 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length59
author_reputation593,053,748
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,040,628
net_rshares5,753,619,723
author_curate_reward""
vote details (1)
@dive-into-crypto ·
clear explanation on gas limit and gwei!
👍  
properties (23)
authordive-into-crypto
permlinkre-tomshwom-ethereum-gas-how-it-works-20180727t145923503z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-07-27 14:59:24
last_update2018-07-27 14:59:24
depth1
children0
last_payout2018-08-03 14:59:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length40
author_reputation593,053,748
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id66,169,472
net_rshares220,816,007
author_curate_reward""
vote details (1)
@drifter007 ·
$0.02
Great read! I especially like that you showed all the units of ether. It really helped me understand it more with it displayed there like that. Thanks :D
👍  
properties (23)
authordrifter007
permlinkre-tomshwom-ethereum-gas-how-it-works-20180211t002831971z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-02-11 00:28:54
last_update2018-02-11 00:28:54
depth1
children0
last_payout2018-02-18 00:28:54
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.004 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length153
author_reputation61,097,907
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id36,536,062
net_rshares3,910,266,051
author_curate_reward""
vote details (1)
@edzynda ·
Is there any reliable way to determine how much gas your smart contract will consume based on the current gas price? That's the one piece that still confuses me.
👍  
properties (23)
authoredzynda
permlinkre-tomshwom-ethereum-gas-how-it-works-20170705t155926136z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-07-05 15:59:24
last_update2017-07-05 15:59:24
depth1
children1
last_payout2017-07-12 15:59:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length161
author_reputation586,512,469,499
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id7,413,091
net_rshares0
author_curate_reward""
vote details (1)
@tomshwom ·
$0.02
It depends.  Gas price is set for each instruction in the EVM, and you can see exactly which instructions will be run in a smart contract.  In this sense, you can absolutely know how much gas a function in a contract will cost.  The tricky part is that there can be loops/jumps that will change how many times a function runs, and that can't be known sometimes.
👍  
properties (23)
authortomshwom
permlinkre-edzynda-re-tomshwom-ethereum-gas-how-it-works-20170919t133843201z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-19 13:38:42
last_update2017-09-19 13:38:42
depth2
children0
last_payout2017-09-26 13:38:42
cashout_time1969-12-31 23:59:59
total_payout_value0.022 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length361
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,327,055
net_rshares9,183,678,714
author_curate_reward""
vote details (1)
@elowin ·
I enjoyed this.  Keep up the good work -- followed.
👍  
properties (23)
authorelowin
permlinkre-tomshwom-ethereum-gas-how-it-works-20170526t051532823z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-05-26 05:15:36
last_update2017-05-26 05:15:36
depth1
children0
last_payout2017-06-02 05:15:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length51
author_reputation1,280,916,750,985
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id3,807,171
net_rshares1,712,361,033
author_curate_reward""
vote details (1)
@felix.herrmann ·
cool - came here from a @ivanli course
properties (22)
authorfelix.herrmann
permlinkq73d20
categoryethereum
json_metadata{"users":["ivanli"],"app":"steemit/0.2"}
created2020-03-12 17:39:39
last_update2020-03-12 17:39:39
depth1
children0
last_payout2020-03-19 17:39:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length38
author_reputation126,511,129,199,183
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id96,296,769
net_rshares0
@fiserman ·
This is actually one of the better articles I could find on Google about [Ethereum](bitopia.io) gas, lol.
👍  ,
properties (23)
authorfiserman
permlinkq5jzzn
categoryethereum
json_metadata{"links":["bitopia.io"],"app":"steemit/0.1"}
created2020-02-11 17:09:24
last_update2020-02-11 17:09:24
depth1
children0
last_payout2020-02-18 17:09:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length105
author_reputation33,332,677,735,741
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id95,338,462
net_rshares2,027,999,115
author_curate_reward""
vote details (2)
@hatemk ·
Hoi that is awesome explained! great job thanks man
👍  
properties (23)
authorhatemk
permlinkre-tomshwom-ethereum-gas-how-it-works-20180402t000308514z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-04-02 00:03:06
last_update2018-04-02 00:03:06
depth1
children0
last_payout2018-04-09 00:03:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length51
author_reputation20,386,138,730
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id47,845,608
net_rshares220,816,007
author_curate_reward""
vote details (1)
@hausbau ·
$0.05
Excellent explanation !!
Compliments. Thanks for sharing.
👍  , ,
properties (23)
authorhausbau
permlinkre-tomshwom-ethereum-gas-how-it-works-20170629t000614822z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-06-29 00:06:15
last_update2017-06-29 00:06:15
depth1
children0
last_payout2017-07-06 00:06:15
cashout_time1969-12-31 23:59:59
total_payout_value0.050 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length57
author_reputation70,780,390,315
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id6,550,461
net_rshares6,090,738,524
author_curate_reward""
vote details (3)
@hoomy · (edited)
$0.02
Hello there. A complete newbie with only 1 week worth of reading here! Dont be harsh on me!
So after finishing reading i have this one question. 
There is ether which is the main currency which fuels everything and tokens are based on. And you can send and receive ether through transactions. What is the job of gas exactly in this happening?!
Thanks for the great article. Needs many rereads  on my part. :))
👍  
properties (23)
authorhoomy
permlinkre-tomshwom-ethereum-gas-how-it-works-20171111t215042141z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-11 21:50:48
last_update2017-11-11 21:51:21
depth1
children10
last_payout2017-11-18 21:50:48
cashout_time1969-12-31 23:59:59
total_payout_value0.019 HBD
curator_payout_value0.005 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length409
author_reputation4,984,899,478
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,090,984
net_rshares11,944,810,155
author_curate_reward""
vote details (1)
@hoomy ·
$0.58
Ok so i now know the answer (i think) and will put it here for it might be of use to someone noob like myself.
Sending and receiving ether and tokens are not free as i thought. A price should be paid for miners to put your transaction in a block and add it to the chain. And that price is payed in ether and is called gas for that transaction.
👍  , ,
properties (23)
authorhoomy
permlinkre-hoomy-re-tomshwom-ethereum-gas-how-it-works-20171112t071945224z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-12 07:19:51
last_update2017-11-12 07:19:51
depth2
children9
last_payout2017-11-19 07:19:51
cashout_time1969-12-31 23:59:59
total_payout_value0.439 HBD
curator_payout_value0.145 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length343
author_reputation4,984,899,478
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,121,006
net_rshares278,714,913,762
author_curate_reward""
vote details (3)
@hoomy · (edited)
$0.03
And now my question would be 1. Am i right on the fact that gas is awarded to miners or what miners mine has nothing to do with it?
And 2. So when buying tokens there are two things to consider. First how much we want to invest and second how much we are willing to spend on that attempt to invest. Whats the purpose of this second thing? Any analogy to the common banking system would be helpful and very appreciated.
👍  ,
properties (23)
authorhoomy
permlinkre-hoomy-re-hoomy-re-tomshwom-ethereum-gas-how-it-works-20171112t072538381z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-12 07:25:42
last_update2017-11-12 07:26:36
depth3
children8
last_payout2017-11-19 07:25:42
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.005 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length418
author_reputation4,984,899,478
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,121,387
net_rshares12,655,542,622
author_curate_reward""
vote details (2)
@hoomy · (edited)
Ok enough subposts!

I have another question may you take the time to answer!

One of the great things about a cryptocurrency based on blockchains is that you dont need to pay taxes and or any fees to banks and institution.

Is gas in fact some sort of tax/incentive payed not to bankers but the whole network of miners who agree to keep record of everything(i.e. mine)?

Is this what comprises the famous PoW system?(just connecting what i know :shy)
properties (22)
authorhoomy
permlinkre-tomshwom-ethereum-gas-how-it-works-20171113t135142902z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-13 13:51:48
last_update2017-11-13 14:38:09
depth1
children2
last_payout2017-11-20 13:51:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length451
author_reputation4,984,899,478
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,253,631
net_rshares0
@tomshwom ·
$0.03
Whoa, you are very, very wrong to think you don't have to pay taxes on crypto.  I won't speak to other countries, although I do know they have tax laws that effect crypto, but in the US you must file capital gains tax for any crypto holdings you buy/sell/trade.

I think what you're really trying to get at is that crypto can eliminate the middle-man who takes a cut.  While this *can* be done, there's many times when middle-men are still present in crypto too.  

One example is decentralized exchanges using the 0x protocol.  The trustless trade of one token for another at a certain exchange rate can be done without a fee, but decentralized exchanges acting as transaction relayers are providing a service at a cost, so they should and do inject a fee into these transactions.

> Is gas in fact some sort of tax/incentive payed not to bankers but the whole network of miners who agree to keep record of everything(i.e. mine)?

Gas is the scaling factor that makes the fee proportional to the computational work done, not the fee itself.  The fee is paid in Ether.

This fee exists to prevent people from attacking the blockchain and to incentivize miners to maintain the network.  If you didn't pay miners, then they wouldn't mine and you wouldn't have a blockchain.

Proof of Work consensus is it's own thing.  It can be applied to blockchain technology, and most blockchains do use it, but it is not limited to this one application.  PoW has a lot more to it than just fees & computers doing "stuff".
👍  ,
properties (23)
authortomshwom
permlinkre-hoomy-re-tomshwom-ethereum-gas-how-it-works-20171114t150829615z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-14 15:08:30
last_update2017-11-14 15:08:30
depth2
children1
last_payout2017-11-21 15:08:30
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.005 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,507
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,367,415
net_rshares13,332,744,473
author_curate_reward""
vote details (2)
@hoomy ·
Thanks a lot!
properties (22)
authorhoomy
permlinkre-tomshwom-re-hoomy-re-tomshwom-ethereum-gas-how-it-works-20171115t044848536z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-15 04:48:48
last_update2017-11-15 04:48:48
depth3
children0
last_payout2017-11-22 04:48:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation4,984,899,478
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,429,032
net_rshares0
@internationale ·
$0.12
Thanks a bunch man! I have multiple MEW accounts and this helped a lot in loading my ETH wallets for transfer fees. :D
👍  ,
properties (23)
authorinternationale
permlinkre-tomshwom-ethereum-gas-how-it-works-20171230t043958744z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-12-30 04:40:03
last_update2017-12-30 04:40:03
depth1
children0
last_payout2018-01-06 04:40:03
cashout_time1969-12-31 23:59:59
total_payout_value0.096 HBD
curator_payout_value0.027 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length118
author_reputation249,052,629
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id25,989,561
net_rshares9,438,070,593
author_curate_reward""
vote details (2)
@ivrmakers ·
ok.. Your article is super informative, single place to all queries.. I read your article & still lost some eth in failed transaction due to low gas..

https://etherscan.io/tx/0xab645b8a38a9c60beb3fd77e61c50aaeaffef11724aa7decf430dcb9b037cbef

Why this transaction failed.. I put 150000 gas, 1.1 gwei & it still ran out of gas where minimum gas was 90000..

Please explain
properties (22)
authorivrmakers
permlinkre-tomshwom-ethereum-gas-how-it-works-20180218t180003662z
categoryethereum
json_metadata{"tags":["ethereum"],"links":["https://etherscan.io/tx/0xab645b8a38a9c60beb3fd77e61c50aaeaffef11724aa7decf430dcb9b037cbef"],"app":"steemit/0.1"}
created2018-02-18 18:00:06
last_update2018-02-18 18:00:06
depth1
children7
last_payout2018-02-25 18:00:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length372
author_reputation122,177,855,397
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,575,693
net_rshares0
@tomshwom ·
$0.07
The EOS Crowdsale contract has an iterative function.  That means part of the code can be called many many times, and the exact amount depends from person to person.  Unfortunately, there is no good way to estimate how much gas a variable execution function will consume unless you execute it virtually off-chain to see.

You lost ~$0.26, so not big loss.  Try again with 500k maybe.
👍  ,
properties (23)
authortomshwom
permlinkre-ivrmakers-re-tomshwom-ethereum-gas-how-it-works-20180219t160714763z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-02-19 16:07:15
last_update2018-02-19 16:07:15
depth2
children6
last_payout2018-02-26 16:07:15
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.013 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length383
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,825,514
net_rshares12,005,107,054
author_curate_reward""
vote details (2)
@ivrmakers ·
$0.24
thanks for your input.. i lost more than 0.26.. & second.. how to execute it off the chain
👍  , , , , , , , , ,
properties (23)
authorivrmakers
permlinkre-tomshwom-re-ivrmakers-re-tomshwom-ethereum-gas-how-it-works-20180219t182927258z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-02-19 18:29:30
last_update2018-02-19 18:29:30
depth3
children5
last_payout2018-02-26 18:29:30
cashout_time1969-12-31 23:59:59
total_payout_value0.238 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length90
author_reputation122,177,855,397
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,854,709
net_rshares42,635,881,493
author_curate_reward""
vote details (10)
@jawdy ·
incredibly informative @tomshwom, great share my friend!
👍  ,
properties (23)
authorjawdy
permlinkre-tomshwom-ethereum-gas-how-it-works-20170526t022750069z
categoryethereum
json_metadata{"tags":["ethereum"],"users":["tomshwom"],"app":"steemit/0.1"}
created2017-05-26 02:27:51
last_update2017-05-26 02:27:51
depth1
children1
last_payout2017-06-02 02:27:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length56
author_reputation1,269,284,041,989
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id3,803,375
net_rshares1,712,361,033
author_curate_reward""
vote details (2)
@tomshwom ·
thanks man!  glad my first post was useful
👍  ,
properties (23)
authortomshwom
permlinkre-jawdy-re-tomshwom-ethereum-gas-how-it-works-20170526t030915542z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-05-26 03:09:15
last_update2017-05-26 03:09:15
depth2
children0
last_payout2017-06-02 03:09:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length42
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id3,804,470
net_rshares1,712,361,033
author_curate_reward""
vote details (2)
@jcpython ·
$0.07
This is a great explanation of ETH transaction fees, I have always steered away from ETH because of this learning curve. Thank you so much for taking the time to make this more clear for the ones newer in the crypto space like myself.
👍  ,
properties (23)
authorjcpython
permlinkre-tomshwom-ethereum-gas-how-it-works-20180114t172750373z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-14 17:27:48
last_update2018-01-14 17:27:48
depth1
children0
last_payout2018-01-21 17:27:48
cashout_time1969-12-31 23:59:59
total_payout_value0.053 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length234
author_reputation3,871,010,916
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,508,755
net_rshares7,481,766,974
author_curate_reward""
vote details (2)
@ladyrednails ·
$0.05
thank you so much!
👍  ,
properties (23)
authorladyrednails
permlinkre-tomshwom-ethereum-gas-how-it-works-20180129t152159412z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-29 15:22:00
last_update2018-01-29 15:22:00
depth1
children0
last_payout2018-02-05 15:22:00
cashout_time1969-12-31 23:59:59
total_payout_value0.045 HBD
curator_payout_value0.008 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length18
author_reputation2,643,299,291,456
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,313,767
net_rshares7,657,772,817
author_curate_reward""
vote details (2)
@minerx ·
$0.04
So I came here expecting to learn about gas price and gas limit but it still seems confusing. Why the separation of the two? Why not have just one fee? I can add much gas and pay little for it or add little gas and pay a fortune for it. What is the difference exactly?
👍  
properties (23)
authorminerx
permlinkre-tomshwom-ethereum-gas-how-it-works-20171202t041612600z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-12-02 04:16:12
last_update2017-12-02 04:16:12
depth1
children1
last_payout2017-12-09 04:16:12
cashout_time1969-12-31 23:59:59
total_payout_value0.032 HBD
curator_payout_value0.009 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length268
author_reputation1,973,114,902
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id22,149,520
net_rshares11,954,790,727
author_curate_reward""
vote details (1)
@tomshwom ·
$0.05
Gas itself exists to accurately represent computational work.  Ether, and thus value, is not a good measurement of this work because the value is so volatile. Can you imagine if there was a flat fee in Ether that you paid for transactions, and it was set when Ether was $10? Why would you pay 50x more for the same work just because Ether is worth more?

You need gas so that somebody doesn't write code to execute an infinite loop that would stall the blockchain. You need gas so that each individual opcode in the EVM can be accurately weighted proportionally to electrical costs (or other costs such as storage) of performing the operation.  

The actual fee is up to the free market to determine via gas price, but the computation is a set amount and needs a separate unit to be represented in.
👍  , , ,
properties (23)
authortomshwom
permlinkre-minerx-re-tomshwom-ethereum-gas-how-it-works-20171202t181320028z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-12-02 18:13:18
last_update2017-12-02 18:13:18
depth2
children0
last_payout2017-12-09 18:13:18
cashout_time1969-12-31 23:59:59
total_payout_value0.038 HBD
curator_payout_value0.010 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length798
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id22,203,532
net_rshares13,266,443,799
author_curate_reward""
vote details (4)
@nandubatchu ·
Hi @tomshwom, Can you elaborate a bit on how can we reliably determine the gas for ERC20 transfer method for all the tokens available in the market? Each token seems to be using different amounts of gas and the gas amount is also observed to vary with each transaction. Can you clarify what determines the gasUsed and why is this varying a lot?
👍  
properties (23)
authornandubatchu
permlinkre-tomshwom-ethereum-gas-how-it-works-20180713t122203425z
categoryethereum
json_metadata{"tags":["ethereum"],"users":["tomshwom"],"app":"steemit/0.1"}
created2018-07-13 12:22:03
last_update2018-07-13 12:22:03
depth1
children1
last_payout2018-07-20 12:22:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length344
author_reputation-13,958,820,956
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id64,527,615
net_rshares220,816,007
author_curate_reward""
vote details (1)
@tomshwom ·
ERC20 is only a spec in terms of which functions are required to exist and what they do, not how they are written or what additional functions are present.  Because of this, you can have many ERC20 compliant tokens that do completely different things, meaning they have different code and thus require different amounts of gas to execute in the EVM.

You can't reliably *determine* gas without pre-executing the contract.  Even then, if something depends on the state, you can't even be correct 100% of the time with pre-execution.  However, you can reliably *estimate* the amount by simply checking similar transactions to the contract that were successful.  This is how many interfaces estimate gas cost, and it's generally good enough.
👍  
properties (23)
authortomshwom
permlinkre-nandubatchu-re-tomshwom-ethereum-gas-how-it-works-20180713t134236573z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-07-13 13:42:36
last_update2018-07-13 13:42:36
depth2
children0
last_payout2018-07-20 13:42:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length738
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id64,535,911
net_rshares217,503,767
author_curate_reward""
vote details (1)
@onionwushu ·
$0.02
Thanks for this explanation, very informative. Still i have a question. How does the gas price relate to the fluctuation of Ether value? We've seen Ether as a very volatile currency so far, but it wouldn't be fair if the gas price doesn't consider this right?
👍  
properties (23)
authoronionwushu
permlinkre-tomshwom-ethereum-gas-how-it-works-20170919t045935571z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-19 04:58:30
last_update2017-09-19 04:58:30
depth1
children1
last_payout2017-09-26 04:58:30
cashout_time1969-12-31 23:59:59
total_payout_value0.018 HBD
curator_payout_value0.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length259
author_reputation155,243,106
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,292,649
net_rshares9,935,558,842
author_curate_reward""
vote details (1)
@tomshwom ·
$0.02
Gas price doesn't have a real "going rate" like ETH does.  Looking at http://ethgasstation.info/, There's 13% of blocks right now being mined by pools that accept 0 gwei for gas price, so it's totally possible to make transfers without paying any fees at all.  The difference is that you may have to wait a bit longer for your transaction to be included in a block (because you only have a 13% chance that a pool who accepts your transaction will mine it).

Also, gas fees are very small.  The median gas fee is about $0.26, which is actually quite high right now for Ethereum (in part due to the difficulty bomb before Metropolis).  

If there was more competition over price, and if the prices were significant for people to actually profit, then gas fees might become more aligned with the ETH price.  I'd rather have it be separate though.
👍  
properties (23)
authortomshwom
permlinkre-onionwushu-re-tomshwom-ethereum-gas-how-it-works-20170919t133206274z
categoryethereum
json_metadata{"tags":["ethereum"],"links":["http://ethgasstation.info/"],"app":"steemit/0.1"}
created2017-09-19 13:32:06
last_update2017-09-19 13:32:06
depth2
children0
last_payout2017-09-26 13:32:06
cashout_time1969-12-31 23:59:59
total_payout_value0.023 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length843
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,326,541
net_rshares9,720,735,948
author_curate_reward""
vote details (1)
@powderskier ·
Very nice article. Doesn't this seem a bit cumbersome of a process in order to execute a smart contract? I don't see my mother or family members being able to take the time to learn how to execute this type of a contract and that will essentially limit the adoption rate of blockchain tech.
properties (22)
authorpowderskier
permlinkre-tomshwom-ethereum-gas-how-it-works-20180113t151409932z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-13 15:14:12
last_update2018-01-13 15:14:12
depth1
children2
last_payout2018-01-20 15:14:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length290
author_reputation81,526,482,443
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,249,456
net_rshares0
@tomshwom ·
$0.06
Your mother & family probably aren't capable of securely owning their private key either, so they can and should allow trusted 3rd parties like exchanges manage their funds.  Leave it to these entities to also take the complexity out on the user's end.

If that's a problem, then I really don't think gas is particularly complicated.  You have to put enough gas in your car to make a trip, and that's universally accepted as a simple fact.  It's pretty much the same with Ethereum, except there's a competitive market for gas prices.  

Again, a user that doesn't understand the very basics of blockchain / smart contracts / simple public-key cryptography, and things like gas really should not be part of this ecosystem right now.  Crypto is in alpha-stage, and it gets significantly more complicated that these fundamental building blocks.  It's actually been abstracted extremely well so that all the people that are in crypto today can actually use it.
👍  ,
properties (23)
authortomshwom
permlinkre-powderskier-re-tomshwom-ethereum-gas-how-it-works-20180115t144008262z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-15 14:40:09
last_update2018-01-15 14:40:09
depth2
children1
last_payout2018-01-22 14:40:09
cashout_time1969-12-31 23:59:59
total_payout_value0.043 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length956
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id29,717,639
net_rshares6,675,316,465
author_curate_reward""
vote details (2)
@powderskier ·
Thanks @tomshwom. I appreciate this response and you make many good points. 
"so they can and should allow trusted 3rd parties like exchanges manage their funds."
Very true. The sooner that we, as blockchain developers, can simply the secure handling of private keys for the layperson, the more rapidly crypto will become mainstream. I think future economy is really going to be technology and information based so those who don't learn these simple skills will be left for the lions.
properties (22)
authorpowderskier
permlinkre-tomshwom-re-powderskier-re-tomshwom-ethereum-gas-how-it-works-20180215t203840995z
categoryethereum
json_metadata{"tags":["ethereum"],"users":["tomshwom"],"app":"steemit/0.1"}
created2018-02-15 20:38:39
last_update2018-02-15 20:38:39
depth3
children0
last_payout2018-02-22 20:38:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length484
author_reputation81,526,482,443
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id37,831,434
net_rshares0
@pravr ·
If you can wait a while, let's say a day, for the transaction to go through. You said the gas limit should be minimum 21000, but what's the minimum gas price I should use?
properties (22)
authorpravr
permlinkre-tomshwom-ethereum-gas-how-it-works-20171231t233036767z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-12-31 23:30:39
last_update2017-12-31 23:30:39
depth1
children2
last_payout2018-01-07 23:30:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length171
author_reputation472,325,283
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,287,663
net_rshares0
@tomshwom ·
$0.12
0 is the minimum since you literally can't go lower..  In a practical sense, the amount you want to use for gas price fluctuates since it depends on market value.  Go to ethgasstation.info to see current competitive gas prices.
👍  ,
properties (23)
authortomshwom
permlinkre-pravr-re-tomshwom-ethereum-gas-how-it-works-20180102t221346306z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-02 22:13:45
last_update2018-01-02 22:13:45
depth2
children1
last_payout2018-01-09 22:13:45
cashout_time1969-12-31 23:59:59
total_payout_value0.116 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length227
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,644,452
net_rshares10,268,230,932
author_curate_reward""
vote details (2)
@pravr ·
$0.08
Thanks!
👍  
properties (23)
authorpravr
permlinkre-tomshwom-re-pravr-re-tomshwom-ethereum-gas-how-it-works-20180105t003732502z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-05 00:37:33
last_update2018-01-05 00:37:33
depth3
children0
last_payout2018-01-12 00:37:33
cashout_time1969-12-31 23:59:59
total_payout_value0.066 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7
author_reputation472,325,283
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id27,151,823
net_rshares8,515,432,227
author_curate_reward""
vote details (1)
@rksumanthraju ·
$0.03
You made it look so simple !!!
👍  ,
properties (23)
authorrksumanthraju
permlinkre-tomshwom-ethereum-gas-how-it-works-20171014t175648012z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-10-14 17:56:51
last_update2017-10-14 17:56:51
depth1
children0
last_payout2017-10-21 17:56:51
cashout_time1969-12-31 23:59:59
total_payout_value0.023 HBD
curator_payout_value0.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length30
author_reputation2,618,068,341,408
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id17,686,510
net_rshares12,541,005,168
author_curate_reward""
vote details (2)
@sahilsarpal ·
Is there any api to find the current gas price, which i can see in ethgasstation, also i wonder how meta mask determine the current gas price automatically.
👍  
properties (23)
authorsahilsarpal
permlinkre-tomshwom-ethereum-gas-how-it-works-20180906t084234421z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-09-06 08:42:36
last_update2018-09-06 08:42:36
depth1
children1
last_payout2018-09-13 08:42:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length156
author_reputation14,564,953
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id70,482,398
net_rshares220,816,007
author_curate_reward""
vote details (1)
@tomshwom ·
Gas price is calculated on ethgasstation and metamask by looking at the average gas price of previous blocks.  You can't query the blockchain for gas price, it's not something the blockchain manages or has control over.

Here's a link to the ethgasstation-api github repo: https://github.com/ethgasstation/ethgasstation-api
👍  
properties (23)
authortomshwom
permlinkre-sahilsarpal-re-tomshwom-ethereum-gas-how-it-works-20180906t140838435z
categoryethereum
json_metadata{"tags":["ethereum"],"links":["https://github.com/ethgasstation/ethgasstation-api"],"app":"steemit/0.1"}
created2018-09-06 14:08:39
last_update2018-09-06 14:08:39
depth2
children0
last_payout2018-09-13 14:08:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length323
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id70,507,538
net_rshares217,503,767
author_curate_reward""
vote details (1)
@sidjames ·
$0.07
This has been really helpful. I'm already in BTC, LTC and a few alts but recently purchased some Ether to play around with CryptoKitties and the Gas/Gwei thing was a little confusing from the outside. Not as worried about being overcharged now. Thanks! :)
👍  ,
properties (23)
authorsidjames
permlinkre-tomshwom-ethereum-gas-how-it-works-20171218t143238864z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-12-18 14:32:39
last_update2017-12-18 14:32:39
depth1
children0
last_payout2017-12-25 14:32:39
cashout_time1969-12-31 23:59:59
total_payout_value0.071 HBD
curator_payout_value0.003 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length255
author_reputation956,531,184
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,031,929
net_rshares12,423,903,245
author_curate_reward""
vote details (2)
@sowmayjain ·
$0.04
A quick question arose from "So I should always specify a large gas limit since I'll be refunded?" phrase from your article.

A function takes 40,000 Gas Units to execute. Which one of the following function calls will miner prefer to take?

1) Call with 100,000 Gas Units.
2) Call with 50,000 Gas Units.

Provided that the miner is paid for just 40,000 gas unit operations, they will prefer 2nd function call as it takes less total block size limit compared to 1st call.

Does the algorithm for tx selection from txpool work like this?
👍  
properties (23)
authorsowmayjain
permlinkre-tomshwom-ethereum-gas-how-it-works-20180130t123704365z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-30 12:37:09
last_update2018-01-30 12:37:09
depth1
children1
last_payout2018-02-06 12:37:09
cashout_time1969-12-31 23:59:59
total_payout_value0.030 HBD
curator_payout_value0.007 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length536
author_reputation88,553,693
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,561,613
net_rshares5,667,436,366
author_curate_reward""
vote details (1)
@tomshwom ·
$0.03
Preferring the call with 50k is better for the miner since it frees up 50k in the block for additional transactions hat will actually result in fees.

However, I had a conversation with the person behind a lot of the ethgasstation.info site programming and we found that this is not how actual miners are working.  Looking at historical transactions, miners are pretty dumb.  They almost always prefer higher gas price and don't look at gas limit, regardless of whether it's high or low.

Miners don't usually account for gas limit until it exceeds 1M or so, in which case they simply ignore it regardless of gas price.

For a demographic that thrives on cost optimization, this was a strange result to find.  I'd expect it to change in the future, but who knows.
👍  
properties (23)
authortomshwom
permlinkre-sowmayjain-re-tomshwom-ethereum-gas-how-it-works-20180130t150817512z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-01-30 15:08:18
last_update2018-01-30 15:08:18
depth2
children0
last_payout2018-02-06 15:08:18
cashout_time1969-12-31 23:59:59
total_payout_value0.034 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length763
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id33,592,566
net_rshares5,552,361,516
author_curate_reward""
vote details (1)
@thecryptotrader ·
$1.19
Hey, very helpful, but what's the MINIMUM amount of gwei to put to let the transaction does not fail? i mean, if i set 0.1 gwei, the transaction may go into "limbo" and never execute? if yes, what is the minimum price?( don't care if it will be slow)
👍  , , , , , , , ,
properties (23)
authorthecryptotrader
permlinkre-tomshwom-ethereum-gas-how-it-works-20171104t210243067z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-04 21:02:42
last_update2017-11-04 21:02:42
depth1
children3
last_payout2017-11-11 21:02:42
cashout_time1969-12-31 23:59:59
total_payout_value0.890 HBD
curator_payout_value0.296 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length250
author_reputation26,975,551,195,347
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id19,466,110
net_rshares556,308,460,145
author_curate_reward""
vote details (9)
@tomshwom ·
$0.04
There isn't one.  You can do 0 gwei and miners can accept it if they want.  It may never actually be accepted, but it can be.
👍  , , , ,
properties (23)
authortomshwom
permlinkre-thecryptotrader-re-tomshwom-ethereum-gas-how-it-works-20171105t225546386z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-05 22:55:45
last_update2017-11-05 22:55:45
depth2
children2
last_payout2017-11-12 22:55:45
cashout_time1969-12-31 23:59:59
total_payout_value0.036 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length125
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id19,556,365
net_rshares18,154,023,728
author_curate_reward""
vote details (5)
@thecryptotrader ·
$0.99
Thanks, but do you think that with 0.1 or 0.5 gwei might be accepted or there are some chances to never be accepted?  i must do thousands of transactions, so i'm trying to spend as low as possible..
👍  
properties (23)
authorthecryptotrader
permlinkre-tomshwom-re-thecryptotrader-re-tomshwom-ethereum-gas-how-it-works-20171105t232131486z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-11-05 23:21:33
last_update2017-11-05 23:21:33
depth3
children1
last_payout2017-11-12 23:21:33
cashout_time1969-12-31 23:59:59
total_payout_value0.743 HBD
curator_payout_value0.247 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length198
author_reputation26,975,551,195,347
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id19,557,677
net_rshares472,563,100,553
author_curate_reward""
vote details (1)
@tooktheredpill ·
$0.08
thank you.  No one has explained it properly like you did in this post.  Thanx again!!
👍  , , ,
properties (23)
authortooktheredpill
permlinkre-tomshwom-ethereum-gas-how-it-works-20170624t134028658z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-06-24 13:40:30
last_update2017-06-24 13:40:30
depth1
children6
last_payout2017-07-01 13:40:30
cashout_time1969-12-31 23:59:59
total_payout_value0.062 HBD
curator_payout_value0.017 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length86
author_reputation2,106,281,092
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id5,910,296
net_rshares7,245,570,105
author_curate_reward""
vote details (4)
@cliffordhodaka ·
If this is how ethereum works, then that's some bullshit right there. A failed contract took an $18.00 fee in ethereum from me. If there is any error   error then kiss your fee goodbye. Sounds like bad business to me.
👍  
👎  
properties (23)
authorcliffordhodaka
permlinkre-tooktheredpill-re-tomshwom-ethereum-gas-how-it-works-20170830t231317853z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-08-30 23:13:18
last_update2017-08-30 23:13:18
depth2
children2
last_payout2017-09-06 23:13:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length217
author_reputation2,543,315,110
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id13,389,777
net_rshares0
author_curate_reward""
vote details (2)
@tomshwom ·
$0.02
I doubt the contract was written incorrectly, so it's likely that you either executed it improperly or executed it properly but you didn't know what it would do and it turned out different than what you expected.

In either case, **you** set the gas price and agreed to "lose" your money.  It's your fault, not the Ethereum Networks, and almost certainly not the contract's.
👍  , , ,
properties (23)
authortomshwom
permlinkre-cliffordhodaka-re-tooktheredpill-re-tomshwom-ethereum-gas-how-it-works-20170919t133659125z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-19 13:36:57
last_update2017-09-19 13:36:57
depth3
children1
last_payout2017-09-26 13:36:57
cashout_time1969-12-31 23:59:59
total_payout_value0.023 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length374
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,326,900
net_rshares9,344,795,884
author_curate_reward""
vote details (4)
@tomshwom ·
Glad it was helpful!
👍  ,
properties (23)
authortomshwom
permlinkre-tooktheredpill-re-tomshwom-ethereum-gas-how-it-works-20170627t140824344z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-06-27 14:08:24
last_update2017-06-27 14:08:24
depth2
children2
last_payout2017-07-04 14:08:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length20
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id6,335,430
net_rshares0
author_curate_reward""
vote details (2)
@mrbadwolf ·
$0.03
I have 1 question. What would it be the highest gas posible? And how would it cost? THX
👍  
properties (23)
authormrbadwolf
permlinkre-tomshwom-re-tooktheredpill-re-tomshwom-ethereum-gas-how-it-works-20170828t182801045z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-08-28 18:28:00
last_update2017-08-28 18:28:00
depth3
children1
last_payout2017-09-04 18:28:00
cashout_time1969-12-31 23:59:59
total_payout_value0.019 HBD
curator_payout_value0.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length87
author_reputation488,576,467
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id13,150,952
net_rshares7,375,778,768
author_curate_reward""
vote details (1)
@volkswagener ·
This was super helpful! Thanks for the post.
properties (22)
authorvolkswagener
permlinkre-tomshwom-ethereum-gas-how-it-works-20180302t054025909z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2018-03-02 05:40:12
last_update2018-03-02 05:40:12
depth1
children0
last_payout2018-03-09 05:40:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length44
author_reputation222,866,394
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id41,557,778
net_rshares0
@wekkel ·
$0.02
Question: do only miners perform transactions on the network besides mining blocks or can a node also perform transactions (and reveive gas for it) without mining?
👍  
properties (23)
authorwekkel
permlinkre-tomshwom-ethereum-gas-how-it-works-20170916t114109900z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-16 11:41:12
last_update2017-09-16 11:41:12
depth1
children1
last_payout2017-09-23 11:41:12
cashout_time1969-12-31 23:59:59
total_payout_value0.024 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length163
author_reputation793,854,297,842
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,048,322
net_rshares9,559,618,778
author_curate_reward""
vote details (1)
@tomshwom ·
$0.03
You're missing what "performing transactions" actually means.  The blocks *are* the transactions.  Nothing is valid if it's not included in a block that is part of the canonical blockchain.  Miners are the ones who assemble blocks from several transactions, and link them to the blockchain.

Things like side-channels are performed off-chain, but are still settled and only valid on-chain.  Since they are side-chain, there is no gas or transaction fees (unless that's part of the specific transaction), and mining isn't required until settlement, which is on-chain.
👍  
properties (23)
authortomshwom
permlinkre-wekkel-re-tomshwom-ethereum-gas-how-it-works-20170917t050916397z
categoryethereum
json_metadata{"tags":["ethereum"],"app":"steemit/0.1"}
created2017-09-17 05:09:15
last_update2017-09-17 05:09:15
depth2
children0
last_payout2017-09-24 05:09:15
cashout_time1969-12-31 23:59:59
total_payout_value0.019 HBD
curator_payout_value0.006 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length566
author_reputation1,713,446,395,686
root_title"Ethereum "Gas" - How it Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,107,830
net_rshares10,150,381,736
author_curate_reward""
vote details (1)