Getting "intrinsic gas too low" when attempting to broadcast dynamic fee transaction #5859
-
Currently running Ganache via docker with docker run --rm -p 8545:8545 trufflesuite/ganache --deterministic --accounts 3 --defaultBalanceEther 1000 I calculate my gas fees as such var gasPriceHex hexutil.Big
g.RPCClient.CallContext(ctx, &gasPriceHex, "eth_gasPrice")
var gasTipCapHex hexutil.Big
g.RPCClient.CallContext(ctx, &gasTipCapHex, "eth_maxPriorityFeePerGas")
metadata := &metadata{
Nonce: nonce,
GasPrice: (*big.Int)(&gasPriceHex),
GasTipCap: (*big.Int)(&gasTipCapHex),
}
var block struct {
BaseFeePerGas string
}
g.RPCClient.CallContext(ctx, &block, "eth_getBlockByNumber", "latest", true)
baseFeePerGas, _ := hexutil.DecodeBig(block.BaseFeePerGas)
metadata.GasFeeCap = new(big.Int).Add(metadata.GasTipCap, baseFeePerGas) This producess the following, in Wei
Error occurs when sending the raw transaction $ curl -s -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0", "id": 1, "method": "eth_sendRawTransaction", "params": [ "0xb86f02f86c8080843b9aca008477359400847735940094db055877e6c13b6a6b25abcaa29b393777dd0a737b80c080a006990b1f9f08a1f1e360206180fb3584b35f489cada9d38f2259c5b61876d23ba05fc29a930512688ba1009885e6ea7f24b8e67e391345f8a79785477e6f830684" ] }' http://localhost:8545 | jq
{
"id": 1,
"jsonrpc": "2.0",
"error": {
"message": "intrinsic gas too low",
"stack": "Error: intrinsic gas too low\n at TransactionPool.<anonymous> (/app/dist/node/1.js:2:120585)\n at TransactionPool.prepareTransaction (/app/dist/node/1.js:2:120796)\n at TransactionManager.add (/app/dist/node/1.js:2:138284)\n at Blockchain.queueTransaction (/app/dist/node/1.js:2:70776)\n at EthereumApi.eth_sendRawTransaction (/app/dist/node/1.js:2:88213)\n at EthereumApi.n.value (/app/dist/node/1.js:2:238968)\n at Object.execute (/app/dist/node/1.js:2:165607)\n at RequestCoordinator.<anonymous> (/app/dist/node/1.js:2:165421)\n at /app/dist/node/1.js:2:165687\n at new Promise (<anonymous>)",
"code": -32000
}
} Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
For future reference, I found the issue. Important note, the error message is completely misleading! Pointing the code at a testnet node, the actual error you get back is This issue, specific to |
Beta Was this translation helpful? Give feedback.
For future reference, I found the issue. Important note, the error message is completely misleading!
Pointing the code at a testnet node, the actual error you get back is
rlp: expected input list for types.LegacyTx
(if you're usinggo-ethereum
).This issue, specific to
go-ethereum
fixes it. This may be go-specific thing, but the error message, nonetheless, was not helpful at all.