Author

Topic: A Beginner's guideline to Bitcoin Lightning Network (Read 1366 times)

hero member
Activity: 1358
Merit: 851
bump
full member
Activity: 154
Merit: 177
I know it sounds complicated. I am working on a thread which will explain it in a more understandable way.

thanks a lot for explaining it. yes it is kinda hard, i try to wrap my head around it, i just need some time to digest that all, it's fascinating - i looked for a save button here, i guess there is none and i just save the url  Cheesy i am looking forward to the thread - it will be a good one
legendary
Activity: 1876
Merit: 3132
is the period of that timelock every time a new commitment is broadcastet updated? so it is a moving timeframe? and that timeframe will be set in stone with the opening transaction on the base layer, is that correct?

I might have phrased that slightly wrong, so let me explain it in more detail. If you are closing a channel uncooperatively, there are actually two on-chain transactions involved instead of just one.

First of all, the timelock is decided before the channel is established. By default, most nodes force the other peer to wait 144 blocks (~1 day). The maximum acceptable value by default is 2016 blocks (~2 weeks). I configured my node to create channels with their_to_self_delay = 432 blocks (~3 days), so if someone decides to close the channel opened to my node uncooperatively, they will have to wait 432 blocks (after the commitment transaction has been included in a block) before they can spend the output belonging to them. Those timelocks are relative which means that you do not have to sign a new commitment transaction whenever a new block is mined. New commitment transactions are signed periodically because their fees need to match the current state of the mempool. There is no point in paying 60 sat/vbyte when 1 sat/vbyte transactions are getting confirmed in just a few minutes. It also applies the other way around.

The first transaction is the commitment transaction. Let's say there's node A(lice) and node B(ob), and node A broadcasts the commitment transaction. That commitment transaction includes two outputs:

- output #0: 3 BTC (spendable by node B's private key) - reflecting node B balance
- output #1: 6 BTC (RSMC) - reflecting node A balance

There is one more important detail before we go any further. Whenever a new commitment transaction is signed, both parties exchange revocation keys for the previous commitment transaction so that they can both be sure that the other party is very unlikely to broadcast an old state of the channel.

RSMC is short for Revocable Sequence Maturing Contract. Such an output contains a relative timelock. This means that you can't spend this output until a certain amount of blocks have been mined since the transaction which includes that output was mined.

Let's say node B didn't change the default value of 144 blocks and the commitment transaction has been confirmed. There are two possible scenarios.

1) Node A attempts to cheat and broadcast an old commitment transaction. Node B has 144 blocks to spend the RSMC output using his and node A's revocation key which he got while they were working on a new commitment transaction.

2) Node A broadcasts the latest commitment transaction. In such a case, node B never got node A's revocation key for that commitment transaction, so he cannot spend that RSMC. Node A can broadcast another transaction spending that output after 144 blocks have been mined.

I know it sounds complicated. I am working on a thread which will explain it in a more understandable way.
full member
Activity: 154
Merit: 177
The other party would very likely close the channel forcefully after some time. It would be possible because channel participants constantly sign new commitment transactions which can be used to settle the balance on-chain once a certain timelock has passed.

is the period of that timelock every time a new commitment is broadcastet updated? so it is a moving timeframe? and that timeframe will be set in stone with the opening transaction on the base layer, is that correct?
legendary
Activity: 1876
Merit: 3132
Curious, How if in the end or bad happened like lost of the private key then not able to make sign signature and the are not able to online, what's the next will be?

The other party would very likely close the channel forcefully after some time. It would be possible because channel participants constantly sign new commitment transactions which can be used to settle the balance on-chain once a certain timelock has passed.

Unfortunately, in this case, the other party could attempt to cheat by broadcasting some old commitment transaction. Normally, you would be able to revoke it and publish a penalty transaction. A watchtower could also do that but it would have had to be set up beforehand.

However, not all participants of the network have malicious intentions. If the channel was closed using the latest commitment transaction, you would get all of your coins back to your on-chain wallet which you should be able to recover using your seed.

