Understanding State Channels in the Lightning Network
Explore how state channels function within the Lightning Network, enabling fast and cost-effective transactions through multi-signature transactions and off-chain updates. Learn about the metro sys...
TECHNICAL
1/5/20253 min read


The Lightning Network is made up of shared multisig wallets between wallets, creating links known as State Channels. State channels are a way to scale blockchain throughput by opening communication channels intended for transferring cryptocurrency between parties in which the computational work is done off chain, and the finality time is instant. Only on-chain interactions occur to fund the channel or withdraw funds from the channel but not for any transactions conducted within the channel. State channels only interact with the blockchain when the channel is opened or closed which could be an unlimited time as long as the channels remain open between the parties.
State channels can be thought of through the analogy of a traveller in a metro system. Upon arriving at the departure station, the traveller swipes their metro card on the card reader to validate it and then only once again upon leaving the metro system. This is comparable to blockchain interactions when using a state channel with the state channel being thought of as the metro system, and card swiping terminals as blockchain interactions when entering and exiting the channel. Everything done within the metro system can be thought of as occurring within the state channel and does not update the transport card's metadata. The only instances published to the blockchain are the opening of the state channel and when the state channel is closed and the funds are withdrawn on chain to each respective member of the state channel. This is different from L2’s as they publish frequent Merkle proofs with transaftion compressions which are sent onto the main L1 blockchain in regular intervals to be verified in the case of Optimistic Rollups for example, whereas state channels do not post compressed transaction proofs and interact directly with the blockchain.
How can this be a secure mechanism for transacting when each transaction is not published to the blockchain?
The channels are multi-signature meaning that both parties need to confirm anything before any blockchain interactions occur. In order to open a state channel between two parties, say Alice has 1 BTC and Bob has zero BTC. Bob is an employee of Alice expecting regular scheduled payments for his work. Alice will fund a lightning network "Channel" which is a multi-signature bitcoin wallet, requiring the signatures of both Alice and Bob to publish any valid transactions onto the blockchain.
Bob has just completed his month of work and is expecting a payment from Alice of 0.1 BTC. Alice does this by creating a transaction which will allow Bob to withdraw 0.1 BTC from the multisig wallet and signs the transaction herself. Bob also signs this transaction which makes the transaction a valid bitcoin transaction which can be submitted at any time by submitting the transaction which will send 0.9BTC to Alice on-chain and 0.1 BTC to Bob on-chain thus closing the multisig wallet. The transaction is not submitted to the blockchain yet but remains available for either party to do so at any time as it is a valid transaction signed by both parties.
What if Alice just attempted to withdraw the 1 BTC from the previous state of the multisig wallet, disregarding the latest state of the channel that has not been published on chain yet? When she attempts to take a prior state of the multisig wallet to withdraw on-chain there is a mechanism in place which punishes her for trying to do so allowing Bob to withdraw the full 1 BTC, this disincentivises her against any dishonest actions as it will not be in her best interest. The same would occur with Bob if he attempted to publish an outdated validated transaction. This makes up about 80% of the complexity of the lightning network.
The benefits of the lightning network include less than a few second finality time, low cost payment fees as well as a high level of security. This enhances the reach of the Bitcoin Network, allowing those impacted by these above factors to engage with Bitcoin in a more practical manner.
Keep an eye out for the next article on lightning describing the mechanism of disincentivising dishonest parties from publishing prior validated transactions onto the blockchain




Transport cards used in Melbourne and London respectively




Get in Touch
We'd love to hear from you! Reach out for questions, feedback or other enquiries
Reach
info@bitesizedblockchain.com
Bite Sized is not affiliated with these brands in any way










Grab your daily web 3 byte