Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rinkeby: "replacement transaction underpriced"

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
like image 996
M1Reeder Avatar asked Sep 21 '17 16:09

M1Reeder


People also ask

How do you fix replacement transaction underpriced?

How do you fix Replacement Transaction Underpriced? To replace or cancel your earlier transactions, you must set the gas price at least 10% higher than the gas price of the pending transaction (not the current gas fee). Keep increasing if you do not know the previous fee.

What is transaction underpriced?

Replacement transaction underpriced simply means that the user-created transaction for overwriting their pending transactions was unable to be created due to lower gas charges than what was expected.


1 Answers

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:

  1. You have a pending transaction from your account in your Ethereum client
  2. The new transaction you are sending has the same nonce as that pending transaction
  3. The new transaction you sent has a gas price that is too small to replace the pending transaction

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.

like image 184
carver Avatar answered Oct 15 '22 07:10

carver