I've been running a local Rinkeby node (in order to use websocket events) which was working fine for a while, but suddenly I have been getting "Returned error: replacement transaction underpriced". I am sending 10x the average gas price and I'm still getting this error. Here are my calculations:
gwei = 1000000000
gas = 47000
gasPrice = gwei * 20
Only when I bump the gas price to (gwei * 2000) can I make a transaction (0.9 ether). This is causing me to run out of ether very quickly making development real hard.
Example tx:
{
"nonce": "0x23",
"chainId": 4,
"to": "0xB92427792629A23E0b2deE37b3F92Ce4D4cB794c",
"value": 0,
"gas": "0xb798",
"gasPrice": "0x4a817c800",
"data": "0xce07c1787465737400000000000000000000000000000000000000000000000000000000"
}
Any help is much appriciated!
Geth Rinkeby Cmd:
geth --rpccorsdomain="*" --rinkeby --ws --wsport=8546 --wsorigins="*" --datadir=$HOME/.rinkeby --cache=512 --rpc --rpcapi="personal,eth,network,net,web3,db" --rpcport=8545 --fast --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303
Summary: Remove the nonce
field
This answer assumes that you want to issue a new transaction, rather than replace a pending one.
What does the error mean?
"Returned error: replacement transaction underpriced"
The error means that:
With geth
, the replacement transaction must have a gas price greater than 10% of the gas price of the pending transaction.*
I'll assume that you want to issue a new transaction, rather than replace an existing, pending one. You can solve the problem by removing the nonce
field. Your Ethereum client will automatically manage the nonce for you.
* This replacement price is not specified in the protocol. Different clients (and most importantly, miners), might apply different replacement rules.
I have another reason that I need to specify the nonce field
Then increment it by one every time you issue a new transaction. This will not play well with other processes connected to your Ethereum client, and try to replace them.