This introduction to the Lightning Network was originally published at Bruno’s Bitfalls website, and is reproduced here with permission.
Bitcoin is currently impractical to use because of slow and expensive transactions plaguing its blockchain. Most people use it as a store of value (the digital gold fallacy) or to trade on exchanges. A concept known as the Lightning Network was introduced as a solution to this scalability issue.
The Basics of the Lightning Network
The Lightning Network was first described in a 2015 whitepaper by Joseph Poon and Thaddeus Dryja. The concept, however, was actually introduced by Satoshi Nakamoto in an email to Mike Hearn in 2013.
The Lightning Network works through payment channels which are actually multi-sig wallets (multiple signature). A multi-sig wallet is just a Bitcoin address which requires a signature or private keys of several owners before money in that address can be spent. You can view them as bank vaults which require the turning of two different keys at the same time in order to open.

A multi-sig wallet can, for example, be the common Bitcoin address of a married couple, wherein they both have to sign a transaction in order to spend their common Bitcoin.
The purpose of payment channels is regular execution of smaller payments and avoidance of high transaction fees. Examples of relationships ideal for LN channels are employee-employer, consumer-producer, utility provider-utility consumer, coffee drinker-coffee shop, etc. The idea is letting a customer open a payment channel with his coffee shop, regularly paying for coffee without having to wait for confirmation (10 to 60 minutes currently).
How the Lightning Network Works

Let’s explain with a step-by-step example. Our imaginary scenario is as follows:
Bob wants to pay Alice to write articles for him. The deal is 10 BTC for a total of 100 posts, or 0.1 BTC per post.
In a traditional Bitcoin system, that would require one hour on average with a fee of $5 to $500 per transaction, depending on how backlogged the network is. Because both Alice and Bob are bitcoin maximalists, they chose to open an LN channel rather than go with a cheaper and easier to use altcoin.
Step 1: Opening a Channel

Bob creates a regular Bitcoin transaction on the main chain which defines the following:
- who he’s opening the channel with
- how much BTC he’s sending into the channel (10 BTC)
- after how long a period of time (one week in this case) he has the right to take the 10 BTC back if Alice does not respond.
The latter is actually a sub-transaction in the main transaction with a “timelock” function, which makes sure that, in spite of both parties having confirmed it, the money is not moveable for a week.
So, Bob sends Alice two transactions — one in which he suggests opening a payment channel with a 10 BTC deposit on a multi-sig which is opened with that transaction, and one in which he says the 10 BTC go back to him if there’s been no activity in the channel for a week.
Step 2: Accepting the Opening of a Channel

Alice receives two transactions in which she can see that Bob is offering 10 BTC on the multi-sig address with the two of them as the participating parties. She can also see he’s added the condition to return the money to him after one week of inactivity. She accepts this and signs the transactions, after which she broadcasts the transactions and they’re sent to the main blockchain, finalizing the channel’s creation.

It’s important to define two concepts here: signing a transaction and confirming or broadcasting a transaction. A signed transaction is merely ready for sending to the blockchain and constitutes an agreement between parties. It’s not visible on the blockchain. A broadcast or confirmed transaction is sent to the blockchain and closes the payment channel, settling balances.
Signing the first transaction opens the channel and causes Bob’s 10 BTC to be deposited into the multi-sig address. Signing the other, despite allowing Bob to take all 10 BTC back, can only become active after a week.

Alice and Bob now have a week to do the first bit of business.
Continue reading %How the Lightning Network Helps Blockchains Scale%
by Bruno Skvorc via SitePoint
No comments:
Post a Comment