applancer Advertise

Lightning Network, Explained

Dec 03, 2017

Lightning Network, Explained
What is this all about?

Blockchains are sluggish.

And therefore, costly. If I had to refer you limited Bitcoins, you’d get them in about a pair of hours and I’d have to give a heavy transaction fee too. With such a standing, how will Blockchains take over the globe?

Any knowledge that can solve the non-scalability of Blockchains is value attention, time and energy. Lightning Network is one such idea. But before we apprehend the solution, we’ll need to know the issue. If you’re previously aware of the issue, you can directly hurdle to the next section.

Why Blockchains are slow?

Think of a Blockchain as a certified. And this register covers several blocks where each page has numerous transactions. As soon as a page has been occupied with transactions, it requires to be added to the register before beginning to record transactions on the next block.

Before a block can be added to the register, there’s some handling that needs to be done to guarantee that everyone agrees with the innards it contains. The process roughly takes 10 minutes (for Bitcoin Blockchain) for respectively block.

The transaction will look somewhat like this. Among other things, a transaction covers information about the sender, the receiver, the amount and the business fee.

Wait a minute, transaction fee?

Yes, there’s an extra charge. You can charge it to incentivize miners to contain your transaction in a block as soon as conceivable. There’s no set value and it’s completely up to you how much you are eager to spend to speed up the procedure. The greater the fee, quicker your transaction will go completed.

At any given second, there are numerous transactions existing to be recorded on the existing page. The miners, i.e. computers functioning in the Blockchain network, have to choose which of the accessible transactions to contain in the current block. To help them choose, they look at which dealings yield the most recompenses — meaning that the transactions with the utmost transaction fee will be comprised first.

If there are enough dealings with a higher transaction fee than yours to fill up the block, your transaction will have to wait in backlog. The wait can last from a few summaries to a few hours. And sometimes, even days. The more you wage in transaction fees, the faster your transaction is processed.

That’s why Blockchains are sluggish, and therefore, costly for everybody to start using. Idealistically, the consent of Blockchain would mean more transactions done but as the number of dealings goes up, the network will convert slow, making an obstacle for adoption. What an absurdity!

Lightning Network (LN) is a possible answer to the problem.

So what is Lightning Network again?

The idea behind LN is that not all dealings are needed to be recorded on the Blockchain.

Envision you and I transact fairly a few times among ourselves. In such a case, we can bypass demo the transactions on the Blockchain and transmit them off the chain.

In the naivest terms, how it’ll work is -- we’ll open something named a payment network between us and record its opening on the Blockchain. Now, you and I can manage any number of times via this payment network and it can sojourn open for any number of hours, days, weeks or decades. The only time we would touch the Blockchain ever again will be when we would want to close the channel. Then, we’ll inscribe the concluding status of the transactions that happened through the channel on the Blockchain.

Using this idea of payment channel, we can create a network of payment channels such that it would be only rarely required to transaction on the Blockchain. Imagine there are three typescripts - Xan, Yelena and Zeke.

If Xan and Yelena have a payment channel opened between them and Yelena and Zeke have a payment channel opened between them, then Xan can send money to Zeke via Yelena.

Suppose Xan wants to send 2 BTC to Zeke, Yelena will send 2 BTC to Zeke and Xan will reimburse Yelena with 2 BTC.

That’s what the idea of Lightning Network is. Because you won’t be moving the Blockchain frequently, the transactions will be done at fast speed. As you might have guessed by now, all the magic happens in the payment channels. Let’s learn the magic trick then.

And what are those payment channels?

It’s like a security deposit box where two people credit equivalent amounts of money and each put a padlock on it. This action of depositing equal amounts of money in a common box is recorded on the Blockchain in the form of an ‘Opening Transaction’ and thereafter a payment channel is open between those two people.

The clue behind securing money in such a box is that no one person can occupy the money in the box deprived of the other. The money in this box is then used to transact between each other.

Imagine, Xan and Yelena pool in 10 BTC each in the common box. And now, if Xan needs to send 2 BTC to Yelena, how would he do?

To do that, he would transfer a promise of ownership for two of his Bitcoins in the common box to Yelena. After this handover of promise, if the box is solved, Xan will be capable to take 8 BTC from it and Yelena will be able to claim 12 BTC.

But they will not open the box because they want to continue transacting between themselves. That’s the beauty of this arrangement.

Now, if the following day, Yelena has to direct 1 BTC to Xan, she would do the similar - transfer a potential of ownership for one of her Bitcoins to Xan. After these two transactions, if the box is opened, Xan can claim 9 BTC and Yelena can get 11 BTC.

To imagine how off-chain transactions look like, consider this:

To sum it up, payment channel is nothing but a combination of pooling some money together and then transferring the promise of ownership of the pooled-in money in the agreed upon manner. If ever either of Xan or Yelena needs to close the network, they can.

Terminating a network would only mean opening up the box and taking the money inside. This opening of the box happens on the Blockchain and who owns how much from the box is recorded forever.

That’s how payment channels work. But that doesn’t even come close to defining their true potential. Their true power is unleashed when two or more payment channels work together to form a network - The Lightning Network.

Got it, so how does it actually work?

LN works by touching the value from the possession of the Bitcoins to the ability of ownership of the Bitcoins.

This shift is huge. Like always, we will use an example to understand this. Imagine there are three people - Xan, Yelena and Zeke - such that there’s a payment channel open between Xan and Yelena, and there’s another channel open between Yelena and Zeke. Note that Xan and Zeke have no payment channel between them.

In such a condition, if Xan needs to transfer 2 BTC to Zeke, he can use the sum network between Yelena and Zeke to do that. How does that look like?

Xan asks Yelena to transfer a promise of 2 BTC to Zeke on Yelena-Zeke payment channel and then he reimburses Yelena with 2 BTC on Xan-Yelena channel.

With such link of payment networks, a huge portion of transactions can be divested from the Blockchain to be carried out off the chain, therefore, freeing up the chain’s bandwidth. Using a network of payment channels, millions of transactions can happen, and that too without a hefty transaction fee.

That’s the Lightning Network.