7

I want to decode the contract call data and event data saved in a block. How can I do that?

enter image description hereenter image description here

2 Answers 2

8

Having this data in hex format, you can decode it using cargo-contract command line utility simply like this (run from the contract src folder):

cargo contract decode -d <data_hex_string> -t message 

You can decode event and constructor data in the same way by running it with -t event and -t constructor accordingly.

1
5

Typically all data is SCALE encoded for Substrate. You need to decode and parse the result into something human readable, like is done on the contracts-ui from the contracts-ui github and documented in the polkadot-js contracts docs

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.