TON is very low level blockchain and often you need something user friendly to show to users about their transactions. For example, comment or token transfer notification. This spec if formal description of what already used in TON.
With any transfer TONCOIN allows to specify arbitrary payloads, but first 4 bytes are recommended to be used as operation identifier. We will reference this first 4 bytes as op
, short of "operation". Contracts are free to use any op
values as they want except 0x00000000
. When op
is equal to 0x00000000
this means that this is a simple transfer with a comment.
If the byte right after op
is NOT equal to 0xff
than this is a simple text comment that should be user readable. If it is equal to 0xff
than this is a "binary" comment that shouldn't be shown to end user.
Comment is written as series of referenced cells. If comment couldn't fit into a single cell it should add a new referenced cell and write next batch of data there.