美文网首页
Gas、Gas Limit and Gas Price

Gas、Gas Limit and Gas Price

作者: 龙少侠linux | 来源:发表于2018-04-26 14:21 被阅读0次

    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

    相关文章

      网友评论

          本文标题:Gas、Gas Limit and Gas Price

          本文链接:https://www.haomeiwen.com/subject/xqnplftx.html