What is Lightning Network and How does it Work?

Network scalability has been a hot topic of discussion in the bitcoin community over the last couple of years, and there are many different solutions in the works from a variety of bitcoin developers and sub-communities.

The Bitcoin network transaction limit is very low right now and it can currently handle only a handful of transactions per second. That is in comparison to classic payment providers like VISA ridiculously low. For a global network with potentially billions of users, Bitcoin needs a drastic increase in the number of possible transactions per second. One of the most promising solutions in this scaling debate is the Lightning Network.

A “Game-Changing Innovation”

 

Lets start by defining the purpose of lightning:

The Lightning Network is a decentralized system for instant, high-volume micropayments that removes the risk of delegating custody of funds to trusted third parties.

Simple explanation:

lightning proposes to solve the blockchain scalability problem by using trustless peer-to-peer payment channels, with transactions within those channels happening instantly and off the blockchain.

At the core of the Lightning Network proposal is the usage of bitcoin micropayment channels.

When two users open a payment channel together, they create a new 2-of-2 multisig address. As they are funding it, they also create an exit transaction for each user. The exit transactions can be activated unilaterally.

So opening a payment channel requires writing on the blockchain to protect against double-spend. First you establish a refund from the funding transaction, then you broadcast the funding transaction which needs to be mined into the blockchain before payments can be made in the channel securely.

[x_line]

One on-chain (blockchain) transaction is needed to open a channel, and another on-chain transaction can close the channel. Fees are paid to the miners on these first and last transactions only.

Once a channel is open, value can be transferred instantly between counterparties, who are exchanging real bitcoin transactions, but without broadcasting them to the bitcoin network. To update the balances in the channel consent of both parties is required.

Should a user wish to close a connection, the smart-contract can be executed on the Blockchain as a regular transaction. So, when the channel is closed by both parties, the accounts “settle up” with the Bitcoin blockchain.

So, the Lightning Network system utilizes bidirectional payment channels that consist of multi-signature addresses.

back to menu ↑

How can people not double spend the same coins?

 

Lightning still relies on the blockchain to prevent double-spends even though the bulk of the lightning transactions are done off-chain. Holding value on a Lightning Network means that you are in possession of double-signed transactions. The transactions are valid, but they are not yet broadcasted to the Bitcoin Network.

Lets say we want to have a payment channel between 2 users.

What happens when a payment channel is opened is that the user sending the coins deposits some funds into a multi-sig wallet - this is the opening transaction and it is done on the blockchain. Once the channel is open, the 2 users can shift the deposited funds anyway they like, an infinite amount of times (but they both have to agree on the result, if there is a disagreement any one of them can unilaterally close the channel without losing his funds).

Once the 2 users are done shifting funds between them, to fortify the final balance, the payment channel is closed using the closing transaction which is committed to the blockchain.

back to menu ↑

Do parties in a Lightning Network channel need to be online?

Yes!

The transactions require both parties to be actively participating in updating the smart contracts that keep the channel alive. If one party fails to respond, they are essentially in violation of the smart contract, and are forfeiting their claim to any of the funds in the channel.

Penalizing unresponsive nodes is a feature of the lightning network, intended to keep it functional. By leaving the channel unattended, one party is doing a disservice to the other. Making that behavior financially disastrous is what makes the system work in the first place.

Users will need to run software that is actively monitoring the blockchain for contract breaches (broadcasting of an obsolete transaction)

However, it will be possible to outsource this monitoring to a third party.

Outsourcing will not affect your privacy, but you must trust the service to actually do its job.

back to menu ↑

How are paths found in Lightning Network?

The currently suggested routing would be similar to the Border Gateway Protocol. The suggestion so far was to use beacon nodes that are periodically selected by a pseudo-random process.

Altogether, “shortest” path would be some combination of reachable, sufficient liquidity, lowest fee, fewest hops, and most reliable. back to menu ↑

What Resources Does It Take to Run a Lightning Node?

A (pruned) full bitcoin node, for now. Using a full bitcoin node is always going to be the safest and most private option (and more full nodes are good for everyone else, too!), but light nodes are possible with some caveats, some of which can be removed by further extensions to the lightning protocol.

back to menu ↑

How will the lightning network handle lightweight clients?

Most steps during the payment process in an LN channel don’t actually require full knowledge of the blockchain or even the unconfirmed (mempool) transactions. This is because the transactions involved deal with 2-of-2 multisig scripts, where both parties have to sign off on each transaction to make it valid, so they both can stay aware of all transactions made relevant to the channel they share without monitoring the blockchain.

