 What is the Lightning Network and how does it work for non-technical people? Let's see if I can answer this question as well as I can. All right, so first of all, the Lightning Network is an overlay network, which means that it's not a blockchain. It's not a side chain. It's not a state chain. It's not a drive chain. It's not any kind of chain. It's a peer-to-peer network that operates alongside or on top of Bitcoin and uses Bitcoin in order to secure its transactions. So it uses the consensus rules and security from the Bitcoin blockchain in order to do something very interesting, which is provide very fast and very cheap transactions. So we're going to talk about how that works next. Well, first of all, important to understand, Lightning is used to make Bitcoin payments. It can also operate on other blockchains such as the Litecoin blockchain and perhaps in the future others too. For now, it's Bitcoin and Litecoin. And it's important to understand that Lightning does not have its own currency or its own blockchain. It is simply a network for exchanging Bitcoin transactions. Let's keep that in mind first. So let's say myself and my friend Renee Picard, who's in the chat, have a Lightning connection. We want to establish a connection so we can send payments to each other with a Lightning network. So what we will do is we will set up what's known as a payment channel. Now a payment channel isn't a physical thing. It's not even a network thing. It's basically a setup of Bitcoin transactions in such a way that we can exchange value between the two of us. And the way it works is by using two key features of the Bitcoin blockchain. The first one is multi-signature transactions. Multi-signature transactions are transactions where it takes two people to sign to move money or three or four or any number of people. And the second feature it uses is time locks, which is where you can set a transaction to not be executable until some point in the future. These two features together are basically all you need in order to set up a Lightning payment channel. And any blockchain that supports these features, such as for example Litecoin, can theoretically be incorporated into the Lightning network. So let's get back to our example. Renee and I want to open a payment channel. So the first thing we do is we create a two of two multi-signature address. A two of two multi-signature address is basically an address where if you put money into it, it can only be spent from that address if both of us sign. So in the background over a network connection, Renee and I exchange some keys so that we can set up this multi-signature address. So we effectively exchange public keys so that we can set up this multi-signature address. Now, at that point, one of us will fund this address by putting money into it. Let's say I put one-tenth of a Bitcoin into this transaction. So 0.1 Bitcoin into this transaction, into this address. So I do a regular transaction on the Bitcoin blockchain that sends 0.1 Bitcoin to this multi-signature address. That transaction is called the funding transaction because it funds the channel between us. So again, let's take a step back. What is a payment channel? A payment channel is basically an arrangement between me and Renee and it's an arrangement in this case that allows us to spend money if we both sign and allows us to keep track of a balance that we keep in that virtual payment channel that allows us essentially to transfer money from one party to the other for me to Renee, from Renee to me, for example, using transactions that are potentially broadcast on the Bitcoin network. So I've put 0.1 Bitcoin into this multi-signature address. After six confirmations this will now be valid and fully confirmed on the Bitcoin blockchain and now we have a funded channel. Now what is the balance of this channel? Interesting thing in Lightning is the payment channel has two balances. It has what is called a local and what is called a remote balance. And of course it depends on the perspective. My local balance is the money I have in the channel and my remote balance is the the money that Renee has in the channel and for Renee of course it's the opposite. His local balance is what he has in the channel and his remote balance is my balance. So in every payment channel there's two balances. Think of it as a pile of money sitting on one side of the channel and a pile of money sitting on the other side of the channel. When we opened this channel between us because I funded it into the multi-signature address with a transaction, the money is all sitting on my end of the channel. Essentially there's zero on the other side and there's 0.1 Bitcoin on my side and that's our current balance. I own 0.1 Bitcoin which is in the channel on my side. Now if I wanted to send money over this payment channel to Renee, now the magic of Lightning starts because I do not need to do an on-chain Bitcoin transaction in order to exchange value with Renee. I can't spend out of this channel without Renee's agreement. Renee can't spend out of this channel without my agreement and that means we don't have to trust each other. As part of the address, there's also a script that allows me to get a refund for the money I put in after a period of time in case Renee just disappears and leaves me hanging. So there is a mechanism to ensure that the money isn't just locked in there and unable to be retrieved by anyone. All right so now we can start exchanging transactions. What we do is let's say I want to send money across this payment channel to Renee. What I'm going to do is I'm going to partially sign a commitment transaction that spends from this multi-signature address and it creates two outputs. One output which is let's say 0.01 Bitcoin that is spendable to Renee and one output which is 0.09 Bitcoin which is spendable to me. So I took the 0.1 Bitcoin and I took a tenth of that and gave it to Renee and nine tenths back to me and if Renee agrees he can countersign that broadcast it on the network and as a result get that Bitcoin but there's no reason to broadcast that transaction because Renee knows that any point in time since it's already signed by me Renee who's my counterpart in this channel can spend it. All they have to do is apply a signature broadcast it on the Bitcoin blockchain and the Bitcoin blockchain will split the money in the proportion of the channel balances agreed. So at this point the channel has a balance of one hundredth of a Bitcoin on Renee's side nine hundredths of a Bitcoin on my side and so we've split that balance. Effectively what has happened is I've moved 0.01 over to Renee's side but nobody knows this. The only thing that happened is we exchanged a sign transaction over this peer-to-peer network effectively moving balance between us. Now this is the basic concept of a payment channel if Renee wanted to move money back to me we could then create a new transaction that spends the original funding transaction that was sent to the multi-signature address but which has a different distribution of balances between Renee and me and effectively that transfers balance back and forth and back and forth and we can do this as many times as we want we can send these transactions as fast as we want to each other hundreds of times per second and each one that we send uses a clever trick to invalidate the previous transaction so that now only the latest one can be spent if we decide to close this channel and allocate the balance as is. That's the basic concept of a payment channel. Now imagine that Renee has a payment channel to Carol and I have a payment channel to Renee and I want to pay Carol well instead of opening a new payment channel directly for me to Carol what we can do is we can make an agreement whereby Carol shares a hash with me and I pay to that hash that's done in the form of a lightning invoice and the way we do that is that Carol has a secret that is hashed and Carol will only reveal that secret when Carol is paid so I make a payment over my channel to Renee for the amount that Carol is to receive and that payment is contingent upon the secret from Carol. Renee then makes a payment on his channel to Carol which is also contingent on the same secret. Renee can do that because he knows that if he gets the secret from Carol because she cashed his payment he can use that same secret to get the payment from me which means that there's no risk he doesn't have to trust Carol he doesn't have to trust me if neither of us come through nothing happened and the channels are back where they used to be that transaction that is routed between us is called the hash time lock contract or HTLC and you can string as many payment channels as you want in this way where I make a promise to Renee Renee makes a promise to Carol Carol makes a promise to Dave Dave makes a promise to Elizabeth Elizabeth makes a promise to Frank etc etc and once we set up all of the promises then the secret flows backwards and each of these promises gets fulfilled no one could be cheated along the way no one ever has custody because every channel requires two signatures and agreements between both parties no one can ever be cheated because if anybody drops out halfway through then none of the payment chain happens and everything reverts back people can get refunds after a timeout if the other party disappears etc so this is a trustless system nobody has to trust anyone it's a non custodial system because no one has custody of the money it's in a multi-sig between the two parties for every payment channel and because we don't have to wait for confirmations because we only do that when we close channels all of the payments in between give us the ability to make very very fast payments now if in each one of these hops the party score participating ensure that the payment they receive is a few satoshis more than the payment they send out to the next person that difference of a few satoshis is effectively a routing fee that they can collect and they can tell the rest of the network what routing fees they want in order to forward a payment and that way there is a mechanism of fees as well in the lightning network so that's the overview of how the lightning network works and the most important thing to remember is that the lightning network transmits partially signed or fully signed bitcoin transactions that's a simplification not exactly it's it's easier to just transmit the signatures but effectively we're operating in the realm of bitcoin transactions perfectly valid bitcoin transactions that can be constructed by each of the peers these transactions are based on spending from a two-of-two multi-signature which means that neither party can run away with the money which means that there's no trust involved when you when you string along several payment channels in order to make a payment no one has to extend any trust people can receive refunds if the other parties disappear and the payments that we are transmitting are bitcoin transactions that are transmitting satoshi so this is just bitcoin just on a faster basis with private peer-to-peer transactions that can operate very cheaply if you enjoyed this video please subscribe like and share all my work is shared for free so if you want to support it join me on patreon