Lightning network used in blockchain and its application
tranngocthinh1611
27 views
34 slides
May 19, 2024
Slide 1 of 34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
About This Presentation
Lightning network
Size: 4.65 MB
Language: en
Added: May 19, 2024
Slides: 34 pages
Slide Content
Lightning network Proposed by Joseph Pool & Thaddeus Dryja July 2022
Multisig
Timelock
Hash values and Secrets
Bidirectional Payment Channels
Open channel To open the channel, Alice and Bob each send 5 bitcoins to a 2-of-2 multisig address . Bitcoins can only be spent from this address if both Alice and Bob sign. Additionally, Alice and Bob both create a secret (a string of numbers), and exchange the hash.
Commitment transaction Alice sends 4 bitcoins to herself, and 6 bitcoins to a 2 nd -multisig address . Bob can unlock the 2 nd -multisig addr , but only after 1000 extra blocks mined. Or , it can be opened by Alice on her own, but only if she also includes the secret for which Bob has just now given her the hash. Similarly, Bob sends 6 bitcoins to himself, and 4 bitcoins to the 2 nd -multisig addr . Alice can unlock this address if she waits an additional 1000 blocks, or Bob can unlock it with Alice using her secret.
After all this exchanging of “half-valid” commitment transactions and hashes of secrets, They both sign and broadcast the opening transaction , to make sure it's recorded on the blockchain. The channel is now officially open.
Alice and Bob could sign and broadcast the half-valid commitment transaction they got from the other. If Alice does, Bob gets six bitcoins immediately. If Bob does, Alice gets four bitcoins immediately. But whomever signs and broadcasts the transaction will have to wait 1000 blocks to unlock the subsequent multisig-address, and claim the remaining bitcoins. However, and this is the key trick of a payment channel: neither sign and broadcast their half of the transaction at all .
Updating the Channel Bob wants to send Alice 1 bitcoin back (now, 5 btc for each) Similar process.. They both sign their new half valid commitment transaction, and give it to each other + exchange new secret’s hash. Alice and Bob hand each other their first secrets, as used in the first set-up.
Broadcast old commitment tx Bob cannot safely sign and broadcast the older commitment transaction any more, because Alice now knows Bob's first secret. If Bob were to sign and broadcast that commitment transaction, he would immediately send 4 bitcoins to Alice... and he would have to wait 1000 blocks to claim his own six bitcoins. That's a problem, because now that Alice knows his secret, she could use this time to beat Bob to the punch, and claim the other six bitcoins as well!
Cooperatively closing out a channel
Alice send BTC to Carol through Bob
From: Carol Bob 10BTC To: Bob 4BTC Required to unlock: To: Carol Bob 5BTC Require to unlock: or To: Carol Bob 1BTC or or Bob Sign Bob Sign Carol Sign Bob Sign Carol Sign 1st Carol Sign Bob Sign Bob Sign 1st From: Carol Bob 10BTC To: Carol 5BTC Required to unlock: To: Carol Bob 4BTC Require to unlock: or To: Carol Bob 1BTC or or Carol Sign Carol Sign Bob Sign Carol Sign Bob Sign 1st Carol Sign Bob Sign Carol Sign 1st
Settling the Status Carol send Bod (or broadcast) the secret to receive btc, Bod forwards this secret to Alice. I.e. Bod could claim his btc any time. 🡪 to terminate an HTLC off-chain requires both parties to agree on the state of the channel.
Notice about HTLC timeout If Bob gets the value from Carol only after Alice already reclaimed her coin back, Bob is stuck in the middle after all. Therefore, The time-out in Bob and Carol’s HTLC must therefore expire before the time-out in Alice and Bob’s HTLC expires.
Limitation of Lightning Network Inbound and Outbound Capacity Inbound cap: the amount of money you can receive (= remote cap) Outbound cap: the amount of money you can send
Limitation of Lightning Network
Limitation High liveness requirements Nodes are required to be online in order to send and receive payments The network is congestion 🡪 not be able to get money back fast Opening and Closing Channel Fee + Routing Fee