Transactions

為什麼會出現“資金不足”錯誤?

  • March 20, 2017

我正在嘗試從餘額為 516,561,000 Babbages 的帳戶向測試網發送交易。根據我的計算,這正是執行交易的成本。然而結果始終是“gas * price + value 資金不足”。

這是我要發送的交易:

eth_sendTransaction: [{
   "from": "0xa7e3c7c227c72a60e5a2f9912448fb1c21078769",
   "to": "0x6861973632a44775a0dae132ef4578a95fcebd6c",
   "value": "1000000000",
   "gasPrice": "20000000000",
   "nonce": "0x100000",
   "data": "0x4d61726b65745061792e696f202d2041756469744c6f673a204175646974206c6f672074782066726f6d206a75616e20746f20616c656a616e64726f206f662031206575726f73"
}]

result => Insufficient funds for gas * price + value

這是此交易的估計氣體計算:

eth_estimateGas: [{
   "from": "0xa7e3c7c227c72a60e5a2f9912448fb1c21078769",
   "to": "0x6861973632a44775a0dae132ef4578a95fcebd6c",
   "value": "1000000000",
   "data": "0x4d61726b65745061792e696f202d2041756469744c6f673a204175646974206c6f672074782066726f6d206a75616e20746f20616c656a616e64726f206f662031206575726f73"
}]

result => 0x64e4 // gasEstimated = 25828

這是天然氣的中等價格:

eth_gasPrice: []

result => 0x4a817c800 // 20000000000 (gasPrice medium = 20,000 Babbages)
)

所以,

txFeeEstimated = gas * price = 516,560,000 Babbages

最少資金 = gas * price + value = 516,561,000 Babbages

並根據https://testnet.etherscan.io/address/0xa7e3c7c227c72a60e5a2f9912448fb1c21078769

ETH 餘額為0.000516561 乙太幣

為什麼會出錯?在這種情況下不是餘額= gas * price + value嗎?

你能強制加油嗎:

eth_sendTransaction:[{
“來自”:“0xa7e3c7c227c72a60e5a2f9912448fb1c21078769”,
“到”:“0x6861973632a44775a0dae132ef4578a95fcebd6c”,
“價值”:“1000000000”,
"gasPrice": "20000000000",
“氣體”:“25828”,
“隨機數”:“0x100000”,
“數據”:“0x4d61726b65745061792e696f202d2041756469744c6f673a204175646974206c6f672074782066726f6d206a75616e20746f20616c656a616e64726f206f662031206575726f73”
}]

否則你讓系統發送超過估計的氣體。指指點點,這確實夠氣。

引用自:https://ethereum.stackexchange.com/questions/8783