HOW DO LIGHTNING NODES INTERACT WITH ON-CHAIN BITCOIN?

The Lightning Network relies on the Bitcoin protocol to operate, so it is important to understand how your Lightning Node interacts with it.

LAYER 2 LIGHTNING NETWORK

The Bitcoin network is often called “Layer one” and the Lightning Network, “Layer two.” Your Lightning Node has an on-chain wallet built into it. This wallet allows you to send and receive bitcoin as you normally would.

THE LIGHTNING NODE WALLET

The channels that you will inevitably open are funded by this on-chain wallet. When your channels close, this wallet is also where the funds on your side of the closed channel will appear after confirmation.

SEED PHRASE

Your node’s seed phrase that you wrote down during your node’s initial setup will help you recover these on-chain funds should your node fail.

LIGHTNING TRANSACTIONS

Every time funds move through a lightning network channel, an on-chain transaction is updated (But not yet broadcast)and signed by both parties. Each peer now has access to a broadcastable transaction with updated balances.  This is to ensure that if the channel closes, the correct amount of funds will be returned to each party on-chain.

YOU HAVE THE OPTION

Your lightning channel is a 2 of 2 multi-sig smart contract.  Each peer has the option to close a channel at any time because both parties have access to the fully signed, but unbroadcasted close transaction at all times. To close a channel means to allocate the funds in a channel back to the bitcoin base layer.

UPDATING THE CONTRACT

Every time the balance of a channel changes, each peer signs an on-chain transaction updating the contract. Each peer then stores the signed 2 of 2 transaction if a closure is requested by either peer.

UPDATING THE CONTRACT

In the event of a cooperative close, one would broadcast the signed transaction, also known as a commitment transaction, to the bitcoin network. They would choose the fee rate and the channel would close and each peer would receive what they had on their side of the channel on-chain.

Time to close