1

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: try: tx_hashes = web3.eth.getFilterChanges(filter.filter_id) for tx in tx_hashes: tx_receipt = web3.eth.getTransaction(tx) print(tx_receipt) except Exception as exception: continue if __name__ == '__main__': main() 

I'm using python

1 Answer 1

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

Yes.

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.