I am not sure how mobile wallets behave, but LND generates a backup file which lets you close your channels thanks to data-loss protection (note that in this case your peers have to cooperate with you). C-lightning users can use a backup plugin which makes a copy of the whole channel database whenever it is updated. If you have such a copy, you can easily recover your node without having to close any channels.
newbie
Activity: 16
Merit: 0
Sorry for pumping this the thread.

Curious, How if in the end or bad happened like lost of the private key then not able to make sign signature and the are not able to online, what's the next will be?
full member
Activity: 411
Merit: 199
Join the Bitcoin Lightning Revolution (Ask me How)
Guys,

The LN is a great re-invention and a smart try of bringing back micropayments into the Bitcoin world that faded away when the transfer fees had risen significantly.

I really like this technology and actually I dropped from the btc world about 3 years ago when micropayments became expensive, in 2020  I decided to take another look to see what's going on and discovered the LN.

To get you started, please check out this thread to get your 200 satoshis to play around with the LN bitcoins:
https://bitcointalksearch.org/topic/--5275451

For some more fun, visit my Telegram channel where we occasionally play a simple Lightning Dice doing small quick and easy bets (100-1000 satoshis depending on the mood) via LN:
https://web.telegram.org/#/im?p=g407859681
  
You will see how easy and simple you can send and receive a couple of $$ via the LN.

Word of Caution: For the start, install one of the easiest custodial wallets like Wallet of Satoshi or Blue Wallet. Leave more advance stuff for the future.

GO LIGHTNING GO !!
sr. member
Activity: 1372
Merit: 322
Bob open a 1BTC channel with Alice and send her 0.5BTC. If Alice wants to send Bob 0.5BTC may she uses the same channel or it is just onedirection channel  and she has to open another channel which is in direction Alice->Bob and use this for paying Bob.
What you need to understand is that LN is a kind of settlement. So, yes. Alice can send Bob and vice versa with one channel. But there are some sort of restrictions on receiving fund. If you have started a channel with 1 BTC, as long as you don't send any fund, you can't receive any too. You can only receive fund as the same amount which you sent although it can be increased in some way.
legendary
Activity: 1876
Merit: 3132
Is LN channel bidirectional?

Yes, all Lightning Network channels are bidirectional. There is no reason to artificially change that. Consider reading my "Basics of The Lightning Network" thread if you are still confused. I also updated the FAQ yesterday. You might find these two threads useful.

2) May Bob and Alice open just 1 channel where both fund 1 BTC so the total balance of the channel will be 2 BTC or the only possible way is that Bob opens channel with Alice where he funds 1 BTC so the total balance will be 1BTC and Alice has to opend channel with Bob, where she fund 1 BTC?

Currently, it is not possible for two people to provide funds for the same channel. Theoretically, Bob could open a channel with 2 BTC and push 1 BTC to the Alice's side.
newbie
Activity: 8
Merit: 0
Hi guys,
I would like to ask one question, cause I am a little bit confused. The question is about payment channels and their direction. Is LN channel bidirectional? I read on the Internet tha channel shoul be but I am not pretty sure, if It has been developing or if it has already worked.

Example:

1) Bob opens a 1BTC channel with Alice and sends her 0.5BTC. If Alice wants to send Bob 0.5BTC may she uses the same channel or it is just onedirection channel and she has to open another channel which is in direction Alice->Bob and use this for paying Bob.

2) May Bob and Alice open just 1 channel where both fund 1 BTC so the total balance of the channel will be 2 BTC or the only possible way is that Bob opens channel with Alice where he funds 1 BTC so the total balance will be 1BTC and Alice has to opend channel with Bob, where she fund 1 BTC?

