14

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
1
  • Are you trying to replace a pending transaction, or do you want to just issue a normal transaction?
    – carver
    Sep 21, 2017 at 18:21

2 Answers 2

23

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.

8
  • 1
    Thank you! This error is a bit cryptic for its causes. Unfortunately, I am manually sending transactions using the ethereumjs-tx module which requires the nonce. Adding a timeout solved the problem.
    – M1Reeder
    Sep 22, 2017 at 1:20
  • Also it could be that a pending transaction is stuck in the node
    – webjunkie
    Oct 2, 2017 at 4:53
  • 1
    When I do this I get Error: nonce too low. @M1Reeder I am also using ethereumjs-tx where did you add the timeout?
    – mattgabor
    Jul 16, 2018 at 18:15
  • 1
    greater than 10%,not 110%
    – Jim Green
    Aug 11, 2018 at 6:33
  • 2
    @carver WRT "You can solve the problem by removing the nonce field. Your Ethereum client will automatically manage the nonce for you." — could you please point which line of code in Geth project that handle this? I wanted to learn more about it. Thanks. Mar 19, 2019 at 6:08
-2

try increase the 'gasPrice'. Ex:web3.toWei('25','gwei')

:)

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jan 8, 2022 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.