I’m testing my client application that interacts with a contract deployed on the mainnet. I get some error that seems an infura endpoint forwarded to different nodes per API call.
Case. 1
I submitted a transaction via eth_sendRawTransaction
and get a transaction id. Then, I immediately called eth_getTransactionByHash
with the transaction id to the same endpoint for submitting the transaction. But, I cannot retrieve the transaction because the transaction is not found.
Case. 2
I submitted a transaction and checked the transaction is included in the blockchain. Then, I submitted another transaction via the same infura endpoint. I get an error shows replacement transaction underpriced
. I’m understanding that the error caused when a transaction is submitted during a node keeps another transaction that has the same nonce in the transaction pool of the node.
In both cases, I can check that transactions are successfully submitted into mainnet via etherscan, after waiting for a little.
Assumption of the cause
I assumed the cause of those errors.
-
the Infura endpoint is forwarded to different nodes.
If the infura endpoint is forwarded to different nodes, there is possibly a propagation delay for a transaction. Hence, the error is caused by the propagation delay between a node forwarded for submitting the fist transaction and another node forwarded for the second transaction (The eth_getTransactionByHash/eth_submittRawtransaction is called before the second node received the first transaction/block includes the first transaction). -
There is overhead for processing a transaction on a node in the mainnet.
If there is an overhead for processing a transaction on a node in mainnet and the eth_getTransactionByHash can get only transactions in the transaction pool and blockchain, the case 1 is reasonable (The eth_getTransactionByHash is called before the node collects the submitted transaction into the transaction pool).
Which assumption is reasonable? and is there another cause for the errors?
Additionally, how can I handle those errors?