Thank you veru much for response
newbie
Activity: 6
Merit: 2
Thank you for the guide.
Looking for more reallife cases to see it better in application.
I believe however, LN has a good future, especially when it comes to payments made in local shops.
hero member
Activity: 1358
Merit: 851
I have not seen it on reputed exchanges.
Bitstamp and Bitfinex are two of the reputed exchanges which at the moment accepting Lightning Network payments; I don't know how much reputed both the exchanges to you. I had created a thread on exchanges accepting LN payments- Some exchanges accepting Lightning Network
And yeah, LN is very good for the small transactions; big transactions are mostly unlikely to be transacted through LN unless someone needs super fast transaction.
legendary
Activity: 1512
Merit: 4795
Leading Crypto Sports Betting & Casino Platform
The lightning network makes transactions faster at low transaction fee. It is only supported by few wallets now. I have not seen it on reputed exchanges. It is good for small transactions lime the coffee shop used as an example and lastly, it is a bit centralized.
legendary
Activity: 1876
Merit: 3132
Someone (Bitcoin developeers??)  just did an upgrade for wallet and only one point which has to be done is to upgrade wallet (or the provider has to upgrade wallet) and than you are free to use LN. Or what is the process of implementation ?

You have to use a dedicated software wallet in order to be able to use the Lightning Network. Lightning Network wallets can also act as normal Bitcoin wallets. Otherwise, they wouldn't be able to open and close channels which require on-chain transactions. The Lightning Network works on top of the Bitcoin blockchain and is fully optional so I doubt it will be available in every wallet. Each implementation has to follow the specs.

Channels are established and closed using Bitcoin transactions and the transactions inside the channels (they are not broadcast to Bitcoin nodes) are valid thanks to timelocks and pre-signed Bitcoin transactions. I guess that's the shortest possible way of describing how it works.
newbie
Activity: 8
Merit: 0
Hi guys,
I am just curious, how it is possible, that LN is implemented without softfork ( I know that thanks to Segwith LN is implemented) but what is the proces of implementation ? how does it worked ? Someone (Bitcoin developeers??)  just did an upgrade for wallet and only one point which has to be done is to upgrade wallet (or the provider has to upgrade wallet) and than you are free to use LN. Or what is the process of implementation ? Thank you very much.
full member
Activity: 519
Merit: 197
You can also use LN with gambling sites.
Well, there are a lot of usage of LN; in daily life, where you used to purchase your daily necessaries could be a great place for lightning network payments.
I found website storing payment by the lightning network
https://lightningnetworkstores.com/
https://joltfun.com/
Never tried before so do with your own risk.
hero member
Activity: 1358
Merit: 851
However these concepts are hard to grasp for common folk, this won't be easy at all.
I have tested LN with testnet BTC and so far, it's very easy to use & hadn't face much of problem. I have done it with Eclair BTC wallet & I guess this one is very much user-friendly; even for a non-tech guy.
Quote
I see very little reason to use LN in most bitcoin transfers, others will try to (ab)use it for everything including a lambo...
Not true. LN can be used as wide variety of payments where we do transfer BTC in a regular basis. For instance; you can use LN in exchanges for liquidity of your BTC instantly or putting a purchase order of ETH(any alt) faster. Or you can also have the arbitrary opportunity with LN; transferring BTC from exchanges to exchanges made faster with LN. Bitfinex & some other exchanges accept LN payment now. You can also use LN with gambling sites.
Well, there are a lot of usage of LN; in daily life, where you used to purchase your daily necessaries could be a great place for lightning network payments.
No one will use LN for a bigger amount payment of course; LN is designed to focus on micro payments generally.
You have the privacy benefit as well; I'm not certain though but as far as I know, it's not that easy to trace a LN payment of course.

Quote
but you could also have paid the coffee long before going into the shop (such as from your workplace).
I don't know if people would be much of interested to pay advance for a coffee from workplace which is gonna be drunk after a while; Have you ever paid for such items with other available payment network? In my local, I could have paid advance with paytm but I doubt I would ever consider paying advance for a coffee; in fact, I wouldn't for anything other than ordering something online which require advance payment.
legendary
Activity: 2030
Merit: 1569
CLEAN non GPL infringing code made in Rust lang
Two problems we see when you want to pay $2 for a coffee.
- You will not be happy to pay $1 fee for spending $2 worth of BTC.
- Alice will not accept BTC because it requires much time to get confirmed.

