什么是gas?
由于现阶段一些ico项目在各平台出现一抢而空的情况,逐渐官网直接转eth变成比较好的ico渠道。但在转eth的过程中,我们会遇到需要输入gas price 及 gas limit。所以,需要深入了解下什么是gas。
以太坊是一个区块链的网络,当你在这个网络中进行以太币ETH转账时,就需要付一些手续费,这个手续费就是用gas计算的。
首先申明的是,不管这笔转账成功与否,以太坊的矿工都会收取一定的TX费用,这个TX fee包含两个方面,Gas Limit * Gas Price. 但这个TX fee 并不是实际消耗的费用,在etherscan.io中,我们看一笔转账消耗的手续费是 Actual Tx Cost/Fee = Gas used * Gas price
这时候,就要详细说明下Gas Limit / Gas price / Gas used。我们可以想象转账就是派车送东西给对方,把gas limit比作汽车的油箱,你愿意最多给多少升油;gas price 比作油价。实际用掉多少汽油(gas used) 的总价,就是转账的实际手续费。如果gas limit 过低的话,结果就是油不够,派送失败,交易也会取消,但交易费是不退的。
矿工们会按gas price 的高低优先选取交易放到区块链中,原则上想尽快被抓取就多设置点。
Gas price 一般的单位是gwei, 10*9 gwei = 1 eth, 平时40gwei是已经很高的,最多可以设为100gwei .这种的话相应手续费也会变高。
Gas Limit, 普通的交易默认会设置21000,建议别设置比这个值小了,会交易失败哒。但是在紧急情况下,建议还是设置100000或100000以上,这样这笔交易不会因为网络的拥堵而造成交易到不了目的地,结果白白浪费交易费。当然设置的高的话,仅会计算实际用掉的gas,就是gas used。
最后计算下一些交易费:
普通设置
gas limit = 21000 ; gas price = 20 gwei; gas used = 21000
actual TX fee= 21000 * 0.00000002 = 0.00042 eth
紧急设置
gas limit = 100000 ; gas price = 100 gwei; gas used = 45000
actual TX fee = 45000 * 0.0000001 = 0.0045 eth
Congratulations @milesmao233! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOPInteresting
I will follow you to see your future posts! +upvote
Congratulations @milesmao233! You have received a personal award!
Click on the badge to view your Board of Honor.
Do not miss the last post from @steemitboard:
SteemitBoard and the Veterans on Steemit - The First Community Badge.
Congratulations @milesmao233! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!