I would like to know if you know how to listen to a contract or an address, because I tried to have all the pending events but I can't filter my address in it, too many txhash recuperate I can't find my txhash in it.

I ran the python code and then sent bnb to another address via metamask but I didn't get the txhash on the python code.

If anyone can help me here is the code:

from web3 import Web3
import time

web3 = Web3(Web3.WebsocketProvider("wss://bsc-ws-node.nariox.org:443"))
def main():
        filter = web3.eth.filter('pending')
        while True:
                        tx_hashes = web3.eth.getFilterChanges(filter.filter_id)
                        for tx in tx_hashes:
                                tx_receipt = web3.eth.getTransaction(tx)
                except Exception as exception:

if __name__ == '__main__':

I'm using python

1 Answer 1


I think you are confusing events and transactions.

An event is a set of data emited by a transaction once it is mined, and only if the tx has been developped to do so.

A transaction is... well, a transaction, not an event.

The consequence is that you cannot listen for event in the pending transaction pool, as those transactions have not been mined yet.

So, to answer:

I would like to know if you know how to listen to a contract or an address


  • i can listen the event like the add of liquidity of the lock of the liquidity ?
    – Zairtay
    Aug 25, 2021 at 0:42
  • @Zairtay Only if your contract emits an event in these cases. Aug 25, 2021 at 5:55

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.