1

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

2 Answers 2

2

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.

2
  • 1
    Thanks Rob, I'll simply add the campaign Id as another variable not indexed as well as indexed to search on Commented Oct 11, 2018 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/… Commented Oct 12, 2018 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 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.