Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TransactionError when using Brownie on Optimism - Tx dropped without known replacement

I have a Python script using Brownie that occasionally triggers a swap on Uniswap by sending a transaction to Optimism Network.

It worked well for a few days (did multiple transactions successfully), but now each time it triggers a transaction, I get an error message:

TransactionError: Tx dropped without known replacement

Complete error message

However, the transaction goes through and get validated, but the script stops.

swap_router = interface.ISwapRouter(router_address)

params = (
            weth_address,
            dai_address,
            3000,
            account.address,
            time.time() + 86400,
            amount * 10 ** 18,
            0,
            0,
        )

amountOut = swap_router.exactInputSingle(params, {"from": account})
like image 241
tseror Avatar asked Sep 02 '25 16:09

tseror


1 Answers

There is a possibility that one of your methods seeks data off-chain and is being called prematurely before the confirmation is received. I had the same problem, and I managed to sort it out by adding

time.sleep(60)

at the end of the function that seeks for data off-chain

like image 116
Martin Maati Avatar answered Sep 06 '25 18:09

Martin Maati