<p>Coloured coins work by making use of OP_RETURN.</p>

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

<p>Omni works by encoding additional data within an OP_RETURN.</p>

<p>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.</p>

<p>I will make a transaction from A to B with the following format:</p>

<pre><code>Inputs:

Any BTC utxo for my address A

Outputs:

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

<p>If we look at <a href="https://omniexplorer.info/search/57af554e02ed572f49493c7c5a1cce7621c981e1f9a52cc1ec808fb229d002d5" rel="nofollow noreferrer">this</a> sample tx, the OP_RETURN value is <code>6f6d6e69000000000000001f00000000000003e8</code>. In this, <code>6f6d6e69</code> is Hex for <code>omni</code>, identifying it as an omni layer tx. <code>1f</code> is the asset ID for USDT, <code>31</code> in decimal. Finally, <code>03e8</code> is the amount, <code>0.00001</code> USDT.</p>

<p>Looking at the same tx on a <a href="https://www.blockchain.com/btc/tx/57af554e02ed572f49493c7c5a1cce7621c981e1f9a52cc1ec808fb229d002d5" rel="nofollow noreferrer">regular explorer</a> shows us the dust and change outputs as well.</p>

<p>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.</p>

<p>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.</p>

CC BY-SA 4.0
2018-08-04T06:50:05.823Z
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
CC BY-SA 4.0
2018-08-04T07:00:06.483Z
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.
Raghav Sood
CC BY-SA 4.0
2018-08-03T15:48:15.013Z
2018-08-03T15:48:15.013Z
Raghav Sood
<p>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?</p>

<p>An example from an explorer would be great, thanks.</p>

CC BY-SA 4.0
2018-08-03T15:48:53.560Z
see https://en.bitcoin.it/wiki/Colored_Coins
JBaczuk
<colored-coins>
How do coloured coins work?
Scalextrix
# How do coloured coins work?

(Asked by: username_0 on 2018-08-03)

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.

**Tags:** colored-coins

> **Comments:**
> **username_1**: see https://en.bitcoin.it/wiki/Colored_Coins  

---

## 1 answers

### Answer by username_2 on 2018-08-03. Score: 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](https://omniexplorer.info/search/57af554e02ed572f49493c7c5a1cce7621c981e1f9a52cc1ec808fb229d002d5) 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](https://www.blockchain.com/btc/tx/57af554e02ed572f49493c7c5a1cce7621c981e1f9a52cc1ec808fb229d002d5) 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.

> **Comments:**
> **username_0**: 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?  
> **username_2**: 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.  

---

