In the Javascript API wiki it states that if you send a transaction with sendTransaction() and the optional nonce parameter set you can overwrite your pending transaction.

nonce: Number - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.

In my code I am using sendRawTransaction() and if I set the nonce to the same as my last tx while it is still pending it bounces and never gets accepted to the pool. Is this what should be expected for sendRawTransaction?

I am re-signing the transaction each time with the same/previous nonce. I get a txid returned but after many attempts it has never overwritten the tx and I can never get working txid.

Is this the expected behavior?

I am having trouble using web3.eth.pendingTransactions it always returns an empty array. So i cant use eth.resend(web3.eth.pendingTransactions[0], newGasPrice). Ultimately my goal is to overwrite a transactions with a higher gas price when certain conditions are met.

  • 1
    Yes, if you use sendRawTransaction with a higher fee it should replace a pending transaction. In geth the default increase should be above 10% of the price. Also you do not have a guarantee that it will replaced, it can be already mined when you send the replacement. Does your transaction appear in txpool output? – Ismael Aug 4 '17 at 15:40
  • In a well-functioning node, web3.eth.pendingTransactions shouldn't be empty if you sent a transaction that hasn't been mined yet. That seems like the problem you need to solve first. BTW, if you get that solved, look out for a different issue with resend(): ethereum.stackexchange.com/questions/9374/… – carver Aug 4 '17 at 15:46
  • @carver If I run web3.eth.pendingTransactions I get: "[]" However when i run txpool i get a very big output of txs.... and status: { pending: 3987, queued: 18 }, – 1337cookie Aug 4 '17 at 18:25
  • @Ismael I attempted to send the tx again at least a dozen times only moments after the first. I could see my first tx on etherscan.io/txsPending?a=MyAddressHere and never would the later sent txs show up here despite getting a txid for them I would assume my tx was still in the txpool. My gas price was considerably higher each time. – 1337cookie Aug 4 '17 at 18:29
  • Does web3.eth.pendingTransactions require any prequisites? I assumed it was transactions that were sent from that node. – 1337cookie Aug 4 '17 at 18:30

Your Answer

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

Browse other questions tagged or ask your own question.