I have the following problem and have hard time to simulate it to get the answer.

Let say I have a 5 WETH tokens.

I sent transaction X with nonce 1 to transfer 5 tokens from Account A to Account B. This Transaction is in the pending pool and not mined yet.

Now I create another transaction Y with nonce 2 to transfer 5 tokens from Account A to Account B.

I want to simulate the transaction Y before sending it. I'm using staticCall from etherjs v5/6 to do this.

Will the simulation of transaction Y:

  1. Succeed because at the current time I have 5 tokens (transaction X not mined yet)
  2. Fails with low nonce
  3. Fails with insufficient balance because it calculate and consider the pending transaction X
  4. others..

If the answer is 1 or 2 Are there some other ways, libraries or tools, which consider the related pending transactions when the simulation happen.

Update: If this is not Standardised between all provider. Then maybe using Infura as provider


  • The answer could depend on your provider. Can you please update the question to include which provider you are using?
    – Milk
    Commented Aug 7, 2023 at 23:29
  • Thanks @Milk i updated the question :)
    – Majd TL
    Commented Aug 8, 2023 at 13:27

1 Answer 1


Ethers6 staticCall, same as Ethers5 callStatic method, sends the eth_call RPC request. The nonce parameter is not supported, so it has no effect. The mempool for eth_call is completely ignored, and by default, the call is executed on the latest block, though you can specify a different block number.

So your second simulation will succeed, as the account still has enough balance on the latest block.

There is no easy way to take the pendingTransactions into consideration when performing the call. To simulate multiple transactions at once, I use the Hardhats forking feature to execute the transactions locally (in-memory). So in this case after executing/simulating the X transaction, the Y transaction will fail. The benefit of such an approach is that you also get all the Logs which are emitted during the simulation.

  • thanks it looks good. i will wait 2 more days and then accept it :)
    – Majd TL
    Commented Aug 11, 2023 at 12:19

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.