0

From what I can gather coloured coins add some additional data to a UTXO, I'm trying to understand what mechanism us used to store the extra data and how the data is maintained in tact if the UTXO is sent to another party. So let's say I have a 1 Satoshi UTXO, I can (somehow) write that it represents my car, registration number 123 ABC. Now I transfer that 1 Satoshi to you as proof of transfer of ownership of what is now your car. Does the data get destroyed at that time? I assume for divisible items like bottles of wine, if I had 12 Satoshi in 1 UTXO, I could not send 1 Satoshi to you to transfer just 1 bottle?

An example from an explorer would be great, thanks.

1

1 Answer 1

1

Coloured coins work by making use of OP_RETURN.

I'll discuss the Omni Layer, which is currently the primary coloured coin implementation on Bitcoin.

Omni works by encoding additional data within an OP_RETURN.

Let's say I have a BTC address A, and hold 100 USDT in that address. Now, I want to transfer this USDT to B.

I will make a transaction from A to B with the following format:

Inputs:

Any BTC utxo for my address A

Outputs:

A small dust output to B <- This is used to identify the recipient of the coloured coin
An OP_RETURN that encodes the asset ID and amount <- This will identify that I am moving USDT, and 100 units of it
An optional change output that is larger than the dust limit <- any left over from my utxo.

If we look at this sample tx, the OP_RETURN value is 6f6d6e69000000000000001f00000000000003e8. In this, 6f6d6e69 is Hex for omni, identifying it as an omni layer tx. 1f is the asset ID for USDT, 31 in decimal. Finally, 03e8 is the amount, 0.00001 USDT.

Looking at the same tx on a regular explorer shows us the dust and change outputs as well.

Lastly, it is not important for omni layer transactions to spend a utxo from the same output that deposited the coloured coins to the address (i.e., you do not need to spend the dust when spending the USDT in the above tx). Omni uses a secondary accounting system maintained by the omni nodes, which simply tracks OP_RETURNs for balance calculations.

To prevent double spends, Omni will simply credit or debit accounts in the order transactions appear on the Bitcoin chain. If I attempt to transfer the 100 USDT from the first example to C in addition to B, it will get transferred to B or C depending on which tx appears first in the Bitcoin chain. The second tx, although successfully mined as it does not violate and bitcoin rules, will fail at an omni layer, and no coins will be transferred.

2
  • Thanks, I don't see the OP_RETURN value you linked to. Also is that OP_RETURN format a convention agreed on the Bitcoin protocol only; if another coin did Colored Coins they could have a different convention?
    – Scalextrix
    Aug 4, 2018 at 6:50
  • The OP_RETURN is the unable to decode address part, blockchain.info won't show the raw data unless you use the show scripts link towards the bottom. OP_RETURN can be any arbitrary text, Omni has simply specified a format for omni layer txs to follow. Any other implementation may specify a new format. Aug 4, 2018 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.