Get started running a Liquid node, transferring to the sidechain, claiming L-BTC, and issuing assets!
The Liquid Network is a Bitcoin sidechain that facilitates quick and private transactions. A sidechain is a separate blockchain with different features than its base chain but is pegged to it in order to utilize the main chain’s native currency. The 2-way peg in Liquid is 1:1 to Bitcoin, so for every bitcoin you peg into the network, you unlock or create 1 Liquid Bitcoin (L-BTC for short). Liquid provides fast settlement with short 1-minute blocks and privacy through technology called Confidential Transactions. Peg-ins basically just require you to send BTC to a multisignature address that is controlled by members of what’s called a Strong Federation. Peg-outs (transferring back on to the Bitcoin chain) require you to go through a Federation member exchange.
The Liquid source code and wallet / full node binaries are hosted on Github here. Currently, there are binaries for Windows, MacOS, and Linux. There even is a GUI now! I won’t go into building liquidd
and the other utilities in this post. You can use this document to build Liquid from the source code. It’s more or less identical to building bitcoind
.
liquidd
requires* a running bitcoind
which serves RPC calls. Just like how bitcoind
is operated with bitcoin-cli
, liquidd
is operated with liquid-cli
. So, all commands need to be run with liquid-cli
while liquidd
is running. Your Liquid node needs to be able to communicate with a Bitcoin node to validate peg-ins and to claim Liquid Bitcoin.
*If you don’t want to validate peg-ins, _bitcoind_
is not required. _liquidd_
can then be run on its own with _validatepegin=0_
.
This means that in bitcoin.conf
, the following is required:
server=1rpcuser=rpcpassword=
Liquid also requires a liquid.conf
(in ~/.liquid/
) with these entries:
mainchainrpcuser= <-- rpcuser in bitcoin.confmainchainrpcpassword= <-- rpcpassword in bitcoin.confmainchainrpchost= <-- usually 127.0.0.1mainchainrpcport= <-- usually 8332
That’s it! You can now fire up liquidd
and validate the sidechain’s blocks. Like with bitcoind
, you can watch Liquid’s debug.log
with:
tail -f ~/.liquid/liquidv1/debug.log
Initiating a peg-in is really simple. It’s just a matter of telling liquidd
to generate a peginaddress
for you to send bitcoin to.
$ liquid-cli getpeginaddress
This will output a peg-in address and a claim script. The claim script is needed if the peginaddress
is not in your wallet — if you’ve generated the peginadddress
on an offline computer and are submitting the claim on a separate computer, for example.
Once you’ve generated an address, you can send bitcoins to it. For security purposes, 102 Bitcoin blocks are required to complete the peg-in process. Peg-outs are much quicker at 2 Liquid blocks, but require you to go through a Liquid member exchange to do so.
Once 102 Bitcoin blocks have been mined, you can claim your L-BTC on the Liquid sidechain. To do so requires 2 things, and optionally the claim script if you’re claiming with a wallet that *does not have the _peginaddress_
* in it.
You need:
txoutproof
generated by bitcoind
getpeginaddress
Once you have those, you can use liquid-cli
to claim your L-BTC:
(Example from liquid-cli
help)
> liquid-cli claimpegin "0200000002b80a99d63ca943d72141750d983a3eeda3a5c5a92aa962884ffb141eb49ffb4f000000006a473044022031ffe1d76decdfbbdb7e2ee6010e865a5134137c261e1921da0348b95a207f9e02203596b065c197e31bcc2f80575154774ac4e80acd7d812c91d93c4ca6a3636f27012102d2130dfbbae9bd27eee126182a39878ac4e117d0850f04db0326981f43447f9efeffffffb80a99d63ca943d72141750d983a3eeda3a5c5a92aa962884ffb141eb49ffb4f010000006b483045022100cf041ce0eb249ae5a6bc33c71c156549c7e5ad877ae39e2e3b9c8f1d81ed35060220472d4e4bcc3b7c8d1b34e467f46d80480959183d743dad73b1ed0e93ec9fd14f012103e73e8b55478ab9c5de22e2a9e73c3e6aca2c2e93cd2bad5dc4436a9a455a5c44feffffff0200e1f5050000000017a914da1745e9b549bd0bfa1a569971c77eba30cd5a4b87e86cbe00000000001976a914a25fe72e7139fd3f61936b228d657b2548b3936a88acc0020000", "00000020976e918ed537b0f99028648f2a25c0bd4513644fb84d9cbe1108b4df6b8edf6ba715c424110f0934265bf8c5763d9cc9f1675a0f728b35b9bc5875f6806be3d19cd5b159ffff7f2000000000020000000224eab3da09d99407cb79f0089e3257414c4121cb85a320e1fd0f88678b6b798e0713a8d66544b6f631f9b6d281c71633fb91a67619b189a06bab09794d5554a60105" "0014058c769ffc7d12c35cddec87384506f536383f9c"
Issuing an asset is ridiculously simple compared to other platforms.
$ liquid-cli issueasset 1000 1 true
This creates an asset with 1000 units and 1 reissuance token. It is also issued confidentially, so you can issue and distribute assets completely confidentially — as if they were just normal Liquid transactions. Optionally, you can unblind the issuance and make it non-private.
Transferring L-BTC is the same as if you were using bitcoin-cli
:
Someone generates a confidential address:
$ liquid-cli getnewaddress
They give you that address. Then, you send L-BTC:
$ liquid-cli sendtoaddress VTq74LvRzjwxqNg47UaJgCqm8go8diH6XtBZdgHhNhPGVRC8xVj8adnMLQ9NfwV87iUnJ5jni2wAQoYT 0.01
This sends 0.01 L-BTC to a demo address that I generated.
Or an asset:
$ liquid-cli sendtoaddress VTq5YvHXHq4rsSVQNuGVC4ahrd25c1XrPqv59DBD73u9ZKbk2g6794Ge9zEKcR3zVaTR3diahW6S3vyx 0.01 "giveaway" "@RobEdb" false e33b0c87afdef7e0d942daf1d9735b9a79ddefc10a3a631783f397f86f418278
This sends 0.01 of an asset (in this case, Grubles Tickets) to @RobEdb.
Now you should be set and ready to transact and issue assets on the Liquid sidechain! Pretty simple! Also, don’t forget to encrypt your Liquid wallet.dat
just like you would your Bitcoin wallet. If you want to send tips you can just use the demo address I used earlier:
VTptRF5zL4kzEYwCrRjAbSPGAGUmujuxVHY7z6w5dypXm2hzGB5YqbybPKFSJih7onnX3WBRnnHQqQsf
Thanks for reading!