Getting started with the Liquid Network

grubles
HackerNoon.com
4 min readNov 13, 2018

--

Get started running a Liquid node, transferring to the sidechain, claiming L-BTC, and issuing assets!

Intro:

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.

Jumping in:

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:

Liquid also requires a liquid.conf (in ~/.liquid/) with these entries:

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

Pegging-in:

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.

Claiming L-BTC:

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:

  • The raw transaction (in hex) of the peg-in transaction
  • A txoutproof generated by bitcoind
  • (optional) The claim script generated with getpeginaddress

Once you have those, you can use liquid-cli to claim your L-BTC:

(Example from liquid-cli help)

Issuing an asset:

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 or assets:

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:

This sends 0.01 L-BTC to a demo address that I generated.

Or an asset:

This sends 0.01 of an asset (in this case, Grubles Tickets) to @RobEdb.

Conclusion:

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:

Thanks for reading!

--

--