Credit pcwallart.com
Introduction to Lightning Network
Blockchain Association of Ireland
6th Dec 2017
Alan Carbery
Credit pcwallart.com
Contents
Bitcoin scalability revisited
Lightning Network introduction
How it works
Different networks and use cases
Open source projects
Conclusion & Questions
3
Blockchain under pressure
• Transaction fees high and
volatile.
• ~€15 on 12th November
• Confirmation times
unpredictable and long
• Paying for coffee on the
blockchain is no longer
possible
Credit ibtimes.co.uk
4
• 1MB blocksize.
• 10 minute average block confirmation time
• Large statistical variations in block confirmation time
• Full copy of blockchain required by each node.
• Transactions broadcast to all nodes.
• Permissionless, consensus driven.
• Global consensus required for upgrades. Evolution is slow.
Technical limitations of Bitcoin
Credit globalpmsystems.com
5
In 2025 miner rewards reduced to
3BTC per block and transaction fees
become the incentive.
Without competition between
transactions for the next block the
fees won’t be high enough to sustain
the miner network.
A secure network requires high fees.
Blockchain requires
constraints for security
6
• Time critical trades and payments are difficult
(and stressful!)
• Can’t be used for small payments. 1% fee to
send €300. 10% fee for €30.
• Cheaper and faster to transact in custodial
off-chain systems (e.g. exchanges and
wallets). Puts funds at risk.
Effects on users
7
Enter Lightning
8
Lightning in a nutshell (More later!)
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
ddca862640ed98a49b02
…
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
ddca862640ed98a49b02
…
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
ddca862640ed98a49b02
…
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
• Layer-2 protocol (ie. Operates
outside the blockchain)
• A network is made up of payment
channels. No trust needed.
• Each channel is funded by a
confirmed bitcoin transaction.
• Payments are made by agreeing
new balances through the
exchange of crypto messages
outside the blockchain.
• Payments can be routed through
the network by paying fees to
intermediaries.
9
What’s so good about Lightning Network?
• Lightning-fast Payments. Transactions complete within milliseconds. No blockchain needed to complete
a payment transaction.
• Secure. Backed by confirmed blockchain funding transactions. Enforced by smart-contracts.
• Trustless. Protocol does not require trust between parties. Everyone is incentivised to play fair and
punished for foul play. No trusted custodians required.
• Scale. Millions of transactions per second. (Visa network max is 24K txn/sec)
• Low Cost, lightweight hardware. No Proof of Work mining or specialised hardware required for
payments. Standard x86 platforms can be used. Potential for deployment on mobile phone (in theory).
• Low fees. Low risks and costs allow for low fees. Allows instant micropayments.
• Cross Blockchains. Cross-chain atomic swaps can occur off-chain instantly with heterogeneous
blockchain consensus rules. Eg. Between bitcoin and litecoin.
10
2ed98a4640ddca869b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
ddca862640ed98a49b02
…
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
2ed98a4640ddca869b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
ddca862640ed98a49b02
…
$10
Alice and Bob payment channel
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
ddca862640ed98a49b02
…
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b04
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
ddca862640ed98a49b02
…
2ed98a4640ddca869b02
…
640ddca862ed98a49b02
…
862ed98a4640ddca9b02
…
8a4640dd862ed9ca9b02
…
4640dd8628aed9ca9b02
…
69b02
49b02
a9b02
BobAlice
$5 $5
$5 $5
2ed98a4640ddca869b02
…
862ed98a4640ddca9b04
Lightning Protocol
Refund Alice: $5 after 1 week
Refund Bob: $5 immediately
Refund Bob: $5 after 1 week
Refund Alice: $5 immediately
2ed98a4640ddca869b02
…
862ed98a4640ddca9b04
Refund Alice: $4 after 1 week
Refund Bob: $6 immediately
Refund Bob: $6 after 1 week
Refund Alice: $4 immediately
Funding: $10 (both sign)
$4 $6
2ed98a4640ddca869b02
…
862ed98a4640ddca9b04
Refund Alice: $3 after 1 week
Refund Bob: $7 immediately
Refund Bob: $7 after 1 week
Refund Alice: $3 immediately
$3 $7
Pay Alice $3
Pay Bob $7
$3 $7
11
How does it work? Some key concepts …
• Unconfirmed transactions.
Transactions can be constructed and
signed but not broadcast to the
blockchain.
• Double-spend protection. Can build
many transactions but only one will
ever be confirmed.
• Bitcoin script language. Build
intelligent smart contracts.
# To you with revocation key
OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationkey))> OP_EQUAL
OP_IF
OP_CHECKSIG
OP_ELSE
<remotekey> OP_SWAP OP_SIZE 32 OP_EQUAL
OP_NOTIF
# To me via HTLC-timeout transaction (timelocked).
OP_DROP 2 OP_SWAP <localkey> 2 OP_CHECKMULTISIG
OP_ELSE
# To you with preimage.
OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
OP_CHECKSIG
OP_ENDIF
OP_ENDIF
OP_IF
# Penalty transaction
<revocationkey>
OP_ELSE
`to_self_delay`
OP_CSV
OP_DROP
<local_delayedkey>
OP_ENDIF
OP_CHECKSIG
12
How does it work? Some key concepts …
• Multi-signature addresses. Both keys
required to unlock.
• Timelocks. Some outputs (i.e. coins)
can only be spent after a time period.
• Hash values and secrets. Some
outputs are hash locked and require
the secret.
Funding: $10 (both sign)
862ed98a4640ddca9b04
Refund Bob: $5 after 1 week
Refund Alice: $5 immediately
2ed98a4640ddca869b02
…Refund Alice: $5 after 1 week
13
Bob
Alice
Carol
$10
$0
$10
$0
$9
$1
$9
$1$8
$2
$8
$2
$7
$3
$7
$3
Alice, Bob and Carol payment network
14
Different networks. Finance models. Use cases.
15
• Micro-payments, video content on demand
• Micro-payments, pay as you go mobile phones
• Payments processor (merchants and consumers)
• B2B payments
• Non-custodial exchange
• Inter-coin atomic swaps
Example Use Cases
16
A payment from Bitcoin to Litecoin
Bob
Alice
Carol
$3 worth of BTC
+ fee $3 worth of LTC
Enforced on Bitcoin blockchain Enforced on Litecoin blockchain
Bob acts as exchange
17
Lightning Network draft RFC
• Specifications draft under construction
https://github.com/lightningnetwork/lightning-rfc
• Currently under specification freeze as open source
implementations are completed.
• Main contributors are from 3 companies building
open source implementations.
18
• Lightning Labs building Lightning Network Daemon (LND)
Written in Go
https://github.com/lightningnetwork/lnd
• Blockstream building c-lightning
Written in C
https://github.com/ElementsProject/lightning
• ACINQ building Eclair
Written in Scala
https://github.com/ACINQ/eclair
The Leading Projects
19
• Bitcoin magazine article – Understanding the Lightning Network
Further reading
Credit pcwallart.com
The future?
Disruption of today’s crypto-currency eco-system
Digital businesses using bitcoin for payments
Movement of assets between coins
Credit pcwallart.com
Thank you!
Alan Carbery contact details:
acarbery@cascadenp.com
www.linkedin.com/in/alan-carbery

