Question:

Values in message structure do not match RFC message structure

Benjamin: 09 May 2022

I'm trying to understand what is the structure of the messages in IOTA. I used scylla to download some messages and now I don't see that the structure from the message matchs with the current one explained in the RFC 0017 (https://github.com/GalRogozinski/protocol-rfcs/blob/message/text/0017-message/0017-message.md#message-structure).

I'm going to use the following message:

https://explorer.iota.org/mainnet/message/fe328724335d3071626adb31274eebdaa11078d5efdc3dfb4c9bbaaae264fd95

If you scroll down and export the mesage in Hex format we have the following:

 b77f44715e0b30140406929877c0c305afad2548d31adb9c1e9d1ad7503788a56ad40a50ef6ce435ff5c77eb6798ac5125c4e82123961aefd463a61e7f598205c461c1af37e9ed50c4ae3deda4af7b9a5c3c6a0c0a6480d6261283a9805a6e8046a45e5944505041c3d0040e4ea8c39179982498b9f2115a74750111b734cb823d16d338a9615c57c7730000000200000011007777772e696f74612e777466205350414d580000007777772e696f74612e777466205350414d0a436f756e743a203035333035310a54696d657374616d703a20323032312d30352d32385431363a30303a35382b30323a30300a54697073656c656374696f6e3a203338c2b573937a100000000000

Now I will try the identify the elements using the previous RFC:

  • NetworkID (8 bytes): b77f44715e0b3014 - OK

  • Parents' length (1 byte) : 04 - OK

  • Parents (32 bytes x number of parents): - OK

    06929877c0c305afad2548d31adb9c1e9d1ad7503788a56ad40a50ef6ce435ff 5c77eb6798ac5125c4e82123961aefd463a61e7f598205c461c1af37e9ed50c4 ae3deda4af7b9a5c3c6a0c0a6480d6261283a9805a6e8046a45e5944505041c3 d0040e4ea8c39179982498b9f2115a74750111b734cb823d16d338a9615c57c7

Here comes the problem:

  • Payload Length (Should be 5 bytes): Not sure, but if I get 5 bytes I have: 7300000002. In my opinion this does not seem to be the payload length, especially considering that the 02 seems to be the payload type...
  • Payload Type (Should 5 bytes): Here I know that the payload type is 2 because it it an Indexation payload (https://github.com/GalRogozinski/protocol-rfcs/blob/message/text/0017-message/0017-message.md#indexation-payload) but it does not match with the bytes from the message. If we get 5 bytes: 0000001100, and I don't know what is this...
  • Index (Should be 1 to 64 bytes long): 7777772e696f74612e777466205350414d - OK
  • Unexpected value (Bytes size unknown): 58000000. I don't know what is this...
  • Data Fields (Any bytes, as we can see in the hex from the message, we have the index here too): 7777772e696f74612e777466205350414d0a436f756e743a203035333035310a54696d657374616d703a20323032312d30352d32385431363a30303a35382b30323a30300a54697073656c656374696f6e3a203338c2b573 - OK
  • Nonce (8 bytes): 937a100000000000 - OK

As you can see, we have some elements that are not described or does not match with the specification in the RFC:

  • Payload length
  • Payload Type
  • Unexpected value

Please, has anyone any experience with this? Probably I'm doing something wrong, but I think my explanation is correct.

Thank you very much.

Answer:
Benjamin: 09 May 2022

The problem as I can see it is that you are interpreting the payload length as 5 bytes, according to spec it is uint32 - so it is 4 bytes. From this point on the data is as follows, which matches the spec.

Payload Length uint32 = 4 bytes

73000000

Payload Type uint32 = 4 bytes

02000000

Indexation Key Length uint16 = 2 bytes

1100

Indexation Key

7777772e696f74612e777466205350414d

Indexation Data Length uint32 = 4 bytes

58000000

Indexation Data

7777772e696f74612e777466205350414d0a436f756e743a203035333035310a54696d657374616d703a20323032312d30352d32385431363a30303a35382b30323a30300a54697073656c656374696f6e3a203338c2b573

Nonce - 8 bytes

937a100000000000