This is not true. Alice can wait and not serve you anything until it gets a confirmation, it is you Bob who needs to leave quickly. There is no reason for Alice to reject bitcoin, she could risk it and trust you or make you wait. LN is like a virtual tab that would help alleviate this in the future, but you could also have paid the coffee long before going into the shop (such as from your workplace).

Of course if you are a recurring customer, you would make the most use of it, since you both can leave the channel open and do several more transactions maximizing the LN use before consolidating.

However these concepts are hard to grasp for common folk, this won't be easy at all. Wallets need to be designed very carefully when they support LN. I see very little reason to use LN in most bitcoin transfers, others will try to (ab)use it for everything including a lambo...
full member
Activity: 519
Merit: 197
Because you quated me, look like bitlum.io website has been off. Can't use any more

I have news about bitfinex exchange use LN now.
https://www.bitfinex.com/posts/440
Quote
Bitfinex Launches Support for the Lightning Network

Connect to the Bitfinex Lightning Node https://ln.bitfinex.com/

https://support.bitfinex.com/hc/en-us/articles/360039801053-Lightning-Network-BTC-LNX-Deposits-Withdrawals

Lightning Network BTC (LNX) Deposits & Withdrawals



full member
Activity: 1204
Merit: 220
(ノಠ益ಠ)ノ
LN boxes:

raspiblitz
https://github.com/rootzoll/raspiblitz

Lightning-in-a-box
https://lightninginabox.co/product/lightning-in-a-box-qotom-case/

Nodlbox
https://www.nodl.it/nodlbox/


Raspiblitz right now probably one of the best ways to learn LN. Very easy to deploy, smooth learning curve, will teach you all you need to start) Haven't tried btcpayserver (https://github.com/btcpayserver/btcpayserver) tho, but looks like docs are fine
legendary
Activity: 2296
Merit: 2892
#SWGT CERTIK Audited
-snip-
Bitlum wallet is an alternative that can also be used to make LN transactions. Based on other people is experiences, Bitlum wallets charge 1 satoshi per transaction.
Never heard about Bitlum wallet. -snip-
FYI, Bitlum wallet is shutting down in October 20th,
https://bitlum.io/
The website address is no longer actively. Use the following link to view the announcement:
https://webcache.googleusercontent.com/search?q=cache:9TSE4rbsgGsJ:https://bitlum.io/+&cd=8&hl=id&ct=clnk&gl=id

You can read more information about that in this article:
https://medium.com/bitlum/bitlum-shutdown-20th-october-9d5eabc32fec

Credit to: pandukelana
hero member
Activity: 1358
Merit: 851
OP Updated.

Bitlum wallet is an alternative that can also be used to make LN transactions. Based on other people is experiences, Bitlum wallets charge 1 satoshi per transaction.
Never heard about Bitlum wallet. You can try with eclair wallet for Android which I am doing at the moment. By the way, no wallet charge fee for any transaction. Bitlum is a wallet which might support LN but this has no connection with charging 1 satoshi per transaction. As like BitCryptex said above, the fee will be charged by the route and it can be different depending on which Route you are using.
legendary
Activity: 1974
Merit: 1150
I think LN is a bitcoin adhesion developed by the bitcoin community that is useful for low cost micro transactions. But I have never tried to make transactions using LN. LN can also be compatible with mobile phones where the very familiar wallet is Bluewallet. But for some cases, Bluewallet needs time to synchronize node which will make some people uninterested.
Bitlum wallet is an alternative that can also be used to make LN transactions. Based on other people is experiences, Bitlum wallets charge 1 satoshi per transaction.

Indonesian:
Karena bitlum simple dan tanpa sincronisasi node buat pake LN, sebelumnya ane prnh coba bluewallet dan musti sinc node yg bikin ribet menurut ane.

Fee bitlum 1 Satoshi pertransfer bitcoin

