New issuance metadata - repeated fields for property

+1 vote
According to the documentation, after the identifier and type, the subsequent sections Property Key, Length and Value are repeated sections. Usually there is a varint count for repeated sections but in this case there seems to be none. Is the correct way of reading the repeated fields simply read section by section until OP_DROP code is encountered? Why is there a need for OP_RETURN after the OP_DROP?
asked Mar 26, 2017 by kakkoiiman

1 Answer

0 votes

The data which precedes the OP_DROP will have a length indicator to tell you how much data there is, and this determines when to stop reading the fields. Don't look for the OP_DROP (0x75) because this could equally legitimately be the first character of a custom field name. You can see the script encoding on the bitcoin wiki:

https://en.bitcoin.it/wiki/Script

Hex values 0x010x4e are relevant for representing data length. But overall you'd probably be better off finding a library for decoding bitcoin transactions into their constituent scripts, then scripts into their constituent data elements, so you don't have to worry about this low-level stuff.

We use an OP_RETURN after the OP_DROP to make it clear that this output contains no spendable assets.

answered Mar 27, 2017 by MultiChain
...