Featured Post

Friday, September 29, 2023

Learning More about Lightning Network

One of the first podcasts I found was very helpful:  this episode of "We Study Billionaires."  The host speaks with Ryan Gentry, who is in business development at Lightning Labs.  So long as you know some of the qualities and rules of Bitcoin, you should be able to get good information from the episode.  It's over an hour long.

A quicker one that was still helpful was this episode of "Upgrade the World."  It is only 10 minutes long and also assumes that you know some basics about Bitcoin.

The third helpful podcast was this 1/2-hour episode of "Who Is Satoshi."

Some of what I learned...  VISA and Mastercard can process thousands of payments per second.  If Bitcoin is ever to be widely used to buy day-to-day things, like lunch, it ought to have that kind of capacity.  But, the Bitcoin network can only process about seven transactions per second.  A reason for this is the limited number of transactions that can be included in each 10-minute block.  In addition to that limited capacity, the cost of each transaction can be relatively high.  To pay for a $8 lunch with Bitcoin, you might incur a $3 fee.  Lastly, I learned that Bitcoin transactions can take many minutes to even hours to be confirmed.  You might pay for your lunch but have to wait at the restaurant for 1/2-hour for the transaction to clear before they'll let you leave the building!

The Bitcoin blockchain is "layer 1," and Lightning Network is "layer 2."  They are interconnected and communicate with each other, but Lightning Network allows for faster and cheaper transactions that can scale up far above seven transactions per second.

My understanding now is that many Lightning Network nodes connect to each other to form that network.  A channel is opened between two nodes and funded with some amount of Bitcoin.  This is a transaction that requires the blockchain, layer 1, and will incur an on-chain fee.  Once the channel is funded, though, it can take part in Lightning transactions that are faster and cheaper.  With only two nodes connected to each other and funded in both directions, they are the only two that can send Bitcoin.  However, the network is now thousands of nodes large.  Many sites have graphic representations of the network,  Here is one.  A screenshot of its state on 9/29/2023 is below.
The podcasts above have nice examples of how the network functions.  Briefly, if my wife and I each have a Lightning Network node, we can open a channel between the two nodes.  It is a payment channel that has an ongoing balance and an incoming balance, from the point-of-view of your node; my outgoing balance is my wife's incoming balance on that channel.

Generally, if I were the one to open the channel, it would only be funded on "my" outgoing side.  Bitcoin could only be sent from my node to hers.  However, once such a transaction occurred, she would have some funds on her side of the channel, her outgoing side and my incoming side.  At that point, transactions can go in either direction, provided there is enough Bitcoin to fulfill the transfer.

To be more specific, if I open the channel between our two nodes and choose to fund it with 1 million Satoshis (0.01 Bitcoins), that transaction will be recorded on the blockchain.  Then, I have 1,000,000 Sats that I can send to her node or through her node.

For that second part, if my wife has a channel to Jane, but I don't, I can send money to Jane through my wife's node.  The only requirements seem to be that some path can be made through the network and that each step has enough outgoing Bitcoin in the channel to complete the transaction.  If my channel to my wife has the 1 million Sats available outgoing, but her channel to Jane has only 50,000, I can only send 50,000 Sats to Jane.

At the start of that example, assume Jane's outgoing to my wife is 0 and my wife's outgoing to me is also 0.  No funds can come to me from Jane or my wife.  However, once I send the 50,000 Sats to Jane through my wife, they each have 50,000 Sats on their side of the channel.

(My 50k went to my wife but stayed in our channel.  They are on "her side" of the channel and now owned by her.  My wife's node then sent 50k to Jane through their channel.  Jane now can see and use the 50k Sats, for they are hers; they are on her side of their channel.)

With many nodes interconnected, the network can find paths for Sats to be sent from one person to another through as many channels as are needed.

Next, I think I'll post about funding and channel strategy.

No comments:

Post a Comment