Translate:
Because it is simple and without node synchronization for LN, I have previously tried Bluewallet and had to synchronize the nodes that made me feel bad, in my opinion.
Bitlum fee 1 Satoshi bitcoin transfer.
hero member
Activity: 2212
Merit: 805
Top Crypto Casino
Thanks for the comprehensive guide. I like the fact that it's nottoo technical. At least now, If someone asks me about Lightening Networks, I can say a thing or two about it and still make sense. During the weekend, I stumbled on a Twitter account/startup that supports Lightening Networks and I was surprised when they could send as little as 500 satoshi to winners of their mini giveaway. I must admit, I was shocked!

Lightening Networks might not bring the much needed adoption but it'll play a very vital role as it'll greatly help with the Lightening fast micro payments.
legendary
Activity: 1876
Merit: 3132
To be honest, I have tried to keep it as simple as possible so that newbies can get idea. I never thought that it could mislead users.

There were quite a lot of people complaining about the Lightning Network because the available information wasn't clear. It also took me a lot of time to learn all this stuff. By the way, why don't you try out the Lightning Network? You can download Eclair Mobile Testnet from the Play Store if you have an Android device. No risk involved.

I had tried to learn from your topic, replied earlier here and waited for a long time to get corrected by someone. But no response.

I sometimes forget about replies if I read them when I am on the go, sorry. Is there anything else you would like me to explain in a reply to that post?
hero member
Activity: 1358
Merit: 851
Your text is full of mental shortcuts which might mislead newbies (this also applies to people who have experience with crypto) if they decide to use the Lightning Network in the future.
To be honest, I have tried to keep it as simple as possible so that newbies can get idea. I never thought that it could mislead users. I had tried to learn from your topic, replied earlier here and waited for a long time to get corrected by someone. But no response.
I will update this topic if possible with more information as you have corrected.

Quote
Anyway, it's nice that you have put some effort into writing this thread. Keep it up!
Thank you. I always try to share my little knowledge with the newbies so that they can learn as well.
legendary
Activity: 1876
Merit: 3132
Your text is full of mental shortcuts which might mislead newbies (this also applies to people who have experience with crypto) if they decide to use the Lightning Network in the future.

You will be able to send, receive bitcoin with lower fees, any amount, faster than ever. It will basically help you to send & receive micro-payments.

That's false. The liquidity is a bit tricky. You are limited by the amount of coins locked up in the channel. You can't spend all the funds (reserve for closing transaction) and you can't receive more than you had initially in the channel. Not to mention that you also have to spend some of your coins in order to make space for the incoming ones.

Now, you have purchased coffee 10 times from Alice's restaurant, you will be able to pay from 0.01 BTC, this will not require any transaction fee but your Lightning Node will charge a very low fee.

Your own Lightning Network node never charges you anything. Direct payments also don't cost anything. It all depends on the nodes which route the payment. Sometimes, payments are free of charge because of other nodes' fee policy.

With Route, you may create only one channel and have able to pay in all the shops.

'May' is a keyword here. Routes can consist of many nodes which charge a different fee for routing the payment. Each node taking part in the routing process must have enough coins on their side in order to transfer the payment further. Usually, the higher the value of the transaction, the higher the chance of failure. Also, channels are still limited to about 0.16 BTC by default.


I have also written Basics of the Lightning Network which describes some information mentioned in this topic in detail. Also, the FAQ thread has a few pages of replies with many useful information!

Anyway, it's nice that you have put some effort into writing this thread. Keep it up!
hero member
Activity: 1358
Merit: 851
Introduction
Lightning Network or shortly LN is an emerging feature which can drastically change the picture of bitcoin adoption solving the problem of the higher fee for micro payments and slower confirmation issue. Although still it's not implemented in most of the wallets, we can expect it to be soon.

Table of Contents
1. What is Lightning Network?
2. How LN works?
  (i) Channel
  (ii) Route
3. A Real Life Explanation
4. Advantages of LN
5. Will it increase massive adoption?

1. What is Lightning Network?
Lightning Network is a feature which will allow you to transact bitcoin outside the Bitcoin Main Chain. It's a protocol on bitcoin blockchain. You will be able to send, receive bitcoin with lower fees, any amount(see the first reply from BitCryptex), faster than ever. It will basically help you to send & receive micro-payments.
Imagine, you have visited Alice's Coffee Shop, had a coffee for $2. Paying $2 with bitcoin is still possible but for $2, you may have to pay more fees sometimes, moreover, Alice will not agree to have confirmation of the transaction after 3/4 hours of your leaving the shop.

