-
Notifications
You must be signed in to change notification settings - Fork 51
/
paper.tex
2034 lines (1739 loc) · 108 KB
/
paper.tex
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[letterpaper,11pt]{article}
\usepackage{graphicx}
%\usepackage{fullpage}
\usepackage{pdfpages}
\usepackage{color}
\usepackage[colorlinks=true,urlcolor=blue,citecolor=black]{hyperref}
\usepackage{url}
\usepackage[font=footnotesize,labelfont=bf]{caption}
%full name for appendix
\usepackage[title]{appendix}
\usepackage{float}
%\usepackage{parskip}
%for code
\usepackage{listings}
%for math
\usepackage{amsmath}
\linespread{1.1}
\setlength{\parindent}{30pt}
\setlength{\emergencystretch}{3em}
%opening
\title{\LARGE The Bitcoin Lightning Network:\\
\Large Scalable Off-Chain Instant Payments}
\author{
Joseph Poon\\
\small\href{mailto:[email protected]}
{\nolinkurl{[email protected]}}
\and
Thaddeus Dryja\\
\small\href{mailto:[email protected]}
{\nolinkurl{[email protected]}}
}
\date{\today\\\small DRAFT Version 0.5.9.2}
\begin{document}
\maketitle
\begin{abstract}
The bitcoin protocol can encompass the global financial transaction volume in
all electronic payment systems today, without a single custodial third party
holding funds or requiring participants to have anything more than a computer
using a broadband connection. A decentralized system is proposed whereby
transactions are sent over a network of micropayment channels (a.k.a. payment
channels or transaction channels) whose transfer of value occurs
off-blockchain. If Bitcoin transactions can be signed with a new sighash type
that addresses malleability, these transfers may occur between untrusted
parties along the transfer route by contracts which, in the event of
uncooperative or hostile participants, are enforceable via broadcast over the
bitcoin blockchain in the event of uncooperative or hostile participants,
through a series of decrementing timelocks.
\end{abstract}
\section{The Bitcoin Blockchain Scalability Problem}
The Bitcoin\cite{nakamoto} blockchain holds great promise for distributed
ledgers, but the blockchain as a payment platform, by itself, cannot cover the
world's commerce anytime in the near future. The blockchain is a gossip
protocol whereby all state modifications to the ledger are broadcast to all
participants. It is through this ``gossip protocol'' that consensus of the
state, everyone's balances, is agreed upon. If each node in the bitcoin network
must know about every single transaction that occurs globally, that may create
a significant drag on the ability of the network to encompass all global
financial transactions. It would instead be desirable to encompass all
transactions in a way that doesn't sacrifice the decentralization and security
that the network provides.
The payment network Visa achieved 47,000 peak transactions per second (tps) on
its network during the 2013 holidays\cite{visa}, and currently averages hundreds
of millions per day. Currently, Bitcoin supports less than 7 transactions per
second with a 1 megabyte block limit. If we use an average of 300 bytes per
bitcoin transaction and assumed unlimited block sizes, an equivalent capacity to
peak Visa transaction volume of 47,000/tps would be nearly 8 gigabytes per
Bitcoin block, every ten minutes on average. Continuously, that would be over
400 terabytes of data per year.
Clearly, achieving Visa-like capacity on the Bitcoin network isn't feasible
today. No home computer in the world can operate with that kind of bandwidth and
storage. If Bitcoin is to replace all electronic payments in the future, and not
just Visa, it would result in outright collapse of the Bitcoin network, or at
best, extreme centralization of Bitcoin nodes and miners to the only ones who
could afford it. This centralization would then defeat aspects of network
decentralization that make Bitcoin secure, as the ability for entities to
validate the chain is what allows Bitcoin to ensure ledger accuracy and
security.
Having fewer validators due to larger blocks not only implies fewer individuals
ensuring ledger accuracy, but also results in fewer entities that would be able
to validate the blockchain as part of the mining process, which results in
encouraging miner centralization. Extremely large blocks, for example in the
above case of 8 gigabytes every 10 minutes on average, would imply that only a
few parties would be able to do block validation. This creates a great
possibility that entities will end up trusting centralized parties. Having
privileged, trusted parties creates a social trap whereby the central party will
not act in the interest of an individual (principal-agent problem), e.g.
rentierism by charging higher fees to mitigate the incentive to act dishonestly.
In extreme cases, this manifests as individuals sending funds to centralized
trusted custodians who have full custody of customers' funds. Such arrangements,
as are common today, create severe counterparty risk. A prerequisite to prevent
that kind of centralization from occurring would require the ability for bitcoin
to be validated by a single consumer-level computer on a home broadband
connection. By ensuring that full validation can occur cheaply, Bitcoin nodes
and miners will be able to prevent extreme centralization and trust, which
ensures extremely low transaction fees.
While it is possible that Moore's Law will continue indefinitely, and the
computational capacity for nodes to cost-effectively compute multi-gigabyte
blocks may exist in the future, it is not a certainty.
To achieve much higher than 47,000 transactions per second using Bitcoin
requires conducting transactions off the Bitcoin blockchain itself. It would be
even better if the bitcoin network supported a near-unlimited number of
transactions per second with extremely low fees for micropayments. Many
micropayments can be sent sequentially between two parties to enable any size
of payments. Micropayments would enable unbundling, less trust and
commodification of services, such as payments for per-megabyte internet
service. To be able to achieve these micropayment use cases, however, would
require severely reducing the amount of transactions that end up being
broadcast on the global Bitcoin blockchain.
While it is possible to scale at a small level, it is absolutely not possible to
handle a large amount of micropayments on the network or to encompass all
global transactions. For bitcoin to succeed, it requires confidence that if it
were to become extremely popular, its current advantages stemming from
decentralization will continue to exist. In order for people today to believe
that Bitcoin will work tomorrow, Bitcoin needs to resolve the issue of block
size centralization effects; large blocks implicitly create trusted custodians
and significantly higher fees.
\section{A Network of Micropayment Channels Can Solve Scalability}
\begin{quote}
``If a tree falls in the forest and no one is around to hear it, does
it make a sound?''
\end{quote}
The above quote questions the relevance of unobserved events \textemdash if
nobody hears the tree fall, whether it made a sound or not is of no
consequence. Similarly, in the blockchain, if only two participants care about
an everyday recurring transaction, it's not necessary for all other nodes in
the bitcoin network to know about that transaction. It is instead preferable to
only have the bare minimum of information on the blockchain. By deferring
telling the entire world about every transaction, doing net settlement of their
relationship at a later date enables Bitcoin users to conduct many transactions
without bloating up the blockchain or creating trust in a centralized
counterparty. An effectively trustless structure can be achieved by using time
locks as a component to global consensus.
Currently the solution to micropayments and scalability is to offload the
transactions to a custodian, whereby one is trusting third party custodians to
hold one's coins and to update balances with other parties. Trusting third
parties to hold all of one's funds creates counterparty risk and transaction
costs.
Instead, using a network of these micropayment channels, Bitcoin can scale to
billions of transactions per day with the computational power available on a
modern desktop computer today. Sending many payments inside a given
micropayment channel enables one to send large amounts of funds to another
party in a decentralized manner. These channels are not a separate trusted
network on top of bitcoin. They are real bitcoin transactions.
Micropayment channels\cite{wikicontracts}\cite{bitcoinjmicropay} create a
relationship between two parties to perpetually update balances, deferring what
is broadcast to the blockchain in a single transaction netting out the total
balance between those two parties. This permits the financial relationships
between two parties to be trustlessly deferred to a later date, without risk of
counterparty default. Micropayment channels use real bitcoin transactions, only
electing to defer the broadcast to the blockchain in such a way that both
parties can guarantee their current balance on the blockchain; this is not a
trusted overlay network \textemdash payments in micropayment channels are real
bitcoin communicated and exchanged off-chain.
\subsection{Micropayment Channels Do Not Require Trust}
Like the age-old question of whether the tree falling in the woods makes a
sound, if all parties agree that the tree fell at 2:45 in the afternoon, then
the tree really did fall at 2:45 in the afternoon. Similarly, if both
counterparties agree that the current balance inside a channel is 0.07 BTC to
Alice and 0.03 BTC to Bob, then that's the true balance. However, without
cryptography, an interesting problem is created: If one's counterparty
disagrees about the current balance of funds (or time the tree fell), then it
is one's word against another. Without cryptographic signatures, the blockchain
will not know who owns what.
If the balance in the channel is 0.05 BTC to Alice and 0.05 BTC to Bob, and the
balance after a transaction is 0.07 BTC to Alice and 0.03 BTC to Bob, the
network needs to know which set of balances is correct. Blockchain transactions
solve this problem by using the blockchain ledger as a timestamping system. At
the same time, it is desirable to create a system which does not actively use
this timestamping system unless absolutely necessary, as it can become costly to
the network.
Instead, both parties can commit to signing a transaction and not broadcasting
this transaction. So if Alice and Bob commit funds into a 2-of-2 multisignature
address (where it requires consent from both parties to create spends), they
can agree on the current balance state. Alice and Bob can agree to create a
refund from that 2-of-2 transaction to themselves, 0.05 BTC to each. This
refund is \textit{not} broadcast on the blockchain. Either party may do so, but
they may elect to instead hold onto that transaction, knowing that they are
able to redeem funds whenever they feel comfortable doing so. By deferring
broadcast of this transaction, they may elect to change this balance at a
future date.
To update the balance, both parties create a new spend from the 2-of-2
multisignature address, for example 0.07 to Alice and 0.03 to Bob. Without
proper design, though, there is the timestamping problem of not knowing which
spend is correct: the new spend or the original refund.
The restriction on timestamping and dates, however, is not as complex as full
ordering of all transactions as in the bitcoin blockchain. In the case of
micropayment channels, only two states are required: the current correct
balance, and any old deprecated balances. There would only be a single correct
current balance, and possibly many old balances which are deprecated.
Therefore, it is possible in bitcoin to devise a bitcoin script whereby all old
transactions are invalidated, and only the new transaction is valid.
Invalidation is enforced by a bitcoin output script and dependent transactions
which force the other party to give all their funds to the channel
counterparty. By taking all funds as a penalty to give to the other, all old
transactions are thereby invalidated.
This invalidation process can exist through a process of channel consensus
where if both parties agree on current ledger states (and building new states),
then the real balance gets updated. The balance is reflected on the blockchain
only when a single party disagrees. Conceptually, this system is not an
independent overlay network; it is more a deferral of state on the current
system, as the enforcement is still occurring on the blockchain itself (albeit
deferred to future dates and transactions).
\subsection{A Network of Channels}
Thus, micropayment channels only create a relationship between two parties.
Requiring everyone to create channels with everyone else does not solve the
scalability problem. Bitcoin scalability can be achieved using a large network
of micropayment channels.
If we presume a large network of channels on the Bitcoin blockchain, and all
Bitcoin users are participating on this graph by having at least one channel
open on the Bitcoin blockchain, it is possible to create a near-infinite amount
of transactions inside this network. The only transactions that are broadcasted
on the Bitcoin blockchain prematurely are with uncooperative channel
counterparties.
%TODO: define hashlock and timelock
By encumbering the Bitcoin transaction outputs with a hashlock and timelock,
the channel counterparty will be unable to outright steal funds and Bitcoins
can be exchanged without outright counterparty theft. Further, by using
staggered timeouts, it's possible to send funds via multiple intermediaries in a
network without the risk of intermediary theft of funds.
\section{Bidirectional Payment Channels}
Micropayment channels permit a simple deferral of a transaction state to be
broadcast at a later time. The contracts are enforced by creating a
responsibility for one party to broadcast transactions before or after certain
dates. If the blockchain is a decentralized timestamping system, it is possible
to use clocks as a component of decentralized consensus\cite{lamportpaxos} to
determine data validity, as well as present states as a method to order
events\cite{lamportclocks}.
By creating timeframes where certain states can be broadcast and later
invalidated, it is possible to create complex contracts using bitcoin
transaction scripts. There has been prior work for Hub-and-Spoke Micropayment
Channels\cite{akselrod}\cite{akselrod2}\cite{todd} (and trusted payment channel
networks\cite{amikopay}\cite{impulse}) looking at building a hub-and-spoke
network today. However, Lightning Network's bidirectional micropayment channel
requires the malleability soft-fork described in Appendix A to enable
near-infinite scalability while mitigating risks of intermediate node default.
By chaining together multiple micropayment channels, it is possible to create a
network of transaction paths. Paths can be routed using a BGP-like system, and
the sender may designate a particular path to the recipient. The output scripts
are encumbered by a hash, which is generated by the recipient. By disclosing
the input to that hash, the recipient's counterparty will be able to pull funds
along the route.
\subsection{The Problem of Blame in Channel Creation}
In order to participate in this payment network, one must create a micropayment
channel with another participant on this network.
\subsubsection{Creating an Unsigned Funding Transaction}
An initial channel Funding Transaction is created whereby one or both channel
counterparties fund the inputs of this transaction. Both parties create the
inputs and outputs for this transaction but do not sign the transaction.
The output for this Funding Transaction is a single 2-of-2 multisignature script
with both participants in this channel, henceforth named Alice and Bob. Both
participants do not exchange signatures for the Funding Transaction until they
have created spends from this 2-of-2 output refunding the original amount back
to its respective funders. The purpose of not signing the transaction allows for
one to spend from a transaction which does not yet exist. If Alice and Bob
exchange the signatures from the Funding Transaction without being able to
broadcast spends from the Funding Transaction, the funds may be locked up
forever if Alice and Bob do not cooperate (or other coin loss may occur through
hostage scenarios whereby one pays for the cooperation from the counterparty).
Alice and Bob both exchange inputs to fund the Funding Transaction (to know
which inputs are used to determine the total value of the channel), and exchange
one key to use to sign with later. This key is used for the 2-of-2 output for
the Funding Transaction; both signatures are needed to spend from the Funding
Transaction, in other words, both Alice and Bob need to agree to spend from the
Funding Transaction.
\subsubsection{Spending from an Unsigned Transaction}
The Lightning Network uses a SIGHASH\_NOINPUT transaction to spend from this
2-of-2 Funding Transaction output, as it is necessary to spend from a
transaction for which the signatures are not yet exchanged. SIGHASH\_NOINPUT,
implemented using a soft-fork, ensures transactions can be spent from before it
is signed by all parties, as transactions would need to be signed to get a
transaction ID without new sighash flags. Without SIGHASH\_NOINPUT, Bitcoin
transactions cannot be spent from before they may be broadcast \textemdash it's
as if one could not draft a contract without paying the other party first.
SIGHASH\_NOINPUT resolves this problem. See Appendix A for more information and
implementation.
Without SIGHASH\_NOINPUT, it is not possible to generate a spend from a
transaction without exchanging signatures, since spending the Funding
Transaction requires a transaction ID as part of the signature in the child's
input. A component of the Transaction ID is the parent's (Funding Transaction's)
signature, so both parties need to exchange their signatures of the parent
transaction before the child can be spent. Since one or both parties must know
the parent's signatures to spend from it, that means one or both parties are
able to broadcast the parent (Funding Transaction) before the child even exists.
SIGHASH\_NOINPUT gets around this by permitting the child to spend without
signing the input. With SIGHASH\_NOINPUT, the order of operations are to:
\begin{enumerate}
\item Create the parent (Funding Transaction)
\item Create the children (Commitment Transactions and all spends from
the commitment transactions)
\item Sign the children
\item Exchange the signatures for the children
\item Sign the parent
\item Exchange the signatures for the parent
\item Broadcast the parent on the blockchain
\end{enumerate}
One is not able to broadcast the parent (Step 7) until Step 6 is complete. Both
parties have not given their signature to spend from the Funding Transaction
until step 6. Further, if one party fails during Step 6, the parent can
either be spent to become the parent transaction or the inputs to the parent
transaction can be double-spent (so that this entire transaction path is
invalidated).
\subsubsection{Commitment Transactions: Unenforcible Construction}
After the unsigned (and unbroadcasted) Funding Transaction has been created,
both parties sign and exchange an initial Commitment Transaction. These
Commitment Transactions spends from the 2-of-2 output of the Funding
Transaction (parent). However, only the Funding Transaction is broadcast on the
blockchain.
Since the Funding Transaction has already entered into the blockchain, and the
output is a 2-of-2 multisignature transaction which requires the agreement of
both parties to spend from, Commitment Transactions are used to express the
present balance. If only one 2-of-2 signed Commitment Transaction is exchanged
between both parties, then both parties will be sure that they are able to get
their money back after the Funding Transaction enters the blockchain. Both
parties do not broadcast the Commitment Transactions onto the blockchain until
they want to close out the current balance in the channel. They do so by
broadcasting the present Commitment Transaction.
Commitment Transactions pay out the respective current balances to each party.
A naive (broken) implementation would construct an unbroadcasted transaction
whereby there is a 2-of-2 spend from a single transaction which have two
outputs that return all current balances to both channel counterparties. This
will return all funds to the original party when creating an initial Commitment
Transaction.
%Diagram - Broken funding transaction
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1\linewidth]{figures/funding-broken1.pdf}
}
\caption{A naive broken funding transaction is described in this
diagram. The Funding Transaction (F), designated in green, is
broadcast on the blockchain after all other transactions are
signed. All other transactions spending from the funding
transactions are not yet broadcast, in case the counterparties
wish to update their balance. Only the Funding Transaction is
broadcast on the blockchain at this time.
}
\end{figure}
For instance, if Alice and Bob agree to create a Funding Transaction with a
single 2-of-2 output worth 1.0 BTC (with 0.5 BTC contribution from each), they
create a Commitment Transaction where there are two 0.5 BTC outputs for Alice
and Bob. The Commitment Transactions are signed first and keys are exchanged so
either is able to broadcast the Commitment Transaction at any time contingent
upon the Funding Transaction entering into the blockchain. At this point, the
Funding Transaction signatures can safely be exchanged, as either party is able
to redeem their funds by broadcasting the Commitment Transaction.
This construction breaks, however, when one wishes to update the present
balance. In order to update the balance, they must update their Commitment
Transaction output values (the Funding Transaction has already entered into the
blockchain and cannot be changed).
When both parties agree to a new Commitment Transaction and exchange signatures
for the new Commitment Transaction, either Commitment Transactions can be
broadcast. As the output from the Funding Transaction can only be redeemed once,
only one of those transactions will be valid. For instance, if Alice and Bob
agree that the balance of the channel is now 0.4 to Alice and 0.6 to Bob, and
a new Commitment Transaction is created to reflect that, either Commitment
Transaction can be broadcast. In effect, one would be unable to restrict which
Commitment Transaction is broadcast, since both parties have signed and
exchanged the signatures for either balance to be broadcast.
%Diagram - Broken funding transaction
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1\linewidth]{figures/funding-broken2.pdf}
}
\caption{Either of the Commitment Transactions can be broadcast any any
time by either party, only one will successfully spend from the
single Funding Transaction. This cannot work because one party
will not want to broadcast the most recent transaction.
}
\end{figure}
Since either party may broadcast the Commitment Transaction at any time, the
result would be after the new Commitment Transaction is generated, the one who
receives less funds has significant incentive to broadcast the transaction which
has greater values for themselves in the Commitment Transaction outputs. As a
result, the channel would be immediately closed and funds stolen. Therefore,
one cannot create payment channels under this model.
\subsubsection{Commitment Transactions: Ascribing Blame}
Since any signed Commitment Transaction may be broadcast on the blockchain, and
only one can be successfully broadcast, it is necessary to prevent old
Commitment Transactions from being broadcast. It is not possible to revoke tens
of thousands of transactions in Bitcoin, so an alternate method is necessary.
Instead of active revocation enforced by the blockchain, it's necessary to
construct the channel itself in similar manner to a Fidelity Bond, whereby both
parties make commitments, and violations of these commitments are enforced by
penalties. If one party violates their agreement, then they will lose all the
money in the channel.
For this payment channel, the contract terms are that both parties commit to
broadcasting only the most recent transaction. Any broadcast of older
transactions will cause a violation of the contract, and all funds are given to
the other party as a penalty.
This can only be enforced if one is able to ascribe blame for broadcasting an
old transaction. In order to do so, one must be able to uniquely identify who
broadcast an older transaction. This can be done if each counterparty has a
uniquely identifiable Commitment Transaction. Both parties must sign the inputs
to the Commitment Transaction which the other party is responsible for
broadcasting. Since one has a version of the Commitment Transaction that is
signed by the other party, one can only broadcast one's own version of the
Commitment Transaction.
For the Lightning Network, all spends from the Funding Transaction output,
Commitment Transactions, have two half-signed transactions. One Commitment
Transaction in which Alice signs and gives to Bob (C1b), and another which Bob
signs and gives to Alice (C1a). These two Commitment Transactions spend from the
same output (Funding Transaction), and have different contents; only one can be
broadcast on the blockchain, as both pairs of Commitment Transactions spend from
the same Funding Transaction. Either party may broadcast their received
Commitment Transaction by signing their version and including the counterparty's
signature. For example, Bob can broadcast Commitment C1b, since he has already
received the signature for C1b from Alice \textemdash he includes Alice's
signature and signs C1b himself. The transaction will be a valid spend from the
Funding Transaction's 2-of-2 output requiring both Alice and Bob's signature.
%Diagram - Broken funding transaction
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1\linewidth]{figures/funding-broken3.pdf}
}
\caption{Purple boxes are unbroadcasted transactions which only Alice
can broadcast. Blue boxes are unbroadcasted transaction which
only Bob can broadcast. Alice can only broadcast Commitment 1a,
Bob can only broadcast Commitment 1b. Only one Commitment
Transaction can be spent from the Funding Transaction output.
Blame is ascribed, but either one can still be spent with no
penalty.
}
\end{figure}
However, even with this construction, one has only merely allocated blame. It is
not yet possible to enforce this contract on the Bitcoin blockchain. Bob still
trusts Alice not to broadcast an old Commitment Transaction. At this time, he is
only able to prove that Alice has done so via a half-signed transaction proof.
\subsection{Creating a Channel with Contract Revocation}
To be able to actually enforce the terms of the contract, it's necessary to
construct a Commitment Transaction (along with its spends) where one is able
to revoke a transaction. This revocation is achievable by using data about when
a transaction enters into a blockchain and using the maturity of the transaction
to determine validation paths.
\subsection{Sequence Number Maturity}
Mark Freidenbach has proposed that Sequence Numbers can be enforcible via a
relative block maturity of the parent transaction via a
soft-fork\cite{seqnum}. This would allow some basic ability to ensure some form
of relative block confirmation time lock on the spending script. In addition, an
additional opcode, OP\_CHECKSEQUENCEVERIFY\cite{csv} (a.k.a.
OP\_RELATIVECHECKLOCKTIMEVERIFY)\cite{relCLTV}, would permit further abilities,
including allowing a stop-gap solution before a more permanent solution for
resolving transaction malleability. A future version of this paper will include
proposed solutions.
To summarize, Bitcoin was released with a sequence number which was only
enforced in the mempool of unconfirmed transactions. The original behavior
permitted transaction replacement by replacing transactions in the mempool with
newer transactions if they have a higher sequence number. Due to transaction
replacement rules, it is not enforced due to denial of service attack risks. It
appears as though the intended purpose of the sequence number is to replace
unbroadcasted transactions. However, this higher sequence number replacement
behavior is unenforcible. One cannot be assured that old versions of
transactions were replaced in the mempool and a block contains the most recent
version of the transaction. A way to enforce transaction versions off-chain is
via time commitments.
A Revocable Transaction spends from a unique output where the transaction has a
unique type of output script. This parent's output has two redemption paths
where the first can be redeemed immediately, and the second can only be redeemed
if the child has a minimum number of confirmations between transactions. This is
achieved by making the sequence number of the child transaction require a
minimum number of confirmations from the parent. In essence, this new sequence
number behavior will only permit a spend from this output to be valid if the
number of blocks between the output and the redeeming transaction is above a
specified block height.
A transaction can be revoked with this sequence number behavior by creating a
restriction with some defined number of blocks defined in the sequence number,
which will result in the spend being only valid after the parent has entered
into the blockchain for some defined number of blocks. This creates a structure
whereby the parent transaction with this output becomes a bonded deposit,
attesting that there is no revocation. A time period exists which anyone on the
blockchain can refute this attestation by broadcasting a spend immediately
after the transaction is broadcast.
If one wishes to permit revocable transactions with a 1000-confirmation delay,
the output transaction construction would remain a 2-of-2 multisig:
\begin{lstlisting}
2 <Alice1> <Bob1> 2 OP_CHECKMULTISIG
\end{lstlisting}
However, the child spending transaction would contain a nSequence value of 1000.
Since this transaction requires the signature of both counterparties to be
valid, both parties include the nSequence number of 1000 as part of the
signature. Both parties may, at their discretion, agree to create another
transaction which supersedes that transaction without any nSequence number.
This construction, a Revocable Sequence Maturity Contract (RSMC), creates
two paths, with very specific contract terms.
The contract terms are:
\begin{enumerate}
\item All parties pay into a contract with an output enforcing this
contract
\item Both parties may agree to send funds to some contract, with some
waiting period (1000 confirmations in our example script). This
is the revocable output balance.
\item One or both parties may elect to not broadcast (enforce) the
payouts until some future date; either party may redeem the
funds after the waiting period at any time.
\item If neither party has broadcast this transaction (redeemed the
funds), they may revoke the above payouts if and only if both
parties agree to do so by placing in a new payout term in a
superseding transaction payout. The new transaction payout can
be immediately redeemed after the contract is disclosed to the
world (broadcast on the blockchain).
\item In the event that the contract is disclosed and the new payout
structure is not redeemed, the prior revoked payout terms may be
redeemed by either party (so it is the responsibility of either
party to enforce the new terms).
\end{enumerate}
The pre-signed child transaction can be redeemed after the parent transaction
has entered into the blockchain with 1000 confirmations, due to the child's
nSequence number on the input spending the parent.
In order to revoke this signed child transaction, both parties just agree to
create another child transaction with the default field of the nSequence number
of MAX\_INT, which has special behavior permitting spending at any time.
This new signed spend supersedes the revocable spend so long as the new signed
spend enters into the blockchain within 1000 confirmations of the parent
transaction entering into the blockchain. In effect, if Alice and Bob agree to
monitor the blockchain for incorrect broadcast of Commitment Transactions, the
moment the transaction gets broadcast, they are able to spend using the
superseding transaction immediately. In order to broadcast the revocable spend
(deprecated transaction), which spends from the same output as the superseding
transaction, they must wait 1000 confirmations. So long as both parties watch
the blockchain, the revocable spend will never enter into the transaction if
either party prefers the superseding transaction.
Using this construction, anyone could create a transaction, not broadcast the
transaction, and then later create incentives to not ever broadcast that
transaction in the future via penalties. This permits participants on the
Bitcoin network to defer many transactions from ever hitting the blockchain.
\subsubsection{Timestop}
To mitigate a flood of transactions by a malicious attacker requires a credible
threat that the attack will fail.
Greg Maxwell proposed using a timestop to mitigate a malicious flood on the
blockchain:
\begin{quote}
There are many ways to address this [flood risk] which haven't been
adequately explored yet \textemdash for example, the clock can stop
when blocks are full; turning the security risk into more hold-up delay
in the event of a dos attack.\cite{gregtimestop}
\end{quote}
This can be mitigated by allowing the miner to specify whether the current
(fee paid) mempool is presently being flooded with transactions. They can enter
a ``1'' value into the last bit in the version number of the block header. If
the last bit in the block header contains a ``1'', then that block will not
count towards the relative height maturity for the nSequence value and the block
is designated as a congested block. There is an uncongested block height (which
is always lower than the normal block height). This block height is used for the
nSequence value, which only counts block maturity (confirmations).
A miner can elect to define the block as a congested block or not. The default
code could automatically set the congested block flag as ``1'' if the mempool is
above some size and the average fee for that set size is above some value.
However, a miner has full discretion to change the rules on what automatically
sets as a congested block, or can select to permanently set the congestion flag
to be permanently on or off. It's expected that most honest miners would use the
default behavior defined in their miner and not organize a 51\% attack.
For example, if a parent transaction output is spent by a child with a nSequence
value of 10, one must wait 10 confirmations before the transaction becomes
valid. However, if the timestop flag has been set, the counting of confirmations
stops, even with new blocks. If 6 confirmations have elapsed (4 more are
necessary for the transaction to be valid), and the timestop block has been set
on the 7th block, that block does not count towards the nSequence requirement of
10 confirmations; the child is still at 6 blocks for the relative confirmation
value. Functionally, this will be stored as some kind of auxiliary timestop
block height which is used only for tracking the timestop value. When the
timestop bit is set, all transactions using an nSequence value will stop
counting until the timestop bit has been unset. This gives sufficient time and
block-space for transactions at the current auxiliary timestop block height to
enter into the blockchain, which can prevent systemic attackers from
successfully attacking the system.
However, this requires some kind of flag in the block to designate whether it
is a timestop block. For full SPV compatibility (Simple Payment Verification;
lightweight clients), it is desirable for this to be within the 80-byte block
header instead of in the coinbase. There are two places which may be a good
place to put in this flag in the block header: in the block time and in the
block version. The block time may not be safe due to the last bits being used as
an entropy source for some ASIC miners, therefore a bit may need to be consumed
for timestop flags. Another option would be to hardcode timestop activation as a
hard consensus rule (e.g. via block size), however this may make things less
flexible. By setting sane defaults for timestop rules, these rules can be
changed without consensus soft-forks.
If the block version is used as a flag, the contextual information must match
the Chain ID used in some merge-mined coins.
\subsubsection{Revocable Commitment Transactions}
By combining the ascribing of blame as well as the revocable transaction, one
is able to determine when a party is not abiding by the terms of the contract,
and enforce penalties without trusting the counterparty.
%Diagram - Funding Transaction and all Commitment Spends 1
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1\linewidth]{figures/funding-full.pdf}
}
\caption{The Funding Transaction F, designated in green, is broadcast
on the blockchain after all other transactions are signed. All
transactions which only Alice can broadcast are in purple. All
transactions which only Bob can broadcast is are blue. Only the
Funding Transaction is broadcast on the blockchain at this
time.
}
\end{figure}
The intent of creating a new Commitment Transaction is to invalidate all old
Commitment Transactions when updating the new balance with a new Commitment
Transaction. Invalidation of old transactions can happen by making an output be
a Revocable Sequence Maturity Contract (RSMC). To invalidate a transaction, a
superseding transaction will be signed and exchanged by both parties that gives
all funds to the counterparty in the event an older transaction is incorrectly
broadcast. The incorrect broadcast is identified by creating two different
Commitment Transactions with the same final balance outputs, however the payment
to oneself is encumbered by an RSMC.
In effect, there are two Commitment Transactions from a single Funding
Transaction 2-of-2 outputs. Of these two Commitment Transactions, only one can
enter into the blockchain. Each party within a channel has one version of this
contract. So if this is the first Commitment Transaction pair, Alice's
Commitment Transaction is defined as C1a, and Bob's Commitment Transaction is
defined as C1b. By broadcasting a Commitment Transaction, one is requesting for
the channel to close out and end. The first two outputs for the Commitment
Transaction include a Delivery Transaction (payout) of the present unallocated
balance to the channel counterparties. If Alice broadcasts C1a, one of the
output is spendable by D1a, which sends funds to Bob. For Bob, C1b is spendable
by D1b, which sends funds to Alice. The Delivery Transaction (D1a/D1b) is
immediately redeemable and is not encumbered in any way in the event the
Commitment Transaction is broadcast.
For each party's Commitment Transaction, they are attesting that they are
broadcasting the most recent Commitment Transaction which they own. Since they
are attesting that this is the current balance, the balance paid to the
counterparty is assumed to be true, since one has no direct benefit by paying
some funds to the counterparty as a penalty.
The balance paid to the person who broadcast the Commitment Transaction,
however, is unverified. The participants on the blockchain have no idea if the
Commitment Transaction is the most recent or not. If they do not broadcast their
most recent version, they will be penalized by taking all the funds in the
channel and giving it to the counterparty. Since their own funds are encumbered
in their own RSMC, they will only be able to claim their funds after some set
number of confirmations after the Commitment Transaction has been included in a
block (in our example, 1000 confirmations). If they do broadcast their most
recent Commitment Transaction, there should be no revocation transaction
superseding the revocable transaction, so they will be able to receive their
funds after some set amount of time (1000 confirmations).
By knowing who broadcast the Commitment Transaction and encumbering one's own
payouts to be locked up for a predefined period of time, both parties will be
able to revoke the Commitment Transaction in the future.
\subsubsection{Redeeming Funds from the Channel: Cooperative Counterparties}
Either party may redeem the funds from the channel. However, the party that
broadcasts the Commitment Transaction must wait for the predefined number of
confirmations described in the RSMC. The counterparty which did not broadcast
the Commitment Transaction may redeem the funds immediately.
For example, if the Funding Transaction is committed with 1 BTC (half to each
counterparty) and Bob broadcasts the most recent Commitment Transaction, C1b, he
must wait 1000 confirmations to receive his 0.5 BTC, while Alice can spend 0.5
BTC. For Alice, this transaction is fully closed if Alice agrees that Bob
broadcast the correct Commitment Transaction (C1b).
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1\linewidth]{figures/funding-full-bob-spend.pdf}
}
\caption{When Bob broadcasts C1b, Alice can immediately redeem her
portion. Bob must wait 1000 confirmations. When the block is
immediately broadcast, it is in this state. Transactions in
green are transactions which are committed into the blockchain.
}
\end{figure}
After the Commitment Transaction has been in the blockchain for 1000 blocks,
Bob can then broadcast the Revocable Delivery transaction. He must wait 1000
blocks to prove he has not revoked this Commitment Transaction (C1b). After
1000 blocks, the Revocable Delivery transaction will be able to be included in a
block. If a party attempt to include the Revocable Delivery transaction in a
block before 1000 confirmations, the transaction will be invalid up until after
1000 confirmations have passed (at which point it will become valid if the
output has not yet been redeemed).
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1\linewidth]{figures/funding-full-bob-redeem.pdf}
}
\caption{Alice agrees that Bob broadcast the correct Commitment
Transaction and 1000 confirmations have passed. Bob then is able
to broadcast the Revocable Delivery (RD1b) transaction on the
blockchain.
}
\end{figure}
After Bob broadcasts the Revocable Delivery transaction, the channel is fully
closed for both Alice and Bob, everyone has received the funds which they both
agree are the current balance they each own in the channel.
If it was instead Alice who broadcast the Commitment Transaction (C1a), she is
the one who must wait 1000 confirmations instead of Bob.
\subsubsection{Creating a new Commitment Transaction and Revoking Prior
Commitments}
While each party may close out the most recent Commitment Transaction at any
time, they may also elect to create a new Commitment Transaction and invalidate
the old one.
Suppose Alice and Bob now want to update their current balances from 0.5 BTC
each refunded to 0.6 BTC for Bob and 0.4 BTC for Alice. When they both agree to
do so, they generate a new pair of Commitment Transactions.
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1\linewidth]{figures/newcommit-simple.pdf}
}
\caption{Four possible transactions can exist, a pair with the old
commitments, and another pair with the new commitments. Each
party inside the channel can only broadcast half of the total
commitments (two each). There is no explicit enforcement
preventing any particular Commitment being broadcast other than
penalty spends, as they are all valid unbroadcasted spends.
The Revocable Commitment still exists with the C1a/C1b pair, but
are not displayed for brevity.
}
\end{figure}
When a new pair of Commitment Transactions (C2a/C2b) is agreed upon, both
parties will sign and exchange signatures for the new Commitment Transaction,
then invalidate the old Commitment Transaction. This invalidation occurs by
having both parties sign a Breach Remedy Transaction (BR1), which supersedes the
Revocable Delivery Transaction (RD1). Each party hands to the other a
half-signed revocation (BR1) from their own Revocable Delivery (RD1), which is a
spend from the Commitment Transaction. The Breach Remedy Transaction will send
all coins to the counterparty within the current balance of the channel. For
example, if Alice and Bob both generate a new pair of Commitment Transactions
(C2a/C2b) and invalidate prior commitments (C1a/C1b), and later Bob incorrectly
broadcasts C1b on the blockchain, Alice can take all of Bob's money from the
channel. Alice can do this because Bob has proved to Alice via penalty that he
will never broadcast C1b, since the moment he broadcasts C1b, Alice is able to
take all of Bob's money in the channel. In effect, by constructing a Breach
Remedy transaction for the counterparty, one has attested that one will not be
broadcasting any prior commitments. The counterparty can accept this, because
they will get all the money in the channel when this agreement is violated.
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1.3\linewidth]{figures/newcommit-br.pdf}
}
\caption{
When C2a and C2b exist, both parties exchange Breach Remedy
transactions. Both parties now have explicit economic incentive
to avoid broadcasting old Commitment Transactions (C1a/C1b).
If either party wishes to close out the channel, they will only
use C2a (Alice) or C2b (Bob). If Alice broadcasts C1a, all her
money will go to Bob. If Bob broadcasts C1b, all his money will
go to Alice. See previous figure for C2a/C2b outputs.
}
\end{figure}
Due to this fact, one will likely delete all prior Commitment Transactions when
a Breach Remedy Transaction has been passed to the counterparty. If one
broadcasts an incorrect (deprecated and invalidated Commitment Transaction), all
the money will go to one's counterparty. For example, if Bob broadcasts C1b, so
long as Alice watches the blockchain within the predefined number of blocks (in
this case, 1000 blocks), Alice will be able to take all the money in this
channel by broadcasting RD1b. Even if the present balance of the Commitment
state (C2a/C2b) is 0.4 BTC to Alice and 0.6 BTC to Bob, because Bob violated the
terms of the contract, all the money goes to Alice as a penalty. Functionally,
the Revocable Transaction acts as a proof to the blockchain that Bob has
violated the terms in the channel and this is programatically adjudicated by the
blockchain.
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1.3\linewidth]{figures/newcommit-penalty.pdf}
}
\caption{
Transactions in green are committed to the blockchain. Bob
incorrectly broadcasts C1b (only Bob is able to broadcast
C1b/C2b). Because both agreed that the current state is the
C2a/C2b Commitment pair, and have attested to each party that
old commitments are invalidated via Breach Remedy Transactions,
Alice is able to broadcast BR1b and take all the money in the
channel, provided she does it within 1000 blocks after C1b is
broadcast.
}
\end{figure}
However, if Alice does not broadcast BR1b within 1000 blocks, Bob may be able to
steal some money, since his Revocable Delivery Transaction (RD1b) becomes valid
after 1000 blocks. When an incorrect Commitment Transaction is broadcast, only
the Breach Remedy Transaction can be broadcast for 1000 blocks (or whatever
number of confirmations both parties agree to). After 1000 block confirmations,
both the Breach Remedy (BR1b) and Revocable Delivery Transactions (RD1b) are
able to be broadcast at any time. Breach Remedy transactions only have
exclusivity within this predefined time period, and any time after of that is
functionally an expiration of the statute of limitations \textemdash according
to Bitcoin blockchain consensus, the time for dispute has ended.
For this reason, one should periodically monitor the blockchain to see if one's
counterparty has broadcast an invalidated Commitment Transaction, or delegate a
third party to do so. A third party can be delegated by only giving the Breach
Remedy transaction to this third party. They can be incentivized to watch the
blockchain broadcast such a transaction in the event of counterparty
maliciousness by giving these third parties some fee in the output. Since the
third party is only able to take action when the counterparty is acting
maliciously, this third party does not have any power to force close of the
channel.
\subsubsection{Process for Creating Revocable Commitment Transactions}
To create revocable Commitment Transactions, it requires proper construction of
the channel from the beginning, and only signing transactions which may be
broadcast at any time in the future, while ensuring that one will not lose out
due to uncooperative or malicious counterparties. This requires determining
which public key to use for new commitments, as using SIGHASH\_NOINPUT requires
using unique keys for each Commitment Transaction RSMC (and HTLC) output. We use
$P$ to designate pubkeys and $K$ to designate the corresponding private key used
to sign.
When generating the first Commitment Transaction, Alice and Bob agree to create
a multisig output from a Funding Transaction with a single $multisig(P_{AliceF},
P_{BobF})$ output, funded with 0.5 BTC from Alice and Bob for a total of 1 BTC.
This output is a Pay to Script Hash\cite{p2sh} transaction, which requires both
Alice and Bob to both agree to spend from the Funding Transaction. They do not
yet make the Funding Transaction (F) spendable. Additionally, $P_{AliceF}$ and
$P_{BobF}$ are only used for the Funding Transaction, they are not used for
anything else.
Since the Delivery transaction is just a P2PKH output (bitcoin addresses
beginning with 1) or P2SH transaction (commonly recognized as addresses
beginning with the 3) which the counterparties designate beforehand, this can be
generated as an output of $P_{AliceD}$ and $P_{BobD}$. For simplicity, these
output addresses will remain the same throughout the channel, since its funds
are fully controlled by its designated recipient after the Commitment
Transaction enters the blockchain. If desired, but not necessary, both parties
may update and change $P_{AliceD}$ and $P_{BobD}$ for future Commitment
Transactions.
Both parties exchange pubkeys they intend to use for the RSMC (and HTLC
described in future sections) for the Commitment Transaction. Each set of
Commitment Transactions use their own public keys and are not ever reused. Both
parties may already know all future pubkeys by using a BIP 0032\cite{bip32} HD
Wallet construction by exchanging Master Public Keys during channel
construction. If they wish to generate a new Commitment Transaction pair
C2a/C2b, they use multisig($P_{AliceRSMC2}$, $P_{BobRSMC2}$) for the RSMC
output.
After both parties know the output values from the Commitment Transactions, both
parties create the pair of Commitment Transactions, e.g. C2a/C2b, but do not
exchange signatures for the Commitment Transactions. They both sign the
Revocable Delivery transaction (RD2a/RD2b) and exchange the signatures. Bob
signs RD1a and gives it to Alice (using $K_{BobRSMC2}$), while Alice signs RD1b
and gives it to Bob (using $K_{AliceRSMC2}$).
When both parties have the Revocable Delivery transaction, they exchange
signatures for the Commitment Transactions. Bob signs C1a using $K_{BobF}$ and
gives it to Alice, and Alice signs C1b using $K_{AliceF}$ and gives it to Bob.
At this point, the prior Commitment Transaction as well as the new Commitment
Transaction can be broadcast; both C1a/C1b and C2a/C2b are valid. (Note that
Commitments older than the prior Commitment are invalidated via penalties.) In
order to invalidate C1a and C1b, both parties exchange Breach Remedy Transaction
(BR1a/BR1b) signatures for the prior commitment C1a/C1b. Alice sends BR1a to Bob
using $K_{AliceRSMC1}$, and Bob sends BR1b to Alice using $K_{BobRSMC1}$. When
both Breach Remedy signatures have been exchanged, the channel state is now at
the current Commitment C2a/C2b and the balances are now committed.
However, instead of disclosing the BR1a/BR1b signatures, it's also possible to
just disclose the private keys to the counterparty. This is more effective as
described later in the key storage section. One can disclose the private keys
used in one's own Commitment Transaction. For example, if Bob wishes to
invalidate C1b, he sends his private keys used in C1b to Alice (he does
\textit{NOT} disclose his keys used in C1a, as that would permit coin theft).
Similarly, Alice discloses all her private key outputs in C1a to Bob to
invalidate C1a.
If Bob incorrectly broadcasts C1b, then because Alice has all the private keys
used in the outputs of C1b, she can take the money. However, only Bob is able
to broadcast C1b. To prevent this coin theft risk, Bob should destroy all old
Commitment Transactions.
\subsection{Cooperatively Closing Out a Channel}
Both parties are able to send as many payments to their counterparty as they
wish, as long as they have funds available in the channel, knowing that in the
event of disagreements they can broadcast to the blockchain the current state
at any time.
In the vast majority of cases, all the outputs from the Funding Transaction
will never be broadcast on the blockchain. They are just there in case the
other party is non-cooperative, much like how a contract is rarely enforced in
the courts. A proven ability for the contract to be enforced in a deterministic
manner is sufficient incentive for both parties to act honestly.
When either party wishes to close out a channel cooperatively, they will be
able to do so by contacting the other party and spending from the Funding
Transaction with an output of the most current Commitment Transaction directly
with no script encumbering conditions. No further payments may occur in the
channel.
\begin{figure}[H]
\makebox[\linewidth]{
\includegraphics[width=1\linewidth]{figures/cooperative-close.pdf}
}
\caption{If both counterparties are cooperative, they take the
balances in the current Commitment Transaction and spend from
the Funding Transaction with a Exercise Settlement Transaction
(ES). If the most recent Commitment Transaction gets broadcast
instead, the payout (less fees) will be the same.
}
\end{figure}
The purpose of closing out cooperatively is to reduce the number of
transactions that occur on the blockchain and both parties will be able to
receive their funds immediately (instead of one party waiting for the