Introduction to Lightning Network

  • 1.
    Credit pcwallart.com Introduction toLightning Network Blockchain Association of Ireland 6th Dec 2017 Alan Carbery
  • 2.
    Credit pcwallart.com Contents Bitcoin scalabilityrevisited Lightning Network introduction How it works Different networks and use cases Open source projects Conclusion & Questions
  • 3.
    3 Blockchain under pressure •Transaction fees high and volatile. • ~€15 on 12th November • Confirmation times unpredictable and long • Paying for coffee on the blockchain is no longer possible Credit ibtimes.co.uk
  • 4.
    4 • 1MB blocksize. •10 minute average block confirmation time • Large statistical variations in block confirmation time • Full copy of blockchain required by each node. • Transactions broadcast to all nodes. • Permissionless, consensus driven. • Global consensus required for upgrades. Evolution is slow. Technical limitations of Bitcoin Credit globalpmsystems.com
  • 5.
    5 In 2025 minerrewards reduced to 3BTC per block and transaction fees become the incentive. Without competition between transactions for the next block the fees won’t be high enough to sustain the miner network. A secure network requires high fees. Blockchain requires constraints for security
  • 6.
    6 • Time criticaltrades and payments are difficult (and stressful!) • Can’t be used for small payments. 1% fee to send €300. 10% fee for €30. • Cheaper and faster to transact in custodial off-chain systems (e.g. exchanges and wallets). Puts funds at risk. Effects on users
  • 7.
  • 8.
    8 Lightning in anutshell (More later!) 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … ddca862640ed98a49b02 … 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … ddca862640ed98a49b02 … 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … ddca862640ed98a49b02 … 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … • Layer-2 protocol (ie. Operates outside the blockchain) • A network is made up of payment channels. No trust needed. • Each channel is funded by a confirmed bitcoin transaction. • Payments are made by agreeing new balances through the exchange of crypto messages outside the blockchain. • Payments can be routed through the network by paying fees to intermediaries.
  • 9.
    9 What’s so goodabout Lightning Network? • Lightning-fast Payments. Transactions complete within milliseconds. No blockchain needed to complete a payment transaction. • Secure. Backed by confirmed blockchain funding transactions. Enforced by smart-contracts. • Trustless. Protocol does not require trust between parties. Everyone is incentivised to play fair and punished for foul play. No trusted custodians required. • Scale. Millions of transactions per second. (Visa network max is 24K txn/sec) • Low Cost, lightweight hardware. No Proof of Work mining or specialised hardware required for payments. Standard x86 platforms can be used. Potential for deployment on mobile phone (in theory). • Low fees. Low risks and costs allow for low fees. Allows instant micropayments. • Cross Blockchains. Cross-chain atomic swaps can occur off-chain instantly with heterogeneous blockchain consensus rules. Eg. Between bitcoin and litecoin.
  • 10.
    10 2ed98a4640ddca869b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … ddca862640ed98a49b02 … 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … 2ed98a4640ddca869b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … ddca862640ed98a49b02 … $10 Alice and Bobpayment channel 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … ddca862640ed98a49b02 … 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b04 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … ddca862640ed98a49b02 … 2ed98a4640ddca869b02 … 640ddca862ed98a49b02 … 862ed98a4640ddca9b02 … 8a4640dd862ed9ca9b02 … 4640dd8628aed9ca9b02 … 69b02 49b02 a9b02 BobAlice $5 $5 $5 $5 2ed98a4640ddca869b02 … 862ed98a4640ddca9b04 Lightning Protocol Refund Alice: $5 after 1 week Refund Bob: $5 immediately Refund Bob: $5 after 1 week Refund Alice: $5 immediately 2ed98a4640ddca869b02 … 862ed98a4640ddca9b04 Refund Alice: $4 after 1 week Refund Bob: $6 immediately Refund Bob: $6 after 1 week Refund Alice: $4 immediately Funding: $10 (both sign) $4 $6 2ed98a4640ddca869b02 … 862ed98a4640ddca9b04 Refund Alice: $3 after 1 week Refund Bob: $7 immediately Refund Bob: $7 after 1 week Refund Alice: $3 immediately $3 $7 Pay Alice $3 Pay Bob $7 $3 $7
  • 11.
    11 How does itwork? Some key concepts … • Unconfirmed transactions. Transactions can be constructed and signed but not broadcast to the blockchain. • Double-spend protection. Can build many transactions but only one will ever be confirmed. • Bitcoin script language. Build intelligent smart contracts. # To you with revocation key OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationkey))> OP_EQUAL OP_IF OP_CHECKSIG OP_ELSE <remotekey> OP_SWAP OP_SIZE 32 OP_EQUAL OP_NOTIF # To me via HTLC-timeout transaction (timelocked). OP_DROP 2 OP_SWAP <localkey> 2 OP_CHECKMULTISIG OP_ELSE # To you with preimage. OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY OP_CHECKSIG OP_ENDIF OP_ENDIF OP_IF # Penalty transaction <revocationkey> OP_ELSE `to_self_delay` OP_CSV OP_DROP <local_delayedkey> OP_ENDIF OP_CHECKSIG
  • 12.
    12 How does itwork? Some key concepts … • Multi-signature addresses. Both keys required to unlock. • Timelocks. Some outputs (i.e. coins) can only be spent after a time period. • Hash values and secrets. Some outputs are hash locked and require the secret. Funding: $10 (both sign) 862ed98a4640ddca9b04 Refund Bob: $5 after 1 week Refund Alice: $5 immediately 2ed98a4640ddca869b02 …Refund Alice: $5 after 1 week
  • 13.
  • 14.
  • 15.
    15 • Micro-payments, videocontent on demand • Micro-payments, pay as you go mobile phones • Payments processor (merchants and consumers) • B2B payments • Non-custodial exchange • Inter-coin atomic swaps Example Use Cases
  • 16.
    16 A payment fromBitcoin to Litecoin Bob Alice Carol $3 worth of BTC + fee $3 worth of LTC Enforced on Bitcoin blockchain Enforced on Litecoin blockchain Bob acts as exchange
  • 17.
    17 Lightning Network draftRFC • Specifications draft under construction https://github.com/lightningnetwork/lightning-rfc • Currently under specification freeze as open source implementations are completed. • Main contributors are from 3 companies building open source implementations.
  • 18.
    18 • Lightning Labsbuilding Lightning Network Daemon (LND) Written in Go https://github.com/lightningnetwork/lnd • Blockstream building c-lightning Written in C https://github.com/ElementsProject/lightning • ACINQ building Eclair Written in Scala https://github.com/ACINQ/eclair The Leading Projects
  • 19.
    19 • Bitcoin magazinearticle – Understanding the Lightning Network Further reading
  • 20.
    Credit pcwallart.com The future? Disruptionof today’s crypto-currency eco-system Digital businesses using bitcoin for payments Movement of assets between coins
  • 21.
    Credit pcwallart.com Thank you! AlanCarbery contact details: acarbery@cascadenp.com www.linkedin.com/in/alan-carbery