Two problems we see when you want to pay $2 for a coffee.
- You will not be happy to pay $1 fee for spending $2 worth of BTC.
- Alice will not accept BTC because it requires much time to get confirmed.

But, now with Lightning Network, you don't have to pay a huge fee for spending $2 worth of BTC, nor Alice will have to think about the slower transaction.

2. How LN works?
In Lightning Network, you have to create a channel with the other party. In the channel, you will be able to transact bitcoin frequently with low fee, faster and any amount.
Creating a channel means having an agreement with the other party. In other word, you and the other party will have a multisig wallet where you both will be able to transact bitcoin frequently. For your info, when you are entering into a channel, you have to pay a fee. It's same sending a transaction. After entering into the channel, whatever you transact, these log will not be updated into the blockchain. You you close the channel or leave from a channel, another transaction will be logged into the blockchain. In between entering a channel & closing a channel, all the transaction will be happened outside the bitcoin main chain and it's called settlement. Only your balance will be updated time to time but no main chain transaction will happen.

Two LN terms you must know-
(i) Channel- Channel are the place where all the Lightning Network transaction of you and your other party will be taken place and logged in. It allows you to send & receive transaction in the Lighting Network.
(ii) Route- This can be called as a bridge between you and Alice Coffee shop. Assume, you are visiting 10 shops daily and want to pay with Bitcoin Lightning Network. Creating 10 channels with 10 shops for paying them is a big hassle and costly, and imagine, how much channel shops have to create since they are handling a thousands of customers. With Route, you may create only one channel and have able to pay in all the shops.

3. A Real Life Explanation

Imagine, you visit 3 shops per week on average for purchasing your daily life stuffs; A, B, C

The shopkeeper accept Lightning Network payment. But, as like I mentioned above in Route, they certainly will not create thousands of channel. It will create more hassle for them. They will want to create channel with a Lightning Network Node where most of their customers have already created channels. This way, the Lightning Node will act as a bridge between the shopkeeper and the customer. The below picture may help you understand the process-


Bob= You
Route= Node with whom both you & the shop will create channel.

You or the other customers will create a channel with the Node, Shops will also create channel with the Node, that's how Node is creating bridge between customers and the shops.

Assume, you have created a channel and funded your address with 0.01 BTC. The initial funding will require transaction fee.
Now, you have purchased coffee 10 times from Alice's restaurant, you will be able to pay from 0.01 BTC, this will not require any transaction fee but your Lightning Node (I mean The Route/The Bridge) will charge a very low fee. Assume, each coffee is priced BTC 0.0003, you are paying 0.003 BTC.
Your balance is 0.007 (Will be low since you are paying a little fee). Now, you decided to close the channel for some reason. A transaction fee will be required.

Therefore, you are paying 2 transaction fee while you have transacted 12 times including the purchasing of coffee 10 times.

4. Advantages of LN
a. Easy Micro payments
b. Faster transaction, no confirmation needed.
c. Lower fees.

5. Will it increase massive adoption?
Till now, without Lightning Network, paying with bitcoin is very expensive sometimes when we compare paying $1/$2 for something. Also, with lower fee a transaction may stuck on the chain for a long time and get rejected after some times. Since Lightning Network is assuring instant transaction, very low fee transaction and easy micropayments, we can expect merchant will accept it more often than previous. More people will now feel comfortable paying with bitcoin for a lower amount. This is not guaranteed but a expectation since LN is reducing the resistance of bitcoin as a micro payment method.

Some more resources-
Website- https://lightning.network/
Whitepaper- https://lightning.network/lightning-network-paper.pdf
A topic by BitCryptex- https://bitcointalksearch.org/topic/the-lightning-network-faq-5158920

Miscellaneous
1. I never used Lightning Network.
2. I am not a pro.
3. This guideline will act as very basic level of explanation for the beginners.
Jump to: