What is Lightning Network and How does it help Bitcoin scale?
Old Yuppie wechat official account
原文作者:老雅痞
Imagine if every computer had to store every E-mail in order to receive any E-mail. This is how blockchain works. The Lightning network allows computers to make blockchain transactions, storing only the data they care about -- their own money.
Lightning Network is a protocol used to extend and accelerate the blockchain. It is designed to address some of the technical limitations of the bitcoin blockchain, but the Lightning network is not customized for the Bitcoin blockchain and it can be implemented on any blockchain.

Scalability was the first major motivation for developing the Lightning network, as the distributed nature of Bitcoin greatly limits the transaction rate of the network. Visa can process tens of thousands of transactions per second, but Bitcoin's network is limited to fewer than 10 per second. Another motivation for developing the Lightning network is the Bitcoin blockchain's "block confirmation time" of about 10 minutes. That means it takes 10 minutes for Bitcoin transactions to be confirmed. In addition, transaction fees on the Bitcoin blockchain range from 5 to 10 cents per transaction, making micropayments unfeasible. In contrast, lightning networks allow near-instant transactions at speeds ranging from thousands to millions per second for a fraction of a cent (or even free).
The Lightning network is based on a technology called payment channels. When two parties create a 2-of-2 multi-signature transaction on the blockchain, a two-party payment channel is created in which at least one party puts money into a 2-of-2 ledger entry. Each person has a private key, and transactions can only be made from the ledger entry if both keys are signed. The initial transaction to open the channel takes 10 minutes (or any normal block out time), but then participants can use the funds allocated in the channel to trade immediately. These immediate transactions are disbursed from 2-of-2 ledger entries by passing signature transactions back and forth.
Every transaction is valid if it is broadcast to the network and included in the blockchain by the network's miners, but in the payment channel, these signed transactions are not broadcast until the participant wishes the channel to stop running. Transactions that are signed but not broadcast are exchanged using direct peer-to-peer communication and are held by participants like convertible receipts.
To use the Lightning network, two participants, Alice and Bob, create an initial $20 transaction on the blockchain, in which each party has a value of $10.

This initial allocation can then be updated so that Alice has $5 of the total $20, and Bob has $15, and so on. As participants complete their transactions with each other, the recently exchanged transaction signatures are broadcast to the network, ultimately determining the movement of money in the channel -- some money going to one side, and some money (if any) going back to the other.
Lightning takes the technology behind payment channels and creates a network of these channels, using "smart contracts" to ensure that the network can operate in a decentralized capacity without transaction risk. For example, Alice can open a channel with Bob, and Bob has a channel with Carol, and Carol has a channel with Dave. If Alice wants to trade with Dave, she can send money through Bob and Carol, and Dave will eventually receive it (person-to-person?). . But because of the multiple signatures and smart contracts inherent in Lightning network design, Alice doesn't need to trust Bob and Carol as middlemen - the agreement uses cryptography to ensure that funds either reach Dave through Bob and Carol or are automatically returned to Alice.

Bob and Carol act as "nodes" on the network. Nodes on the Lightning network resemble miners on the Bitcoin network in some ways. They act as servers that process network transactions in a decentralized manner. Like the miners, they have no control over the money they help move. Bob cannot steal Alice's funds because if he has already sent the payment to the payee, he will only receive the collection from the sender. Therefore, receiving payment depends on whether or not it has been forwarded. Lightning payments are conditional on disclosing the encryption secret and knowing that the secret allows redemption from the previous node (Carol can now redeem from Bob when Dave redeemes from Carol).
But what happens if Bob goes offline? Does the money stay in the 2-of-2 payment channel forever? For unreliable nodes, Lightning network built-in smart contract mechanism, users can unilaterally close the channel. It uses the "hashed timelock contract" to ensure that Alice always gets her money back if Bob disappears. The contract sets a time value, usually in hours or days, so that Alice can be repaid even if Bob's server is down.
Similarly, what happens if Alice sends money from her multi-signed address to Dave on the Lightning network, but then tries to back out? She could do this by broadcasting the older transaction to the blockchain, thus attempting to close the channel to the state it was in before sending the transaction to Dave. While the Lightning software will remove this old transaction state, Alice can change the software to save it. If Alice tries to claim that she still has her old balance, Dave's software (or another designated server) will monitor such transactions in the blockchain, and when it captures Alice's broadcast transaction, she will lose all of her funds to Dave as punishment. As a result, anyone trying to broadcast the old invalid state is suppressed.
What if Alice and Bob are both online and willing to close their channels? If both parties work together to shut down payment channels, funds can be cleared to the blockchain in 10 minutes, the time it takes for a Bitcoin transaction to be confirmed. Alice and Bob may have made thousands of transactions on the Lightning network during this time.
Whether it's Bitcoin or another blockchain, the Lightning network ultimately relies on the underlying blockchain to ensure its security. In the case of Bitcoin, it protects it using the same underlying proof-of-work algorithm that protects the entire network. The blockchain is the final arbiter, or indeed an automatic judge. With the Lightning network, you always know how the judge will rule because it is pre-written into the transactions that are used to create the payment channels that make up the Lightning network. This is a judge who cannot be tricked or bought. In effect, the Lightning network allows for a "local consensus" state that is eventually enforced by a "global consensus" (blockchain). This local consensus state does not have the escrow trust similar to the traditional model, because any participant can unilaterally close and redeem their funds without the cooperation of other participants. Ultimately, Lightning uses the underlying blockchain as a means to bulk settle off-chain transactions that take place with untrusted counterparties.

Lightning networks can run on the Bitcoin blockchain, other blockchains, and can also be used to instantly transfer different assets between blockchains using "cross-chain atomic exchange." The consensus rules can be different for each blockchain, allowing for safe cross-asset classes without a custodian clearing house.
With lightning networks, small transactions or payments can flow through the network like packets of data through the Internet. It has the potential to create new use cases that were previously impossible, such as machine-to-machine payments, content micropayments, and instant asset exchange.
The ideas are based on a 2016 paper by Elizabeth StarkS. Elizabeth is a fellow at the Cryptocurrency Center and a former lecturer at Yale University.
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia