SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
Intro. to Lightning Network
TM Lee, co-founder at
Github: @tmlee | Blockchain Developers Malaysia, Sep 6th, 2017
https://www.coingecko.com
Bitcoin Situation
Bitcoin
SegWit (Segregated Witness)
2MB Block (Later this year)
Bitcoin Cash
No SegWit
BIG Blocks
Hardfork
Scaling Debate
What is the Lightning Network (LN) ?
- Proposed by Joseph Poon & Thaddeus Dryja
(https://lightning.network/lightning-network-paper.pdf)
- Specifications for a Payment Channel on top of the bitcoin/litecoin blockchain
- Layer 2
- “Decentralized”, Trustless, High Volume, Instant Micropayment
Implementations of the LN Specs
=> Follow the BOLTs spec https://github.com/lightningnetwork/lightning-rfc
1. LND (GoLang) by Lightning
2. Eclair (Scala) by ACINQ
3. Lightning-C (C) by Blockstream
4. Thunder (Java) by Blockchain.com
Applications
1. Micropayments
○ Send satoshis with small transaction fees
2. Payment Streaming
○ Sending small amount of money frequently (ie. secondly, minutely, hourly)
○ Eg. pay per second when watching video on Youtube
3. Machine-to-Machine Payments
○ Bandwidth, data, storage, cpu times, data, can be traded
○ API endpoints usages
4. There could be more...
Bitcoin Transaction
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
MultiSig
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
CheckLockTimeVerify (CLTV)
- Specific time
- Eg. at Block N, specific date/time
Time-Lock
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
CheckSequenceVerify (CSV)
- Relative time
- N blocks from now, time from now
Typical on-chain bitcoin transaction
ALICE BOB
Transaction in a lightning network
ALICE BOB
Open
Channel TX
Payment Channel Remains Open….
microTX
10m฿
microTX
10m฿
microTX
10m฿
Close
Channel TX
1. Alice opens payment channel with
Bob
2. Bob opens payment channel with
Alice
3. Alice & Bob both stake 5 BTC each
to a multisig address
4. TX broadcast and mined into
Blockchain
5. Once the TX is confirmed, the
payment channel is now OPEN!
Open Payment Channel
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
1. Alice sends 1 BTC to Bob via payment
channel
2. Alice creates a TX
a. Input from Open TX Multisig
b. Outputs
i. 4 BTC to herself
ii. 6 BTC to a New Special
Multisig
c. Creates a key1
d. Alice signs the TX
3. Instead of broadcast, Alice hands TX
directly to Bob
4. Bob does the same, creates a TX
a. Input from Open TX Multisig
b. Outputs
i. 6 BTC to himself
ii. 4 BTC to a New Special
Multisig
c. Creates a key1
d. Bob signs the TX
5. Instead of broadcast, Bob hands TX
directly to Alice
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
1. Bob sends 1 BTC to Alice via payment
channel
2. Bob creates a new TX
a. Input from Open TX Multisig
b. Outputs
i. 5 BTC to himself
ii. 5 BTC to a New Special
Multisig
c. Creates a new key2
d. Bob signs the TX
3. Instead of broadcast, Bob hands TX
directly to Alice & key1
4. Alice does the same, creates a TX
a. Input from Open TX Multisig
b. Outputs
i. 5 BTC to herself
ii. 5 BTC to a New Special
Multisig
c. Creates a new key2
d. Alice signs the TX
5. Instead of broadcast, Alice hands TX
directly to Bob & key1
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
Microtransactions
Over Lightning...
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
Close Payment Channel (Usual Case)
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
#1 “Double Spend” Problem
tn
tn+1
Alice sends 1 BTC to Bob Bob sends 1 BTC to Alice
Bob buys
a Car from
Alice
Previous
Event
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
#1 “Double Spend” Problem
tn
tn+1
Alice sends 1 BTC to Bob Bob sends 1 BTC to Alice
Bob buys
a Car from
Alice
Previous
Event
Bob Signs
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
Time-locks
- Locks spending this UTXO to a later time
Bob Signs
Bob Signs
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
Bob Signs
Bob Signs
If Bob cheats...
Alice gets to sweep all the funds!
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
#2 Payment Network
ALICE CAROL
Open Channel...
ALICE BOB
Open Channel...
#2 Payment Network
ALICE BOB CAROL
Open Channel... Open Channel...
1. Alice wants to send 1 BTC to Carol via Bob
2. Alice pays 1 BTC to Bob, Bob pays 1 BTC
to Carol
Things that may go wrong here...
- Alice does not trust Bob or Carol
- Alice can pay Bob, Bob can choose not to
pay Carol
- Bob can pay Carol, but Carol can claim that
she did not receive the funds
#2 Payment Network Alice wants to send 1 BTC to Carol
1. Carol needs to create an Invoice consists of
a. Vrandom
& hash(Vrandom
)
b. Carol sends the hash(Vrandom
) to Alice
Alice tells Carol to receive 1 BTC from
Bob
2. Alice tells Bob that she will pay him 1 BTC if
he can produce hash(Vrandom
), Bob needs
Vrandom
3. Bob gives 1 BTC to Carol
Carol gives the Vrandom
to Bob
4. Bob gives the Vrandom
to Alice as a proof
Alice gives 1 BTC to Bob
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-creating-the-network-1465326903/
- Decentralized, Instant, Off-chain transfer of Bitcoin without Trust
- 1 On-Chain TX to Open Channel, 1 On-Chain TX to Close Channel
- Bitcoin can be transferred between parties, without broadcasting to network
- New TX replaces Old TX locally within the parties, as long as Channel is
Open
To Summarize...
ALICE BOB CAROL
Open Channel (on-chain)
Close Channel (on-chain)
Open Channel (on-chain)
Close Channel (on-chain)
Transfer Funds (off-chain) Transfer Funds (off-chain)
Things you can do as a developer
1. Spin up a Lightning Network node
2. Full node to watch blockchain for Lightning users
3. Build hardware/apps that transacts off-chain
4. Implement authentication & paywall using Lightning
5. Contribute to the Lightning implementations
○ Ie. LND, Eclair, Lightning-C, Thunder
6. List of resources https://github.com/tmlee/awesome-lightning-network
To Summarize...
➔ Is Lightning a new coin?
◆ No, LN is a play on the way transaction works; uses the bitcoin or litecoin blockchain
➔ Custodian Risk? Trust 3rd Party?
◆ No, LN is designed to not require that; using MultiSig & Hash Time Lock Contracts
➔ Will Lightning lock up my fund?
◆ Yes, you will not be able spend the fund on-chain while the channel is open
◆ No, you will be able to participate in the LN network and send zero confirmation tx
➔ Will there be a block explorer for Lightning?
◆ No, all tx records are stored locally between the 2 parties
◆ Blockchain only records the transaction to Open and Close a channel
➔ Is there mining required?
◆ No, LN transactions are instant
◆ When open/closing the channel, needs to be mined. In this case by bitcoin/litecoin miners
➔ Who collects the fees in the LN?
◆ Middlemen facilitating LN tx between parties
Appendix
Hash Time-Lock Contract
1. Bob generates Vrandom
and produces
2. Bob creates and signs a TX
a. Input
i. MultiSig
b. Outputs
i. 5 BTC to Bob (himself)
ii. 4 BTC to New Multisig
iii. 1 BTC to HTLC Multisig
3. Bob hands the TX to Alice
4. Alice creates and signs a TX
a. Input
i. MultiSig
b. Outputs
i. 4 BTC to Alice (herself)
ii. 5 BTC to New Multisig
iii. 1 BTC to HTLC Multisig
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-completing-the-puzzle-and-closing-the-channel-1466178980/
Time-locks
- Allows locking of spending UTXO to a later
point in time
- CheckLockTimeVerify (CLTV)
- Specific time
- At Block N, On Date
Hash Time-Lock Contract
Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-completing-the-puzzle-and-closing-the-channel-1466178980/
Source: https://lightning.network/lightning-network.pdf
Source: https://lightning.network/lightning-network.pdf
Source: https://lightning.network/lightning-network.pdf
Source: https://lightning.network/lightning-network.pdf
Source: https://lightning.network/lightning-network.pdf

Más contenido relacionado

La actualidad más candente

How NFT Works
How NFT WorksHow NFT Works
How NFT Works
101 Blockchains
 
Seminar Report On Bitcoin
Seminar Report On BitcoinSeminar Report On Bitcoin
Seminar Report On Bitcoin
Touroxy
 

La actualidad más candente (20)

Introduction Bitcoin
Introduction BitcoinIntroduction Bitcoin
Introduction Bitcoin
 
Introduction to Lightning Network
Introduction to Lightning NetworkIntroduction to Lightning Network
Introduction to Lightning Network
 
Crypto & Crpyocurrencies Intro
Crypto & Crpyocurrencies IntroCrypto & Crpyocurrencies Intro
Crypto & Crpyocurrencies Intro
 
Bitcoin Final Year Seminar Report
Bitcoin Final Year Seminar ReportBitcoin Final Year Seminar Report
Bitcoin Final Year Seminar Report
 
Litecoin Crypto Currency Bootcamp
Litecoin Crypto Currency BootcampLitecoin Crypto Currency Bootcamp
Litecoin Crypto Currency Bootcamp
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
The DAO attack - Ethereum
The DAO attack - EthereumThe DAO attack - Ethereum
The DAO attack - Ethereum
 
An Investor's Guide to Web3 / Crypto / Blockchain
An Investor's Guide to Web3 / Crypto / BlockchainAn Investor's Guide to Web3 / Crypto / Blockchain
An Investor's Guide to Web3 / Crypto / Blockchain
 
How NFT Works
How NFT WorksHow NFT Works
How NFT Works
 
Ethereum in a nutshell
Ethereum in a nutshellEthereum in a nutshell
Ethereum in a nutshell
 
Introduction to Blockchain
Introduction to Blockchain Introduction to Blockchain
Introduction to Blockchain
 
Blockchain
BlockchainBlockchain
Blockchain
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Blockchain
BlockchainBlockchain
Blockchain
 
Seminar Report On Bitcoin
Seminar Report On BitcoinSeminar Report On Bitcoin
Seminar Report On Bitcoin
 
Blockchain concepts
Blockchain conceptsBlockchain concepts
Blockchain concepts
 
Blockchain
BlockchainBlockchain
Blockchain
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Cryptocurrency for Dummies
Cryptocurrency for DummiesCryptocurrency for Dummies
Cryptocurrency for Dummies
 

Similar a Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers Malaysia

Similar a Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers Malaysia (20)

BlockchainHub Graz Meetup #22 - Atomic Swaps - Johannes Zweng
BlockchainHub Graz Meetup #22 - Atomic Swaps - Johannes ZwengBlockchainHub Graz Meetup #22 - Atomic Swaps - Johannes Zweng
BlockchainHub Graz Meetup #22 - Atomic Swaps - Johannes Zweng
 
Technology of Lightning Network in Tel Aviv, Israel
Technology of Lightning Network in Tel Aviv, IsraelTechnology of Lightning Network in Tel Aviv, Israel
Technology of Lightning Network in Tel Aviv, Israel
 
Bitcoin - Understanding and Assessing potential Opportunities
Bitcoin - Understanding and Assessing potential OpportunitiesBitcoin - Understanding and Assessing potential Opportunities
Bitcoin - Understanding and Assessing potential Opportunities
 
Cryptocurrency-Bitcoin
Cryptocurrency-BitcoinCryptocurrency-Bitcoin
Cryptocurrency-Bitcoin
 
The Bitcoin blockchain (en)
The Bitcoin blockchain (en)The Bitcoin blockchain (en)
The Bitcoin blockchain (en)
 
Bitcoin and the Rise of the Block Chains
Bitcoin and the Rise of the Block ChainsBitcoin and the Rise of the Block Chains
Bitcoin and the Rise of the Block Chains
 
Smart contracts and applications part I
Smart contracts and applications   part ISmart contracts and applications   part I
Smart contracts and applications part I
 
Study on Bitcoin
Study on Bitcoin Study on Bitcoin
Study on Bitcoin
 
Bitcoin and the future of cryptocurrency
Bitcoin and the future of cryptocurrencyBitcoin and the future of cryptocurrency
Bitcoin and the future of cryptocurrency
 
Blockchain for Business Yale School of Management Dr John Maheswaran
Blockchain for Business Yale School of Management Dr John MaheswaranBlockchain for Business Yale School of Management Dr John Maheswaran
Blockchain for Business Yale School of Management Dr John Maheswaran
 
A primer on Bitcoin Technology
A primer on Bitcoin TechnologyA primer on Bitcoin Technology
A primer on Bitcoin Technology
 
Every thing bitcoin in baby language
Every thing bitcoin in baby languageEvery thing bitcoin in baby language
Every thing bitcoin in baby language
 
Introduction into blockchains and cryptocurrencies
Introduction into blockchains and cryptocurrenciesIntroduction into blockchains and cryptocurrencies
Introduction into blockchains and cryptocurrencies
 
All you ever needed to know on bitcoin and blockchain
All you ever needed to know on bitcoin and blockchainAll you ever needed to know on bitcoin and blockchain
All you ever needed to know on bitcoin and blockchain
 
Bitcoin A Peer-to-Peer Electronic Cash System
Bitcoin A Peer-to-Peer Electronic Cash SystemBitcoin A Peer-to-Peer Electronic Cash System
Bitcoin A Peer-to-Peer Electronic Cash System
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Introduction to Blockchains
Introduction to BlockchainsIntroduction to Blockchains
Introduction to Blockchains
 
Lightning Network Economics: Channels
Lightning Network Economics: ChannelsLightning Network Economics: Channels
Lightning Network Economics: Channels
 
Bitcoin : A fierce decentralized crypto currency - Report
Bitcoin : A fierce decentralized crypto currency - ReportBitcoin : A fierce decentralized crypto currency - Report
Bitcoin : A fierce decentralized crypto currency - Report
 
Bitcoin in general - presentation
Bitcoin in general - presentationBitcoin in general - presentation
Bitcoin in general - presentation
 

Último

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Último (20)

Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 

Intro. to Lightning Network (Bitcoin/Litecoin) - Blockchain Developers Malaysia

  • 1. Intro. to Lightning Network TM Lee, co-founder at Github: @tmlee | Blockchain Developers Malaysia, Sep 6th, 2017
  • 3. Bitcoin Situation Bitcoin SegWit (Segregated Witness) 2MB Block (Later this year) Bitcoin Cash No SegWit BIG Blocks Hardfork Scaling Debate
  • 4. What is the Lightning Network (LN) ? - Proposed by Joseph Poon & Thaddeus Dryja (https://lightning.network/lightning-network-paper.pdf) - Specifications for a Payment Channel on top of the bitcoin/litecoin blockchain - Layer 2 - “Decentralized”, Trustless, High Volume, Instant Micropayment
  • 5. Implementations of the LN Specs => Follow the BOLTs spec https://github.com/lightningnetwork/lightning-rfc 1. LND (GoLang) by Lightning 2. Eclair (Scala) by ACINQ 3. Lightning-C (C) by Blockstream 4. Thunder (Java) by Blockchain.com
  • 6. Applications 1. Micropayments ○ Send satoshis with small transaction fees 2. Payment Streaming ○ Sending small amount of money frequently (ie. secondly, minutely, hourly) ○ Eg. pay per second when watching video on Youtube 3. Machine-to-Machine Payments ○ Bandwidth, data, storage, cpu times, data, can be traded ○ API endpoints usages 4. There could be more...
  • 9. CheckLockTimeVerify (CLTV) - Specific time - Eg. at Block N, specific date/time Time-Lock Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/ CheckSequenceVerify (CSV) - Relative time - N blocks from now, time from now
  • 10. Typical on-chain bitcoin transaction ALICE BOB
  • 11. Transaction in a lightning network ALICE BOB Open Channel TX Payment Channel Remains Open…. microTX 10m฿ microTX 10m฿ microTX 10m฿ Close Channel TX
  • 12. 1. Alice opens payment channel with Bob 2. Bob opens payment channel with Alice 3. Alice & Bob both stake 5 BTC each to a multisig address 4. TX broadcast and mined into Blockchain 5. Once the TX is confirmed, the payment channel is now OPEN! Open Payment Channel Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
  • 13. 1. Alice sends 1 BTC to Bob via payment channel 2. Alice creates a TX a. Input from Open TX Multisig b. Outputs i. 4 BTC to herself ii. 6 BTC to a New Special Multisig c. Creates a key1 d. Alice signs the TX 3. Instead of broadcast, Alice hands TX directly to Bob 4. Bob does the same, creates a TX a. Input from Open TX Multisig b. Outputs i. 6 BTC to himself ii. 4 BTC to a New Special Multisig c. Creates a key1 d. Bob signs the TX 5. Instead of broadcast, Bob hands TX directly to Alice Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
  • 14. 1. Bob sends 1 BTC to Alice via payment channel 2. Bob creates a new TX a. Input from Open TX Multisig b. Outputs i. 5 BTC to himself ii. 5 BTC to a New Special Multisig c. Creates a new key2 d. Bob signs the TX 3. Instead of broadcast, Bob hands TX directly to Alice & key1 4. Alice does the same, creates a TX a. Input from Open TX Multisig b. Outputs i. 5 BTC to herself ii. 5 BTC to a New Special Multisig c. Creates a new key2 d. Alice signs the TX 5. Instead of broadcast, Alice hands TX directly to Bob & key1 Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
  • 16. Close Payment Channel (Usual Case) Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
  • 17. #1 “Double Spend” Problem tn tn+1 Alice sends 1 BTC to Bob Bob sends 1 BTC to Alice Bob buys a Car from Alice Previous Event Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
  • 18. #1 “Double Spend” Problem tn tn+1 Alice sends 1 BTC to Bob Bob sends 1 BTC to Alice Bob buys a Car from Alice Previous Event Bob Signs Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
  • 19. Time-locks - Locks spending this UTXO to a later time Bob Signs Bob Signs Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
  • 20. Bob Signs Bob Signs If Bob cheats... Alice gets to sweep all the funds! Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-building-a-bidirectional-payment-channel-1464710791/
  • 21. #2 Payment Network ALICE CAROL Open Channel... ALICE BOB Open Channel...
  • 22. #2 Payment Network ALICE BOB CAROL Open Channel... Open Channel... 1. Alice wants to send 1 BTC to Carol via Bob 2. Alice pays 1 BTC to Bob, Bob pays 1 BTC to Carol Things that may go wrong here... - Alice does not trust Bob or Carol - Alice can pay Bob, Bob can choose not to pay Carol - Bob can pay Carol, but Carol can claim that she did not receive the funds
  • 23. #2 Payment Network Alice wants to send 1 BTC to Carol 1. Carol needs to create an Invoice consists of a. Vrandom & hash(Vrandom ) b. Carol sends the hash(Vrandom ) to Alice Alice tells Carol to receive 1 BTC from Bob 2. Alice tells Bob that she will pay him 1 BTC if he can produce hash(Vrandom ), Bob needs Vrandom 3. Bob gives 1 BTC to Carol Carol gives the Vrandom to Bob 4. Bob gives the Vrandom to Alice as a proof Alice gives 1 BTC to Bob Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-creating-the-network-1465326903/
  • 24. - Decentralized, Instant, Off-chain transfer of Bitcoin without Trust - 1 On-Chain TX to Open Channel, 1 On-Chain TX to Close Channel - Bitcoin can be transferred between parties, without broadcasting to network - New TX replaces Old TX locally within the parties, as long as Channel is Open To Summarize... ALICE BOB CAROL Open Channel (on-chain) Close Channel (on-chain) Open Channel (on-chain) Close Channel (on-chain) Transfer Funds (off-chain) Transfer Funds (off-chain)
  • 25. Things you can do as a developer 1. Spin up a Lightning Network node 2. Full node to watch blockchain for Lightning users 3. Build hardware/apps that transacts off-chain 4. Implement authentication & paywall using Lightning 5. Contribute to the Lightning implementations ○ Ie. LND, Eclair, Lightning-C, Thunder 6. List of resources https://github.com/tmlee/awesome-lightning-network
  • 26. To Summarize... ➔ Is Lightning a new coin? ◆ No, LN is a play on the way transaction works; uses the bitcoin or litecoin blockchain ➔ Custodian Risk? Trust 3rd Party? ◆ No, LN is designed to not require that; using MultiSig & Hash Time Lock Contracts ➔ Will Lightning lock up my fund? ◆ Yes, you will not be able spend the fund on-chain while the channel is open ◆ No, you will be able to participate in the LN network and send zero confirmation tx ➔ Will there be a block explorer for Lightning? ◆ No, all tx records are stored locally between the 2 parties ◆ Blockchain only records the transaction to Open and Close a channel ➔ Is there mining required? ◆ No, LN transactions are instant ◆ When open/closing the channel, needs to be mined. In this case by bitcoin/litecoin miners ➔ Who collects the fees in the LN? ◆ Middlemen facilitating LN tx between parties
  • 28. Hash Time-Lock Contract 1. Bob generates Vrandom and produces 2. Bob creates and signs a TX a. Input i. MultiSig b. Outputs i. 5 BTC to Bob (himself) ii. 4 BTC to New Multisig iii. 1 BTC to HTLC Multisig 3. Bob hands the TX to Alice 4. Alice creates and signs a TX a. Input i. MultiSig b. Outputs i. 4 BTC to Alice (herself) ii. 5 BTC to New Multisig iii. 1 BTC to HTLC Multisig Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-completing-the-puzzle-and-closing-the-channel-1466178980/
  • 29. Time-locks - Allows locking of spending UTXO to a later point in time - CheckLockTimeVerify (CLTV) - Specific time - At Block N, On Date Hash Time-Lock Contract Source: https://bitcoinmagazine.com/articles/understanding-the-lightning-network-part-completing-the-puzzle-and-closing-the-channel-1466178980/