You can actually get the value of the indexed values.
Let's say in your logs file you get an event with indexed values
The above logs have been created using this event:
event ContractReached(address indexed from, uint number);
And the event is called with the following arguments:
You can see that the event has 2 values:
- one indexed which is
- one non-indexed which is
topics array consist of one event signature topic and one additional topic per indexed value (in our case just one).
Event Signature Topic: This is equal to a Keccak-256 hash of the signature of the event in utf-8.
sha3(ContractReached(address,uint256)) would equal to our first topic
Topic per indexed value: These ones are 32 byte hex values of the indexed arguments, they are not hashed like the signature topic was.
We can see that this is an address (without the
0x infront of it):
90f8bf6a479f320ead074411a4b0e7944ea8c9c1 padded up to 32 bytes.
Data: The non-indexed values follow the same pattern as the topics containing the indexed values. They are non-hashed 32 byte hex representations of the values. The only difference is that they are all appended to the
data field one after another.
Because 1 hex value is equal to a nibble(4 bits or half a byte) we end with the following data string with a length of 64 nibbles (64/2 = 32 bytes).
If you then convert the hexadecimal representation of that into a decimal you would end up with
5 which is the value we passed in the event.
If our address wasn't indexed we would have received a
data of size 128 nibbles.
Only by eye-ing the string above you can easily see the two arguments, each being 64 nibbles.
Please feel free to correct me if anyone finds any mistake in my explanation.