Gas、Gas Limit and Gas Price

https://masterthecrypto.com/ethereum-what-is-gas-gas-limit-gas-price/

Gas是衡量計算量的單位

What is Gas?
Gas is a unit of measuring the computational work of running transactions or smart contracts in the Ethereum network. This system is similar to the use of kilowatts (kW) for measuring electricity in your house; the electricity you use isn’t measured in dollars and cents but instead through kWH or Kilowatts per hour.
什么是煤氣?
天然氣是測量以太坊網絡中運行交易或智能合約的計算工作的單位。該系統類似于使用千瓦(kW)來測量房屋內的電力;您使用的電力不是以美元和美分計量,而是以每小時千瓦時或千瓦計。

Gas Limit是您愿意花費的交易費

Gas Limit
Gas limit refers to the maximum amount of gas you’re willing to spend on a particular transaction.
是指您愿意花費在特定交易上的最大氣量。

What if You Specify Too Little Gas?
Your transaction will be initially executed by the miners, but once gas runs out the miners will STOP performing work on your transaction. The blockchain will record the transaction as “Failed”, and your ETH will still be in your wallet since there was insufficient gas to fully execute the transfer. The gas used for the failed transaction will be kept by the miners for their work and you WILL NOT get it back.
如果您指定的gas太少,該怎么辦?
您的交易最初將由礦工執行,但一旦gas用完,礦工將停止執行交易的工作。 區塊鏈會將交易記錄為“失敗”,并且由于沒有足夠的gas來完全執行轉帳,您的ETH仍將存在您的錢包中。 用于交易失敗的gas將由礦工為他們的工作保留,并且您不會收回。
如果你指定的gas太少,這將會發生什么、交易會失敗、失敗原因是out of gas。

Gas Price 對每單位gas的你愿意支付的價格

Gas Price
Gas price refers to the amount of Ether you’re willing to pay for every unit of gas, and is usually measured in “Gwei”.
天然氣價格是指你愿意為每個單位天然氣支付的乙醚量,通常以“Gwei”來衡量。

看一筆交易

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

Gas Limit: Maximum amount of gas that a user will pay for this transaction. The default amount for a standard ETH transfer is 21,000 gas

Gas Used by Txn: Actual amount of gas used to execute the transaction. Since this is a standard transfer, the gas used is also 21,000

Gas Price: Amount of ETH a user is prepared to pay for each unit of gas. The user chose to pay 8 Gwei for every gas unit, which is considered a “high priority” transaction and would be executed very fast

Actual Tx Cost Fee: This is the actual amount of fees that the user will pay for the transaction in Ether value (USD value is in brackets). Not bad; the user paid a total of 14 cents for his ETH to be transferred in less than 2 minutes!

Transaction (Tx) Fees: Gas Used by Txn * Gas Price

Gas Limit:用戶為此次交易支付的最大gas量。本例子中,標準ETH轉帳的默認金額為21,000gas
Gas Used by Txn:用于執行交易的實際gas量。 本例子中,由于這是標準轉移,所用的氣體也是21,000gas
Gas Price:用戶準備為每個單位gas支付的ETH金額。 本例子中用戶選擇為每個gas單位支付5 Gwei。
Actual Tx Cost Fee:這是用戶將為以Ether值進行的交易支付的實際費用金額。 本例子中是0.000105 Ether ($0.07)
Transaction (Tx) Fees=Gas Used by Txn * Gas Price

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。