Go-Ethereum

rinkeby 網路上 sendRawTransaction 的 Gas 問題

  • December 5, 2018

我在 rinkeby 網路上遇到氣體問題sendRawTransaction

用各種氣體值進行測試,實驗得到 insufficient funds for gas * price + valueexceeds block gas limit

Some more info: Gas Estimate: 32872 Balance: 1100000 Gwei gas: 87200

有什麼建議或有人遇到過類似的問題嗎?

我的程式碼在這裡:https ://gist.github.com/anistark/2daf9295a4d5a03cb405ff5a47924b32

從您的程式碼中,您正在檢查地址的餘額並創建一個新的私鑰來簽署原始交易。

// Original balance

let existingBalance = web3.fromWei(web3.eth.getBalance(accountAddress), balanceUnit).toString();
console.log('existingBalance:', existingBalance, balanceUnit);


// New account

let seedPhrase = lightwallet.keystore.generateRandomSeed();

lightwallet.keystore.createVault({
   password: accountKey,
   seedPhrase: seedPhrase,
   hdPathString: "m/0'/0'/0'"
}, function (err, ks) {
   ks.keyFromPassword(accountKey, function (err, pwDerivedKey) {
       ...

       // Sign with new private key

       var tx = new Tx(rawTx);
       var privateKey = new Buffer(pwDerivedKey, 'hex')
       tx.sign(privateKey);

新的私鑰與原地址無關。除非明確資助,否則餘額為零。

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