Cryptocurrency Ethereum Mastering Development

Detecting dropped and replaced transactions

I am using Given a transaction hash, is there any way to determine if a transaction was dropped and replaced by another transaction with the same nonce? Currently i am looping w3.eth.getTransactionReceipt(tx_hash) in a try/except to detect when the transaction has been confirmed.

        tx = w3.eth.getTransactionReceipt(tx_hash)


If the transaction is still pending, it returns an error and reloops, trying again. If it succeeds, the loop is exited. However, if the owner of the transaction sends a new transaction with the same nonce, the tx hash i have will never be confirmed and this loop will never exit. How can i detect if this occurs?

Leave a Reply

Your email address will not be published. Required fields are marked *