以太坊Web3.js:内在气体太低

时间:2018-06-15 06:23:01

标签: javascript ethereum web3 web3js

过去几天我一直试图在以太坊测试网Rinkeby上发送一笔交易,并且无论我增加多少气体和gwei,都会不断收到此错误。 "Unhandled rejection Error: Returned error: intrinsic gas too low"

我发送的数据是: -

"0x7b22416e7377657273223a5b7b225175657374696f6e223a2231222c22416e73776572223a2234227d2c7b225175657374696f6e223a2232222c22416e73776572223a2234227d2c7b225175657374696f6e223a2233222c22416e73776572223a2234227d2c7b225175657374696f6e223a2234222c22416e73776572223a2234227d2c7b225175657374696f6e223a2235222c22416e73776572223a2234227d2c7b225175657374696f6e223a2236222c22416e73776572223a2234227d5d7d"

将其转换为十六进制。

我在下面添加了我的代码。

var number = web3.eth.getTransactionCount(address).then(function(count) {
  console.log("Count " + count);
  var privateKey = new EthJS.Buffer.Buffer(privateKey, 'hex');
  console.log(web3.utils.toHex(finalAnswers));
  var rawTx = {
    nonce: web3.utils.toHex(count),
    to: '0xF1aA87F7058e5ABE561cCe8A466eE1CC17d69639',
    value: 0,
    data: web3.utils.toHex(finalAnswers),
    gas: 50000,
    gasPrice: web3.utils.toWei('300', 'gwei')
  };

  var tx = new EthJS.Tx(rawTx);
  tx.sign(privateKey);

  var serializedTx = tx.serialize();


  web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log);
});

0 个答案:

没有答案