Mining Lab · Coinovo Academy · The Lightning Network
Bitcoin instantly, with conditions
On the Bitcoin blockchain a block is created about every ten minutes on average, and the space in it is limited. Nobody wants to wait ten minutes for a coffee or pay a fee that swings with demand. Lightning is therefore built as a second layer on top of Bitcoin: most payments run directly between the participants, and only the start and the end land on the blockchain.
Lightning is a layer on top of Bitcoin, not a coin of its own.
Two participants put bitcoin together into an address that needs both their signatures. That is a normal payment on the blockchain. After that they only exchange signed new balances, as often as they like, without the blockchain hearing about it. It is like a tab at your local bar: you run it all evening and pay once at the end.
Opening a channel creates a payment on the blockchain to a shared address that can only be spent with both signatures. Before that payment is even sent, both sides already sign a refund that gives each their share back. That way nobody can hold the other side's money hostage.
Every Lightning payment inside the channel is a new version of that refund, signed by both, with different amounts. Each party keeps the latest version and could publish it on the blockchain at any time. As long as nobody does, everything stays between the two of them.
A channel is closed when one of these versions lands on the blockchain. The cleanest way is together: both sign the final balance and the money is available quickly. If one side closes alone, its own share is only released after an agreed waiting period. That waiting period is not a flaw but the core of the security, as the next section shows.
The obvious idea for a cheat: publish an old balance in which they owned more. Technically that old version would carry valid signatures. Lightning therefore builds in a penalty. With every new balance, each side hands the other a key that can be used to disprove the previous balance.
If someone now publishes an outdated balance, the other side can use that key within the waiting period and take the entire channel amount. The cheat loses not only the hoped-for gain but everything that was in the channel. That makes the attempt unattractive.
The penalty only works if someone is watching in time. Anyone who is offline for a long while can hire a service that watches the blockchain on their behalf and reacts when needed. That service is called a watchtower. Many wallet apps handle this in the background or use a provider who looks after the channels for you.
You do not need a channel with everyone. A payment can travel over several nodes that have channels with each other, like a parcel through several sorting centres. So that nobody along the way can keep the money, the recipient creates a secret, and the invoice only contains its fingerprint. Each intermediate node only gets its money once the secret is passed back, and that only happens when the recipient has been paid.
A Lightning payment arrives in full or not at all.
A channel has a fixed capacity, namely the amount put in when it was opened. Each payment only shifts how that amount is split between the two sides. You can send at most what sits on your side and receive at most what sits on the other side. Someone who opens a channel and has everything on their side can pay through it at first but cannot receive anything.
Picture a channel as a tube holding a row of marbles. The number of marbles is fixed: that is the capacity. When you pay, marbles roll from your side to the other. When you are paid, they roll back. What sits on your side is called outbound liquidity, what sits on the other side is inbound liquidity.
An example, simplified and ignoring the small reserve every channel holds back: a channel holds 500,000 satoshi, of which 400,000 are on your side. Through this channel you can send up to 400,000 satoshi and receive up to 100,000. If a payment of 150,000 satoshi comes in, it does not fit through this tube.
For merchants this is the most important number: anyone who mainly takes money in needs inbound liquidity. You get it when others open channels to you, when you spend money yourself, or by buying it from a service provider. Many phone wallets handle this automatically and charge a fee for it.
A payment over several nodes needs enough liquidity in the right direction on every leg. The sender knows the capacity of public channels but not how it is currently split. So it tries routes until one works.
For small amounts a route can almost always be found. The larger the amount, the fewer channels qualify and the more often the attempt fails. Modern wallets therefore split a payment into several parts that take different routes and are reassembled at the recipient. The same rule applies: either all parts arrive or none do.
That leads to a simple rule of thumb. Lightning is built for amounts that are small relative to the channels. Anyone wanting to move a large sum, for example when moving savings to a wallet of their own, is usually better served by a normal payment on the blockchain, even if it takes longer.
Anyone who forwards a payment may charge a fee for it. It usually consists of a small base amount plus a share of the amount. For small payments this often stays at a few satoshi. On top come the blockchain fees for opening and closing a channel, and those can be considerably higher depending on demand.
Lightning shines for small, frequent payments: coffee, tips, small sums between friends, payments every few seconds. It is less suited to large sums and to money meant to sit for years. A Lightning wallet is usually online and therefore more exposed than a securely stored key. And anyone running their own node has to be online to receive payments.
Lightning is the purse, not the safe.
With a custodial wallet a provider holds the bitcoin and you only have a claim against it, much like a bank account. That is convenient, but the provider can freeze funds, go bust or be hacked. With a non-custodial wallet you hold the keys yourself and carry the responsibility, including backing up your channels. Many apps take the technical work off your hands without taking over the keys.
Whoever has the keys has the money. On Lightning too.