1

I'm building an application that needs to send hundreds of transactions every minute (consistently for hours & even days) to the Polygon blockchain.

To achieve this I'm

  • setting unique (and +1 increasing) nonce values to each transaction
  • setting a very high gas price for the transaction (15% higher than the top gas prices in the latest block)
  • attempting to send transactions in order of their nonces (though this isn't 100% accurate all the time)
  • making as few calls to the RPC as possible, and populating most parameter values from within my own system (gasPrice, gasLimit, nonce)
  • using Alchemy as my RPC provider, a single nodeJS (w/ ethers) instance as my backend

I'm only sending one type of transaction and there's very little variation between each request. On average, I'm noticing that most of my transactions are getting mined within 4-5seconds. However, I've sometimes noticed that when I have too many TXs in the mempool, or when I'm sending requests too fast, some transactions remain in the Mempool (in Alchemy's mempool watcher; these often don't even appear in Polygonscan) forever and this essentially chokes my system and prevents future transactions from going through as well.

I'm not sure why some of these transactions are getting stuck even when they respect nonces and have high gas price values. Can anyone please guide me towards what could be the issue?

2 Answers 2

1

First of all, I'm wondering what you are building because it sounds potentially toxic but putting that aside....there is an annoying thing on web3 where if one transaction from an address gets stuck in pending mode, no transactions coming after it can get through until you basically cancel the pending transaction, and the only means I have found to do that is by sending a 0ether transaction to yourself using the nonce of the stuck transaction. I don't know if you could do that for whatever you are building (or if that is how it works on Polygon but I bet it is).

0

Polygon's spotty. Whether it's spam protection by their nodes or simply other txns getting mined, we've noticed this as well. Just take it super slow (just send one to the mempool at a time) and expect outages occasionally. Polygonscan as well can take some time to update even if it does get included in a block, so don't treat that as the truth.

Love polygon, but its just early, so there's still some issues.

1
  • Any way to at least get an indication of when such a transaction might "silently fail" like this (without just waiting for x mins, of course)? And for a service that needs to scale to rates like this (~10Tx/s from a single wallet), do you have any suggestions for alternative methods/approaches? Apr 1, 2022 at 19:39

Your Answer

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

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