Is there a mechanism to create a listener for all events being emitted from a smart contract for the python web3 library. There is a way to do it in web3.js:

myContract.events.allEvents([options][, callback])

However, I don't see a parallel in Python's library. There is a function to get all of the events in Hex but I am looking for the human readable version.

How to get events in Hex:

event_filter = web3.eth.filter({"address": contract_address})

web3.js documentation: https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#events-allevents web3.py documentation: http://web3py.readthedocs.io/en/stable/filters.html


One option is to iterate all events and call createFilter on each of the events. Something like:

from web3.contract import ContractEvent

filters = [
  for event in myContract.events
  if isinstance(event, ContractEvent)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.