5

Since transactions require a nonce that is one more than the previously mined transaction for a given address, what happens if someone sent a transaction with a low gas price that was refused by miners? They would have all subsequent transactions refused unless they were given the same nonce and a more favourable gas price.

5

You're correct that all subsequent transactions would be refused.

So with Geth, you can rebroadcast with a higher fee (gas price) by using eth.resend (the nonce will remain the same).

eth.resend(tx, optional gas price, optional gas limit)

Example:

eth.sendTransaction({from: eth.accounts[0], to: "...", gasPrice: "1000"})
var tx = eth.pendingTransactions[0]
eth.resend(tx, web3.toWei(20, "GWei"))
  • That's pretty neat if you happen to have a geth node. I guess for the record, if you wanted to implement the above using web3, you could use 'getTransaction' to obtain it and then modify the gas price on that object, then resend using the normal sendTransaction method? – bozzle Jul 18 '16 at 10:11
  • Sounds good to me; I haven't tried with web3 though. Feel free to post that answer too and any others that you find that works. – eth Jul 18 '16 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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