0

I fount that some developers can get event_signature_hash for a event's name MyEvent(uint256) by using bellow code:

event_signature_hash = w3.sha3(text='MyEvent(uint256)').hex()

But vice versa, I couldn't find anyways to detect Event's name from event_signature_hash.

Can someone give a sample to do this?

1

But vice versa, I couldn't find anyways to detect Event's name from event_signature_hash.

This is not possible, (good) hashing algorithms are intentionally one way. You cannot go from the hash to the original input.

The only way to get the name would be to have the code of the contract it originates from (or a list of the event names in it, at the very least).

  • Thanks! I mean, in some ways, are there some database for searching Event's name with hash? – Bach Duong Jul 29 '18 at 13:28
  • I don't know of a topic list, although a somewhat large function sig list exists. You could possibly scrape various contracts from github to build your own database. – Raghav Sood Jul 29 '18 at 13:43

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.