Académique Documents
Professionnel Documents
Culture Documents
Joseph Poon
joseph@lightning.network
Thaddeus Dryja rx@awsomnet.org
SF Bitcoin Devs
Feb 23, 2015
http://lightning.network/
Problems
Transactions arent instant
Micropayments dont actually work
High transaction fees
Scalability Solutions
The SQL Database Model
Very scalable, very fast
Off chain transactions implemented today with
ChangeTip, Coinbase, others
Sidechains
Many blockchains with inter-chain transfers
Payment Channels
Many payments between two pre-determined parties
Scalability Solutions
The SQL Database Model
Also implemented by MTGox Redeemable Codes
Sidechains
Not primarily a scalability solution
Sending funds between chains is two transactions
Payment Channels
Only helps when people pay each other many times
(recurring billing, time-based microtransactions)
On Sidechains:
I need to be on your sidechain
In a Payment Channel:
I need to have a channel open with you
Unidirectional Channel
Alice
1 BTC
Alice Refund
Address
1 BTC
Signed by Bob
30-day nLockTime
Unidirectional Channel
Alice
Alice
1 BTC
No nLockTime
0.9 BTC
Signed by Alice
1 BTC
Bob
0.1 BTC
Alice Refund
Address
1 BTC
Signed by Bob
30-day nLockTime
Unidirectional Channel
Alice
Alice
1 BTC
No nLockTime
0.8 BTC
Signed by Alice
1 BTC
Bob
0.2 BTC
Alice
Alice Refund
Address
1 BTC
Signed by Bob
No nLockTime
0.9 BTC
Signed by Alice
30-day nLockTime
Bob
0.1 BTC
Unidirectional Channel
Alice
Alice
1 BTC
No nLockTime
1 BTC
0.8 BTC
Bob
0.2 BTC
Alice
Alice Refund
Address
1 BTC
Signed by Bob
No nLockTime
0.9 BTC
Signed by Alice
30-day nLockTime
Bob
0.1 BTC
Bidirectional Channel
Alice
1 BTC
Alice Refund
Address
1 BTC
Signed by Bob
30-day nLockTime
29-day
nLockTime
0.9 BTC
Signed by Alice
1 BTC
Bob
0.1 BTC
Alice Refund
Address
1 BTC
Signed by Bob
30-day nLockTime
29-day
nLockTime
0.8 BTC
Signed by Alice
1 BTC
Bob
0.2 BTC
Alice Refund
Address
1 BTC
Signed by Bob
29-day
nLockTime
Alice
0.9 BTC
Signed by Alice
30-day nLockTime
Bob
0.1 BTC
Reversing Direction
Alice
Alice
1 BTC
28-day
nLockTime
0.9 BTC
Signed by Bob
1 BTC
Bob
0.1 BTC
Alice Refund
Address
1 BTC
Signed by Bob
29-day
nLockTime
Alice
0.8 BTC
Signed by Alice
30-day nLockTime
Bob
0.2 BTC
Alice
1 BTC
0.9 BTC
Bob
0.1 BTC
1 BTC
28-day
nLockTime
Signed by Bob
Alice Refund
Address
1 BTC
Signed by Bob
30-day nLockTime
Alice
0.9 BTC
Bob
0.1 BTC
29-day
nLockTime
Alice
Signed by Alice
0.8 BTC
Bob
0.2 BTC
3 Party Payments
Bob
el
n
n
ing
ist
x
E
a
Ch
Ex
ist
ing
Ch
an
ne
Alice
Carol
Alice wants to pay Carol, they both have a channel open with Bob
3 Party Payments
1
0
.
0
Alice
TC
to
b
o
B
Bob
Carol
3 Party Payments
1
0
.
0
Alice
C
T
B
to
b
o
B
Bob
0.0
1
BT
to
Ca
ro
l
Carol
1
0
.
0
Alice
TC
to
b
o
B
Bob
Carol
1
0
.
0
TC
to
b
o
B
Bob
0.01 BTC to I
think Ill keep this.
Alice
Carol
Hash-Locked Contracts
Using one-way hash functions, Alice can
prove she sent funds to Carol off-chain
Pay to Contract
Knowledge of secret R hashed into hash H proves
receipt
Receiver signs a contract stating if R is disclosed
funds have been received
Hash-Locked Contracts
Bob
R
Alice
Hash
function
Carol
Hash-Locked Contracts
Bob
Alice
Carol
Hash-Locked Contracts
01
.
0
Alice
BT
to
b
o
B
&
Bob
Carol
Hash-Locked Contracts
TC
01
.
0
to
b
o
B
&
Bob
0.
01
BT
Alice
to
Ca
ro
l&
Carol
Hash-Locked Contracts
Ca
01
.
0
C
BT
to
b
o
B
&
Bob
rol
s
sig
na
H R
Alice
tur
ea
nd
Carol
Hash-Locked Contracts
at
e
ur
ign
s
s
b
o
B
Alice
H R
d
an
Ca
Bob
rol
s
sig
na
H R
tur
ea
nd
Carol
Problem!
If Carol refuses to disclose R, she will hold
up the channel between Alice and Bob
If her channel expires after Alice and Bobs she can
steal funds by redeeming the hashlock!
ime
T
k
Loc R
0-n uires
req
Bob
(Payment)
ay
nLo
ckT
ime
Alice
(Refund)
Bob
Alice
Carol
Dave
Bob
Alice
Carol
Dave
H
nL TLC
oc 3
kT -d
im ay
e
Alice
Bob
Carol
H
Alice & Bob create an HTLC output in the payment
channel to pay Bob 0.01 BTC, with a 3-day
nLockTime refund back to Alice
Dave
H
nL TLC
oc 3
kT -d
im ay
e
HTLC 2-day
nLockTime
Alice
Bob
Carol
Dave
Alice
Bob
Carol
y
da
1- me
LC kTi
HT Loc
n
H
nL TLC
oc 3
kT -d
im ay
e
HTLC 2-day
nLockTime
Dave
Carol
C
BT
Alice
Bob
01
0.
H
nL TLC
oc 3
kT -d
im ay
e
HTLC 2-day
nLockTime
Dave
Carol
H R
C
BT
Alice
Bob
01
0.
H
nL TLC
oc 3
kT -d
im ay
e
0.01 BTC
Dave
Carol
0.
01
C
BT
BT
01
0.
Alice
H R
Dave
Broken
Channel
Blockchain
Carol
C
BT
Alice
Bob
01
0.
H
nL TLC
oc 3
kT -d
im ay
e
0.01 BTC
Dave
Broken
Channel
Blockchain
0.01 BTC
Bob
Carol
0.
01
C
BT
BT
01
0.
Alice
H R
Dave
Timeout
Alice
Bob
Carol
y
da
1- me
LC kTi
HT Loc
n
H
nL TLC
oc 3
kT -d
im ay
e
HTLC 2-day
nLockTime
Dave
Timeout
H
nL TLC
oc 3
kT -d
im ay
e
HTLC 2-day
nLockTime
Alice
Bob
Carol
Dave
H
nL TLC
oc 3
kT -d
im ay
e
Timeout
Alice
Bob
Carol
Dave
Timeout
Bob
Alice
Carol
The HTLC has now timed out for all channels and
every party has updated their channel without the
HTLC.
If one party is uncooperative, that channel is
broadcast on the blockchain.
Dave
Implications
Blockchain transactions can be circuits instead of
packets
Only uncooperative channels get broadcast early on
the blockchain
Nearly all transactions occur off-chain securely with
near-zero custodial default risk
Creating new channels are infrequent
Relative OP_CHECKLOCKTIMEVERIFY
Instant Transactions, Scalable Micropayments
Blockchain Pruning
Server nodes and miners only keeping recent blocks
and UTXOs have enough storage today (2 TB,
common in current-gen desktops)