All about Zero-conf channels
How to open and close a zero-conf channel between two trusted nodes
Today we talk about zero-conf channels which are particular types of channels which do not require confirmation to be used. They have specific use cases that we will see later in this article.
Zero-conf channels are channels that do not require confirmations to be used. Because of this, the fundee must trust the funder to not double-spend the channel and steal the balance of the channel. (cit. crypt-iq)
Requirements
On LND, in configuration file, the following options must be specified for both the funder and the fundee. Without these options the zero-conf channels cannot work.
Two options must be specified either on the command line or in the config file:
protocol.option-scid-alias=true
protocol.zero-conf=true
on voltage you can find this option in channels → channelsettings
Now we will see all the procedure for opening and closing a zero-conf channel between two nodes. In this experiment we used the testnet.
Opening the channel
Let’s imagine we are going to open a zero-conf channel from testnet00 to testnet01 size 100K sats. First thing to do is that testnet01 (the fundee) must trust testnet00 (the funder). This can be accomplished with BOS (balance of satoshis) on node testnet01 with this command:
bos
inbound-channel-
rules --trust-funding-from 03a5e0ed529a3342557333ed4f46e212a17b6fee5f89cc65413c5f06b650738fa6
where 03a5e0ed529a3342557333ed4f46e212a17b6fee5f89cc65413c5f06b650738fa6 is the public key belonging to testnet00 (the funder).
Now we can start opening the channel itself on testnet00 (the funder) with:
bos open 02441ca523d
1b749f2007334aaaf9d71840cb37b5d16612d954e46aa94e293bac5 --type private-trusted --avoid-broadcast --amount 100000-
node: testnet01
channels_per_peer: 1.00
is_accepting_large_channels: true
opening_to:
- testnet01: 0.00100000
? Use internal wallet funds? Yes
? Chain fee per vbyte? 5
funding:
- 0.00100000
confirming_pending_open: true
raw_transaction_to_broadcast: 020000000001018c698f671ac1c3a3003bc33fcb5d940eddccff189c5650bd36698e20fc1f86160000000000ffffffff02a086010000000000220020c0b47cf6e930cddbd01f09a82ce8238015a4bc87a925d4da52247ece165d617d21b90d0000000000225120facaad3457b482c4b7e7ae17f286bf602bddec45c1f78c7be8acc4b2b2f174ff0140baa33856b1022c8366431d56f9c72217f9f8a4b331093cfeb8fed908a426f3eaaab433faf2d27060b2d16221e00677d3ef1865ab523ddbe49b6197314f50fc6700000000
is_avoiding_broadcast: true
transaction: 020000000001018c698f671ac1c3a3003bc33fcb5d940eddccff189c5650bd36698e20fc1f86160000000000ffffffff02a086010000000000220020c0b47cf6e930cddbd01f09a82ce8238015a4bc87a925d4da52247ece165d617d21b90d0000000000225120facaad3457b482c4b7e7ae17f286bf602bddec45c1f78c7be8acc4b2b2f174ff0140baa33856b1022c8366431d56f9c72217f9f8a4b331093cfeb8fed908a426f3eaaab433faf2d27060b2d16221e00677d3ef1865ab523ddbe49b6197314f50fc6700000000
transaction_id: cff447340d2ef25830b86971e8e872c5bfda68412d6b7fdbdfd5e11e4e704340
where 02441ca523d1b749f2007334aaaf9d71840cb37b5d16612d954e46aa94e293bac5 is the public key of testnet01 (the fundee)
The command takes some seconds to execute and you will get the channel running quite immediately. You can see it in your thunderhub on testnet00
and on testnet01
Now the channel is ready to go and you can start sending and receiving funds using normal invoicing.
Closing the channel
The procedure for closing the channel is different compared to standard closing channel procedure. This can be accomplished using lncli with abandonchannel feature. The procedure of closing this kind of channel, must be performed on both the nodes.
First of all search channel point with
lncli listchannels
{
   "channels": [
       {
           "active": true,
           "remote_pubkey": "02441ca523d1b749f2007334aaaf9d71840cb37b5d16612d954e46aa94e293bac5",
           "channel_point": "cff447340d2ef25830b86971e8e872c5bfda68412d6b7fdbdfd5e11e4e704340:0",
           "chan_id": "17592186044416000019",
           "capacity": "100000",
           "local_balance": "99056",
           "remote_balance": "0",
           "commit_fee": "614",
           "commit_weight": "772",
           "fee_per_kw": "253",
           "unsettled_balance": "0",
           "total_satoshis_sent": "0",
           "total_satoshis_received": "0",
           "num_updates": "0",
           "pending_htlcs": [],
           "csv_delay": 144,
           "private": true,
           "initiator": true,
           "chan_status_flags": "ChanStatusDefault",
           "local_chan_reserve_sat": "1000",
           "remote_chan_reserve_sat": "1000",
           "static_remote_key": false,
           "commitment_type": "ANCHORS",
           "lifetime": "331",
           "uptime": "331",
           "close_address": "",
           "push_amount_sat": "0",
           "thaw_height": 0,
           "local_constraints": {
               "csv_delay": 144,
               "chan_reserve_sat": "1000",
               "dust_limit_sat": "354",
               "max_pending_amt_msat": "99000000",
               "min_htlc_msat": "1",
               "max_accepted_htlcs": 483
           },
           "remote_constraints": {
               "csv_delay": 144,
               "chan_reserve_sat": "1000",
               "dust_limit_sat": "354",
               "max_pending_amt_msat": "99000000",
               "min_htlc_msat": "1",
               "max_accepted_htlcs": 483
           },
           "alias_scids": [
               "17592186044416000019"
           ],
           "zero_conf": true,
           "zero_conf_confirmed_scid": "0",
           "peer_alias": "testnet01",
           "peer_scid_alias": "17592186044416000016",
           "memo": "bos open"
       },
[…]
Now you can simply abandon channel with
lncli abandonchannel cff447340d2ef
25830b86971e8e872c5bfda68412d6b7fdbdfd5e11e4e704340 --output_index 0 --i_know_what_i_am_doing                                                               Â
{}
where the channel point is specified with the index as found on the listchannel command above. You will see the channel closed immediately, as you can check on thunderhub
Some possible use case
As you can see this kind of channels are fast, easy and very cheap. But they must be used only in certain conditions and use cases. One typical application is when you have a big node with many standard channels with other big nodes and you want a small node in front of it for example for getting payments from a shop.
In this case both nodes are yours so you can trust the node. The small node connected with a zero-conf channel will be exposed for receiving the payment, while all the work will be done by the underlying node.
Zero-conf channels are valuable for users or Lightning Service Providers (LSP) who want to immediately send and receive funds on the Lightning Network, such as merchants or users who lack sufficient inbound capacity to receive payments. (cit. lightning labs)
Using blixt?
If you want to see how to make the same thing but between a node and blixt, just checkout this document:
https://github.com/blckbx/NodeTools/blob/main/private-trusted-zero-conf-channels.md