How To Close A Lightning Channel?

closing a LN channel

Share this article

The Lightning Network is a second-layer solution that lives on top of the bitcoin network, designed to facilitate faster transactions by removing the need to confirm all transfers of funds through proof of work on the base chain. The way funds are moved through the Lightning network is by locking up bitcoin in a hashed time lock contract, which then frees up those funds to move around on the Lightning Network.

If you’re running a non-custodial instance of the Lightning Network, you are responsible for the creation and closure of channels hosted on your node. You can create as many or as few channels as you like, with different capacity sizes, as long as you have the bitcoin on the mainchain to back it up.

Let’s say you have 0.1 bitcoin; you could create 2 channels of 5 million satoshis each or 10 channels of 1 million satoshis each, it depends on what you’re aiming to achieve and the connections you plan to make. In certain cases, you might want a private channel between friends or a public channel to route payments between your favourite service providers or Lightning-enabled apps.

What is a Lightning channel?

Lightning channels are payment connections between two parties and are the foundation that enables users on the Lightning Network to send and receive money to and from other users. Each time you create a channel, you hook up a money tube with bitcoin to another user; this will give you the ability to pay that user directly or pay anyone with direct or indirect connections to that user.

All Lightning channels are established between two Lightning nodes once you broadcast a transaction to the base chain stating that you wish to open up a channel.

Once a Lightning channel is established, its owners can send and receive money through them as long as inbound and outbound capacity exists on the respective sides of the channel.

How to close a Lightning channel?

Depending on the UI front end you’re using to manage your Lightning channels, it might be called something different, but generally speaking, you should be able to see the channels you have open in your Lightning dashboard. Select the channel you want to close and optionally set the fee you’re willing to pay miners to close the channel.

Once you’ve signed the transaction, you will have to wait for the transaction to be added to the mempool and then to a block like you would a standard bitcoin transaction. After you receive your on-chain confirmation, your funds should be available in your base chain wallet for you to spend.

This is true for all instances of Lightning regardless of the implementation you using, be that Core Lightning, LND or Eclair.

What are the types of channel closes?

The bitcoin base chain is the final settlement layer for all balances, as is the case with a channel open; a channel closure is an on-chain Bitcoin transaction. Channel closures occur when one or both parties want to settle their balance back to the bitcoin network.

If, for whatever reason, you see no need to use this channel and would like to secure your funds back to an on-chain address, you would broadcast a channel close, and that lightning balance would be unlocked on the main chain.

There are three types of channel closures that can occur with Lightning, and in all instances, the fees are paid by the person that opened the channel.

Collaborative close

This type of closure should be the most common and is an amicable closure between two nodes. Perhaps you don’t see the value of having this channel and want to close it you could initiate a channel closure, and communicate your intentions with your channel partner. Both parties agree to close the channel, and the most recent state is broadcast to the network, and each participant receives their sats back to their on-chain wallet.

Force close

Where one party closes the channel without the consent of their counterpart. These closures generally occur when one of the channel parties is unreachable. For a force close to take place, one user simply broadcasts the most recent channel state known to them.

Once a force close is confirmed onto the blockchain, the user that initiated the force close will have their balance locked for a set amount of time. This enables their counterparty to see the channel close and come back online to confirm the channel state.

If this does not happen, the party that closed the channel’s on-chain funds will become spendable after the lock time (usually 2016 blocks or two weeks) has ended.

Disputed close

A disputed close arises from a force close being initiated. If the initiating party publishes an old channel state that favours them and pays them more sats back on the chain, the party having the channel closed on them can dispute the closure if they disagree with the outcome.

To trigger this dispute, they simply bring their node back online within the lockout period (typically 2016 blocks or 2 weeks). Alternatively, if that isn’t an option because their node is in a different geographical location, they may have chosen to set up a Watchtower service that will monitor their channels and act on their behalf for a small fee.

If the party creating the dispute can successfully publish a more recent channel state than the one broadcast by their channel partner, their node will be able to publish a Justice transaction and claim the entire channel balance. The threat of such a scenario is enough to ward off most dishonest Lightning operators for fear of losing their funds.

Are you a bitcoin and lightning fan?

Have you been using Lightning to make micro-payments? Stream sats or engage with apps? Which app is your favourite? Have you tried all the forms of Lightning payments? Which one do you prefer? Let us know in the comments down below.

Disclaimer: This article should not be taken as, and is not intended to provide any investment advice. It is for educational and entertainment purposes only. As of the time posting, the writers may or may not have holdings in some of the coins or tokens they cover. Please conduct your own thorough research before investing in any cryptocurrency, as all investments contain risk. All opinions expressed in these articles are my own and are in no way a reflection of the opinions of The Bitcoin Manual

Leave a Reply

Related articles

You may also be interested in

PStaking or piss taking

pStaking More Like Piss Taking

Bull markets are the ideal environment for opportunists. It’s the period in the cycle where bad ideas can get funding and live longer than they

Cookie policy
We use our own and third party cookies to allow us to understand how the site is used and to support our marketing campaigns.