back to menu ↑

Privacy is a frequently overseen feature of LN

And it has been a major focus while working out the protocol. Currently, Lightning payments are routed in a similar fashion as Tor traffic, meaning that only the endpoints of the transaction, sender and receiver, know what is going on and all the middlemen have no idea. They just forward the package having no knowledge about the sender and the receiver of the payment they are helping to facilitate.

back to menu ↑

Is centralization in the Lightning network inevitable? Why (not)?

Lightning Network channels will naturally tend to form along the paths of economic activity. We should assume that most channels will be between users and those very same large businesses. This large businesses could become megahubs that would have the advantage over smaller hubs because they'd be more likely to have a route to whoever you want to pay and those routes are likely to have fewer hops.

The thing is, if this is true it doesn't really affect Bitcoin. Even if the result is that everyone is connected to one single hub, that hub has 0 power to influence miners.

If that megahub ends up being a bad actor, someone can easily switch to another hub. There might be some privacy issues with a megahub, and they could censor transactions, and that kind of thing, but it wouldn't be able to steal your bitcoins nor would it be able to hijack the consensus rules of bitcoin for its own gain.

back to menu ↑

Who is supporting it within Bitcoin community?

At least three companies – Poon and Dryja’s Lightning, Blockstream and Blockchain – are currently working on implementations of the technology.

back to menu ↑

What are main pros and cons of LN?

PROS:
  • Tiny payments are possible: since fees are proportional to the payment amount, you can pay a fraction of a cent; accounting is even done in thousandths of a satoshi.
  • Payments are settled instantly: the money is sent in the time it takes to cross the network to your destination and back, typically a fraction of a second.

CONS:
  • Peer failures: if one of your peers is unresponsive, you might have to wait for hours to close that channel spend your funds.
  • No Offline Payments: you can’t pay someone who is not online
  • Terrible for large payments: If there is a route, but it doesn’t have capacity to transfer the amount you want, you can’t use it.

back to menu ↑

Can LN be run on other cryptocurrencies?

You can run lightning Network on top of Ethereum, you can run lightning Network on top of any cryptocurrency that enables the three basic primitives: checking hashes; Multi signature contracts and lock time time-based controls.

 

back to menu ↑

Lightning Network scaling alternatives?

The obvious one would be side chains, the idea being that the transactions on the side chain would be off the main chain.

Most other scaling solutions are either on-chain or centralized. For example, segwit and block size increases are on-chain and using a service like coinbase to move coins off-chain are clearly centralized.

back to menu ↑

How secure is Lightnining Network?

The security in a Lightning Network is extracted from the underlying Bitcoin Network.

A Lightning Network cannot operate on its own; it is completely dependent on the underlying bitcoin network for security. If something goes wrong in a Lightning channel (like your counterparty going offline) you will always have the option to fall into the safety-net which is bitcoin network and blockchain.

back to menu ↑

Summary

Lightning is neither a soft-fork nor a hard-fork.

Instead, the Lightning Network builds an additional layer on top of the bitcoin network.

Implementation is therefore independent from consensus.

Lightning allows you to lock coins between two wallets, and then send special transactions between each wallet which only become “real” when they are added to the blockchain. But you don’t do that, because on-chain costs you more fees, so you keep updating the transactions between each other.

Lightning not only makes it possible to send transactions off-chain from A to B, but also from A to B to C etc. Which would make it possible to create one big network, where most transactions happen off chain, you don’t need to trust anyone and where all transactions are instantaneous. 

Resources:

Lightning Resources: https://medium.com/lightning-resources

http://lightning.network/

https://letstalkbitcoin.com/blog/post/lets-talk-bitcoin-286-drinks-on-a-lightning-network

https://letstalkbitcoin.com/blog/post/the-lightning-network-elidhdicacs

https://github.com/lightningnetwork/lightning-rfc/blob/master/00-introduction.md

https://www.youtube.com/watch?v=8zVzw912wPo


  Join Our Telegram Channel or follow us on Twitter
 
CaptainAltcoin's writers and guest post authors may or may not have a vested interest in any of the mentioned projects and businesses. None of the content on CaptainAltcoin is investment advice nor is it a replacement for advice from a certified financial planner.

We will be happy to hear your thoughts

      Leave a reply