So I'm using web3 py filtering and it looks like I can listen for event logs using a filter, but I don't know which transactions in the pending pool produced the logs. Similarly, I can use getTransactionReceipt to get the event logs from a completed transaction, but it doesn't seem I can combine the two and get event logs of a pending transaction (it says transaction not found when I try). Is there any way to do this?

1 Answer 1


You can manually parse logs from the getTransactionReceipt() result JSON.

You can use internal web3._utils.events._get_event_data to parse raw topics to event logs.

However I do not have an example how to write it together.

  • Does getTransactionReceipt work with pending transactions? In my tests it seemed to return transaction not found errors. Jan 28, 2021 at 18:53
  • 1
    You do not get logs until the transaction is mined, so there is no point to work with pending transactions. Your understanding of process is flawed. Jan 29, 2021 at 11:47
  • You can simulate a transaction going through, but it may or may not match the reality and it is a different question to ask and few orders of magnitude more complicated problem. Jan 29, 2021 at 11:48
  • @MikkoOhtamaa it's not different question to ask, it's exactly what this question was about. Your original answer is not on point. The correct answer is you can get event logs by simulating the pending transaction.
    – Risinek
    Aug 11, 2023 at 14:45

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.