How are delimiters determined for custom fields on issue transactions?

+1 vote
The issue commands (issue, issuemore etc) accept custom fields.

I am getting the raw transaction hex for an issuance transaction and decoding it.

When decoding the custom field data, the documentation (https://www.multichain.com/developers/native-assets/) says that the name of a user-defined custom field is null-delimited (i.e. 0x00 0x00). In testing I have encountered at least 4 delimiters that are not null:

0x00 0x0b, 0x00 0x07, 0x00 0x04, 0x00 0x02

Example:

74797065000776656869636c65

74797065 - custom field name (in this case, 'type')

0007 - delimiter

76656869636c65 - custom field value (in this case, 'vehicle')

 

What are the rules for determining which delimiter is used? Is there a range of hex values that I can treat as delimiters?

Note: I am intentionally not using the 'decoderawtransaction' command.
asked Aug 10, 2018 by anonymous

1 Answer

0 votes
 
Best answer

A null delimiter is a single 00 byte, not two 00 00 bytes.

So what you're seeing here is:

74797065 = "type" (field name)

00 = null delimiter for field name

07 = 7 (length of field value represented using a variable-length integer)

76656869636c65 = "vehicle" (field value)

This follows the spec as published on the page you link.

 

answered Aug 13, 2018 by MultiChain
...