0

I'm currently returning back all events with no filter and all the indexed variables are being returned but they are encoded. The other none indexed variables are visible and being retrieved fine and are not encoded.

fevent.GetAllChanges<TEvent>(filterAll).Result;

How do I decode these fields or request them in a way they are not encoded?

enter image description here

CampaignId above should be an indexed integer.

Edit :

The above should work as this is demonstrated in the NEtherium examples shown under calling a event here

1

You can't do that.

Indexed topics don't contain the unhashed values. It's fine if you know the CampaignId you're interested in and filter for that. It's not so great if you're trying to convert from a topic back to the original input.

Hope it helps.

  • 1
    Thanks Rob, I'll simply add the campaign Id as another variable not indexed as well as indexed to search on – Joshua Duxbury Oct 11 '18 at 21:26
  • Revisiting this today, the NEtherium blog shows an example where they return an unencoded value from an indexed toplic ? they check the output of "log7[0].Event.MultiplicationInput"? link : nethereum.readthedocs.io/en/latest/contracts/… – Joshua Duxbury Oct 12 '18 at 9:50
1

Adding onto Rob Hitchens B9lab's answer, going from the solidity doc here

You can add the attribute indexed to up to three parameters which adds them to a special data structure known as “topics” instead of the data part of the log. If you use arrays (including string and bytes) as indexed arguments, its Keccak-256 hash is stored as a topic instead, this is because a topic can only hold a single word (32 bytes).

not all datatypes used for topics get hashed, only string and bytes datatypes get hashed. So in my example, when I changed the variable to an int this resolved my issue and I was able to see the result of my topic/indexed variables.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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