I'm trying to research how tokens or colored coins would work on top of bitcoin lightning channels / nodes. Has any project tried to build token issuance on top of the Bitcoin lightning network? How would that work exactly?
3 Answers
Just wanted to add that Colu has been working on this problem since at least 2016, so i would dive deeper into their repositories, if you haven't already:
https://github.com/Colored-Coins
the most recent information I can find on these efforts is:
I can only answer the first part of your question as I am not aware of the implementation details other than that they use some form of "pay to contract script".
BHB-networks with Alekos Filini are working on the RGB protocol (which are colored coins) for Bitcoin. There is an rgb-spec which also has a section about Lightning but it is not very extensive. The first page says there are c Lightning and lnd forkes but I believe that is work in progress.
Coloured coins work by adding metadata to the a transaction output with an OP_RETURN
output script. The metadata describes a transaction of the coloured coin, but is ignored by the Bitcoin script interpreter.
This allows any state-transition protocol to be implemented on top of Bitcoin, with a state-change fee being paid in Bitcoin for confirmation, but validation rules which are enforced by a separate coloured coin server, parsing the Bitcoin strong chain for valid metadata.
Transferring such a coloured coin across a single payment channel requires both channel peers being able to sign Bitcoin channel states with coloured coin transactions represented in OP_RETURN
outputs. A channel state update can be in both Bitcoin, since the states are captured as Bitcoin transactions, and in the metadata, representing a balance change of the coloured asset.
Routing a coloured coin across multiple hops just requires the first and last routing segment balances to denominated in "colour coins", so that the colour coin can be delivered in the channel balance at your destination. An intermediary who is routing from a mSat denominated channel to one which is denominated in your coloured coin along this path would be necessarily be agreeing to an exchange of the two coins.