SlideShare a Scribd company logo
1 of 34
Download to read offline
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

More Related Content

What's hot

Introduction to Cryptocurrency (Bitcoin)
Introduction to Cryptocurrency (Bitcoin)Introduction to Cryptocurrency (Bitcoin)
Introduction to Cryptocurrency (Bitcoin)Kashif Khans
 
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 SystemFlavio Vit
 
Cryptocurrency for Dummies
Cryptocurrency for DummiesCryptocurrency for Dummies
Cryptocurrency for DummiesMiguel Duarte
 
Understanding Bitcoin
Understanding BitcoinUnderstanding Bitcoin
Understanding BitcoinLeslie Bayona
 
Crypto currencies presentation by Dr. Andre Gholam
Crypto currencies presentation by Dr. Andre GholamCrypto currencies presentation by Dr. Andre Gholam
Crypto currencies presentation by Dr. Andre GholamPMILebanonChapter
 
Bitcoin presentation slides
Bitcoin presentation slidesBitcoin presentation slides
Bitcoin presentation slidesAhmad Asad
 
Bitcoin Startup Malaysia
Bitcoin Startup MalaysiaBitcoin Startup Malaysia
Bitcoin Startup MalaysiaArsyan Ismail
 
Study on Bitcoin - Technical & Legal Aspects (Presentation at Cyber Cell Gurg...
Study on Bitcoin - Technical & Legal Aspects (Presentation at Cyber Cell Gurg...Study on Bitcoin - Technical & Legal Aspects (Presentation at Cyber Cell Gurg...
Study on Bitcoin - Technical & Legal Aspects (Presentation at Cyber Cell Gurg...Lovey Jain
 

What's hot (20)

Bitcoin
BitcoinBitcoin
Bitcoin
 
Cryptocurrency
CryptocurrencyCryptocurrency
Cryptocurrency
 
Introduction to Cryptocurrency (Bitcoin)
Introduction to Cryptocurrency (Bitcoin)Introduction to Cryptocurrency (Bitcoin)
Introduction to Cryptocurrency (Bitcoin)
 
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
 
Cryptocurrency for Dummies
Cryptocurrency for DummiesCryptocurrency for Dummies
Cryptocurrency for Dummies
 
All about Bitcoins!
All about Bitcoins!All about Bitcoins!
All about Bitcoins!
 
Cryptocurrency
CryptocurrencyCryptocurrency
Cryptocurrency
 
Understanding Bitcoin
Understanding BitcoinUnderstanding Bitcoin
Understanding Bitcoin
 
Bitcoin history
Bitcoin historyBitcoin history
Bitcoin history
 
Presentation on bitcoin
Presentation on bitcoinPresentation on bitcoin
Presentation on bitcoin
 
What's cryptocurrency ?
What's cryptocurrency ?What's cryptocurrency ?
What's cryptocurrency ?
 
Crypto currencies presentation by Dr. Andre Gholam
Crypto currencies presentation by Dr. Andre GholamCrypto currencies presentation by Dr. Andre Gholam
Crypto currencies presentation by Dr. Andre Gholam
 
Tmc mastering bitcoins ppt
Tmc mastering bitcoins pptTmc mastering bitcoins ppt
Tmc mastering bitcoins ppt
 
Bitcoin presentation slides
Bitcoin presentation slidesBitcoin presentation slides
Bitcoin presentation slides
 
Cryptocurrency
Cryptocurrency  Cryptocurrency
Cryptocurrency
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Cryptocurrency
CryptocurrencyCryptocurrency
Cryptocurrency
 
Bitcoin Startup Malaysia
Bitcoin Startup MalaysiaBitcoin Startup Malaysia
Bitcoin Startup Malaysia
 
Study on Bitcoin - Technical & Legal Aspects (Presentation at Cyber Cell Gurg...
Study on Bitcoin - Technical & Legal Aspects (Presentation at Cyber Cell Gurg...Study on Bitcoin - Technical & Legal Aspects (Presentation at Cyber Cell Gurg...
Study on Bitcoin - Technical & Legal Aspects (Presentation at Cyber Cell Gurg...
 

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

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 ZwengBlockchainHub Graz
 
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, Israeltakayaimai
 
Bitcoin - Understanding and Assessing potential Opportunities
Bitcoin - Understanding and Assessing potential OpportunitiesBitcoin - Understanding and Assessing potential Opportunities
Bitcoin - Understanding and Assessing potential OpportunitiesQuasarVentures
 
Cryptocurrency-Bitcoin
Cryptocurrency-BitcoinCryptocurrency-Bitcoin
Cryptocurrency-BitcoinSatwikaHotwani
 
The Bitcoin blockchain (en)
The Bitcoin blockchain (en)The Bitcoin blockchain (en)
The Bitcoin blockchain (en)Davide Carboni
 
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 ChainsDallas Kennedy
 
Smart contracts and applications part I
Smart contracts and applications   part ISmart contracts and applications   part I
Smart contracts and applications part Ivpnmentor
 
Bitcoin and the future of cryptocurrency
Bitcoin and the future of cryptocurrencyBitcoin and the future of cryptocurrency
Bitcoin and the future of cryptocurrencyBen Hall
 
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 MaheswaranJohn M.
 
A primer on Bitcoin Technology
A primer on Bitcoin TechnologyA primer on Bitcoin Technology
A primer on Bitcoin TechnologySebin Benjamin
 
Every thing bitcoin in baby language
Every thing bitcoin in baby languageEvery thing bitcoin in baby language
Every thing bitcoin in baby languageOssai Nduka
 
Introduction into blockchains and cryptocurrencies
Introduction into blockchains and cryptocurrenciesIntroduction into blockchains and cryptocurrencies
Introduction into blockchains and cryptocurrenciesSergey Ivliev
 
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 blockchainMarco Hauff
 
Introduction to Blockchains
Introduction to BlockchainsIntroduction to Blockchains
Introduction to BlockchainsRamesh Nair
 
Lightning Network Economics: Channels
Lightning Network Economics: ChannelsLightning Network Economics: Channels
Lightning Network Economics: Channelsguasoni
 
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 - ReportShivek Khurana
 
Bitcoin in general - presentation
Bitcoin in general - presentationBitcoin in general - presentation
Bitcoin in general - presentationMichal Cisárik
 
Blockchain 101 - public, tokenized blockchains
Blockchain 101 - public, tokenized blockchainsBlockchain 101 - public, tokenized blockchains
Blockchain 101 - public, tokenized blockchainsBrett Colbert
 

Similar to 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
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
 
Blockchain 101 - public, tokenized blockchains
Blockchain 101 - public, tokenized blockchainsBlockchain 101 - public, tokenized blockchains
Blockchain 101 - public, tokenized blockchains
 

Recently uploaded

Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 

Recently uploaded (20)

Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 

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/