Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: victorkimba17 on March 30, 2018, 09:15:06 AM



Title: Bitcoin transaction and Open Asset Protocol
Post by: victorkimba17 on March 30, 2018, 09:15:06 AM
In Bitcoin transaction, it can have multiple vin and vout. In vout, it contains bitcoin script. In bitcoin script, the OP_RETURN contains payload, the payload is used to store Open Asset asset id and quantity (see https://en.bitcoin.it/wiki/Colored_Coins#Open_Assets). The encoding is based on LEB128.

OP_RETURN has 40 byte limit. There is a request to increase the size limit to 80 bytes.

"Previously, a single transaction could send assets to up to 34 distinct recipients. After the change, it will be able to send assets to up to 74 recipients". (see http://blog.coinprism.com/2015/02/11/80-bytes-op-return/)

Is the limit of 34 distinct recipient because the header of Open Asset is 6 bytes, so 40-6 = 34 ?



Title: Re: Bitcoin transaction and Open Asset Protocol
Post by: starmyc on March 30, 2018, 09:30:58 AM
According to https://en.bitcoin.it/wiki/Colored_Coins#Open_Assets (https://en.bitcoin.it/wiki/Colored_Coins#Open_Assets), it is a slightly more complex than this. The "6 bytes header" is not a 6 bytes header because the asset quantity count is a varint (a varint can have a size of 1, 3, 5 or 9). Also, you have a dynamically sized footer with another varint.

Please take a look at the Open assets spec (https://github.com/OpenAssets/open-assets-protocol/blob/master/specification.mediawiki). You have all headers & footer fields described. Also, please note that the asset quantity list is a LEB128 encoded field. LEB128 is a compression algorithm to store a large number of small integers.

Please also note the OP_RETURN now accepts up to 83 bytes: https://github.com/bitcoin/bitcoin/blob/master/src/script/standard.h#L34 (https://github.com/bitcoin/bitcoin/blob/master/src/script/standard.h#L34).


Title: Re: Bitcoin transaction and Open Asset Protocol
Post by: victorkimba17 on March 30, 2018, 09:55:19 AM
Please take a look at the Open assets spec (https://github.com/OpenAssets/open-assets-protocol/blob/master/specification.mediawiki). You have all headers & footer fields described. Also, please note that the asset quantity list is a LEB128 encoded field. LEB128 is a compression algorithm to store a large number of small integers.

Please also note the OP_RETURN now accepts up to 83 bytes: https://github.com/bitcoin/bitcoin/blob/master/src/script/standard.h#L34 (https://github.com/bitcoin/bitcoin/blob/master/src/script/standard.h#L34).

Now OP_RETURN accepts up to 83 bytes, thank you very much for the link.

I refer to  Open assets spec (https://github.com/OpenAssets/open-assets-protocol/blob/master/specification.mediawiki).

OAP marker is 2 bytes,
version number is 2 bytes,
Asset quantity count (varint) minimum 1 byte.

It looks like we can fit 35 assets into one Open Asset transaction, it each asset quantity field takes up one byte. (for OP_RETURN limit of 40 bytes