2

This is my transaction hash: https://mumbai.polygonscan.com/tx/0x79ed502a8d319ab3b278781042898115d9d6bece15d3d91626a7a6a39c0873b3#eventlog The event logs of the event DataCredentialized is not human readable. I am not sure how to decode these logs. It would be helpful if someone could help me with a javascript code to decode these logs. Thanks in Advance!!

2 Answers 2

1
+50

It seems you cannot decode these logs. The hex values are hashed with the keccak256 function which makes it nearly impossible to get the original values.
In your case you have two indexed topics:

  1. 0xa73d61b387464bf2a657f753d27d72552be88c48d7b0e3adc6a3413fb0b01e2d
  2. 0x93896ac593a0be8d1921c503fdc75208d8b9d573d83b479b03916c5a6b5781db

Where the 1. value was hashed in the contract with keccak256
The 2. value is also a Keccak-256 hash. Since you wanted to emit a reference type (memory string). You can read more here about Events.

2

The transaction you linked emits the event DataCredentialized:

event DataCredentialized(bytes32 indexed viewToken, string indexed ipfsUrl);

Taking a closer look at the contract, you will find a viewer function called viewCredentializedData() that allows you to decode the data by passing the argument retrieved from the event log.

1
  • at left of of Topics 1 choose Hex then copy that data and paste in. https://mumbai.polygonscan.com/address/0xc47d9b99fcf7c3d71630f6987a29002183902e43#readContract at viewCredentializedData first argument then Query May 28, 2023 at 14:23

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.