If you are going to work on software using Liquid, the sidechain of Bitcoin, there are several concepts you need to be familiar with. This article aims at developers and is based on a presentation I held for the Pixelmatic team.
Disclaimer: this is an introduction, and it does not cover everything, obviously. And I simplified some explanations on purpose. As a prerequisite, if you are not familiar with Bitcoin, you should read my introduction to Bitcoin here.
Special thanks to Sosthene for proofreading my article and for his feedback! Follow him on Twitter.
Let's start now! And to discuss Liquid, we need to first discuss: Elements.
It is a fork of Bitcoin extended to be a sidechain platform with these features:
Source: https://elementsproject.org/
Well, Liquid is an instance of Elements. Set as a sidechain of Bitcoin and maintained by Blockstream. Also:
Source: liquid.net
Let’s see a bit more details on the different features of Liquid/Elements.
Pegging in BTC from the Bitcoin main net into the Liquid sidechain consists of depositing BTC into the Liquid Bitcoin wallet that is managed by the Federation. 102 confirmations on the Bitcoin mainnet are then required for you to claim your amount of L-BTC due, and the functionaries then grant you the corresponding amount on the Liquid sidechain.
Pegging out BTC from the Liquid sidechain back into the Bitcoin main net consists of receiving the BTC from an anonymous functionary from his wallet after being granted the amount by the federation. <br> 2 confirmations on Liquid are required for the operation to be allowed. Then the Federation will co-sign a transaction out of their 11 of 15 multisig wallets that are sending out the amount requested to one of the functionaries described anonymously. Finally, the functionary processes the transaction that will grant the BTC to the requester of the peg-out.
blinding_private_key := HMAC_SHA256(key=master_blinding_key, msg=script_pubkey)
where script_pubkey
corresponds to a specific non-confidential public address you want to make confidential
That means that a Liquid wallet consists of two things: an extended private key and a master blinding key.
Also, every confidential address is a non-confidential address blinded using the master blinding key. So the confidentiality is essentially a layer built on the top of classical HD wallets.
Note that you can dump a specific blinding key to allow a tier to unblind it using the RPC unblindrawtransaction
. And once in possession of the blinding key, any transaction happening with that specific address will be visible to the tier.
FYI Blockstream Green has a feature to open esplora with the blinding keys to allow a tier to see a confidential transaction unblinded on the web.
White Paper: Blockstream
Specifications: Satoshi Labs
elements-cli issueasset 0.00000100 0
The above issues a confidential asset with a total supply of 100 Satoshis and no reissuance key.
The contract defines metadata about the asset like its name, ticker, domain owner, precision, etc. Example the EXOeu token:
{
"entity": {
"domain": "exordium.co"
},
"issuer_pubkey": "030cff26f9c0d365f090e24917277e23269d7ef5d7f06dec9f09de9255b8950208",
"name": "EXO Token Europe",
"precision": 0,
"ticker": "EXOeu",
"version": 0
}
Being a fork of Bitcoin, we find the same RPCs as its parent, plus some new ones like issueasset
, blindrawtransaction
, and more:
<div class="container h-sm pb-1"> <iframe src="https://elementsproject.org/en/doc/0.21.0.0/rpc/" class="w-full h-full"> </iframe> </div>
Source: elementsproject.org
White paper
Compatible Wallets
Centralized Exchanges
DEX/Swap
Explorers
Documentation
Node
Cached API/Backend
Explorer
Libraries
Wallet Tools
Environment stack
Alike Bitcoin, Liquid has multiple environments at your disposal.
You can set up in your elements.conf the
chain
you want to use.
chain=liquidregtest
)liquidregtest
is not a known chain, it will start a chain named with this name. But you could name it differently like andrewschain, ethereum, or whatever. Details: https://github.com/ElementsProject/elements#modeschain=liquidtestnet
)That can be helpful to debug issuance and registration of assets, a thing you cannot do with regtest.
chain=liquidv1
)With this knowledge, you should have enough to get started to work on Liquid.
To sum up, here are my advice, if you are willing to:
And to go deeper down the rabbit hole, you can start searching on these subjects:
Have fun!
Also published here.