<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.bitcoin.it/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Almkglor</id>
	<title>Bitcoin Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.bitcoin.it/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Almkglor"/>
	<link rel="alternate" type="text/html" href="https://en.bitcoin.it/wiki/Special:Contributions/Almkglor"/>
	<updated>2026-04-05T19:27:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=ECDH_address&amp;diff=66330</id>
		<title>ECDH address</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=ECDH_address&amp;diff=66330"/>
		<updated>2019-04-20T05:09:01Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: Fix obvious typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;ECDH addresses are also called &#039;&#039;stealth addresses&#039;&#039;, &#039;&#039;reusable payment codes&#039;&#039;, &#039;&#039;reusable addresses&#039;&#039; or &#039;&#039;paynyms&#039;&#039;. Elliptic-curve Diffie–Hellman (ECDH) is a key agreement protocol that allows two parties to establish a shared secret over an insecure channel. For example, Alice and Bob can communicate cryptographic information between themselves and agree on a shared secret, Eve the eavesdropper can see _all_ their messages and yet still will not be able to calculate the shared secret.&lt;br /&gt;
&lt;br /&gt;
The concept can be used in a bitcoin context by having the receiver of bitcoin publish some ECDH-information which the sender can use to calculate a shared secret. This shared secret becomes a bitcoin [[address]] which the sender sends money to. The receiver can calculate the corresponding [[private key]] to have access to the money.&lt;br /&gt;
&lt;br /&gt;
== How it works (single key) ==&lt;br /&gt;
&lt;br /&gt;
Lowercase symbols refer to numbers, uppercase symbols refer to elliptic curve points. &amp;lt;code&amp;gt;a.B&amp;lt;/code&amp;gt; refers to point multiplication of &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;B&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;G&amp;lt;/code&amp;gt; is the [[Secp256k1]] generator point. &amp;lt;code&amp;gt;H(x)&amp;lt;/code&amp;gt; means the hash (e.g. SHA256) of value X.&lt;br /&gt;
&lt;br /&gt;
 q = ECDH address privkey        (generated by receiver)&lt;br /&gt;
 Q = q.G = ECDH address pubkey   (published by receiver)&lt;br /&gt;
&lt;br /&gt;
 p = nonce                       (generated by sender)&lt;br /&gt;
 P = p.G = nonce point           (sent from sender to receiver)&lt;br /&gt;
&lt;br /&gt;
 p.Q = q.P = p.q.G               (ECDH shared secret point, known by sender and receiver but not eavesdroppers)&lt;br /&gt;
 c = H(p.Q) = H(q.P)             (tweak, shared secret point converted to number)&lt;br /&gt;
&lt;br /&gt;
 sender calculates:&lt;br /&gt;
 Q&#039; = Q + c.G                    (bitcoin pubkey, send coins here)&lt;br /&gt;
&lt;br /&gt;
 receiver calculates:&lt;br /&gt;
 Q&#039; = Q + c.G = (q + c).G        (bitcoin pubkey, watch for incoming coins)&lt;br /&gt;
 q&#039; = q + c                      (bitcoin privkey, for spending incoming coins)&lt;br /&gt;
&lt;br /&gt;
== Dual-key ECDH address ==&lt;br /&gt;
&lt;br /&gt;
Another way of creating a ECDH address system is to have two receiver keypairs. One key has the power to spend the money (spend key) and the other key is for searching (scan key). Then the scan key can be sent to a third-party server to outsource the scanning. The server won&#039;t be able to steal any money because it doesn&#039;t have the spend key. Needless to say this method is not good for privacy because the server can see track all the transactions on the ECDH address.&lt;br /&gt;
&lt;br /&gt;
== Transmitting the nonce point ==&lt;br /&gt;
&lt;br /&gt;
A tricky part of the ECDH scheme is transmitting the nonce point &amp;lt;code&amp;gt;P&amp;lt;/code&amp;gt; from sender to receiver. There are a few different methods for this:&lt;br /&gt;
&lt;br /&gt;
# Embedding the nonce point in a [[OP_RETURN]] output. This requires the receiver to scan all blocks for check for OP_RETURN outputs and corresponding ECDH payments. It also uses extra block space, and allows estimation of how many ECDH transactions have happened.&lt;br /&gt;
# Embedding the nonce point in an [[ECDSA]] signature. This requires the receiver to scan all blocks for check for ECDH payments. It also damages fungibility slightly by only allowing coins protected by [[ECDSA]] to be sent via ECDH.&lt;br /&gt;
# Delegation of scanning to a third-party server (see above, Dual-key ECDH address). Ruins privacy as the server can track everything.&lt;br /&gt;
# Embedding the nonce point in an extra transaction (in [[OP_RETURN]]) sent to a fixed address belonging to the receiver. This allows the receiver to outsource scanning to a server which watches the fixed address. The server can count the number of ECDH transactions but not easily track their amount, source or destination. This also uses extra block space.&lt;br /&gt;
# Sending the nonce-point out-of-band (by email, for example). Requires an extra step of interactivity, and damages user-friendlyness.&lt;br /&gt;
&lt;br /&gt;
ECDH addresses therefore require either a costly scan process of the entire blockchain, delegation to a third-party server which can spy on transactions, an extra step of interactivity or using the blockchain as a messaging medium.&lt;br /&gt;
&lt;br /&gt;
== Privacy ==&lt;br /&gt;
&lt;br /&gt;
ECDH addresses improve privacy by making it easier to avoid [[address reuse]]. An adversary can see the ECDH donation address but won&#039;t be able to easily find any [[transaction]]s spending to and from it. ECDH addresses are very closely equivalent to [[Receiving_donations_with_bitcoin#Improving_privacy_by_avoiding_address_re-use|running a http website which hands out bitcoin addresses to anybody who wants to donate]] except without an added step of interactivity.&lt;br /&gt;
&lt;br /&gt;
However [[ECDH address]]es do not solve all privacy problems as they are still vulnerable to [[Privacy#Mystery_shopper_payment|mystery shopper payments]]; an adversary can donate some bitcoins and watch on the blockchain to see where they go afterwards, using heuristics like the [[common-input-ownership heuristic]] to obtain more information such as donation volume and final destination of funds.&lt;br /&gt;
&lt;br /&gt;
Historically it has been very hard and slow to get the bitcoin ecosystem to adopt a new address type.&lt;br /&gt;
&lt;br /&gt;
== BIP47 ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/bitcoin/bips/blob/master/bip-0047.mediawiki BIP47] is a standard for ECDH address (the BIP calls them &#039;&#039;Reusable Payment Codes&#039;&#039;). It transmits the nonce in an extra transaction with a [[OP_RETURN]] output.&lt;br /&gt;
&lt;br /&gt;
The comments on the BIP47 document unanimously discourage its implementation&amp;lt;ref&amp;gt;https://github.com/bitcoin/bips/wiki/Comments:BIP-0047&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Privacy]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Privacy]]&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=65341</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=65341"/>
		<updated>2018-05-02T06:07:44Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].  Specifically, many designs require a way to be able to spend an unsigned transaction, in order to ensure that the channel can be opened atomically.  Thus, these designs require a malleability fix that separates the signatures from the part of the transaction that is hashed to form the txid.&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Wattenhofer duplex payment channels ===&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels were presented in a paper&amp;lt;ref name=&#039;duplex_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels] Decker, C.; Wattenhofer, R.&amp;lt;/ref&amp;gt; by Christian Decker and Roger Wattenhofer.  This type of payment channel requires the new BIP68&amp;lt;ref name=&#039;bip68&#039;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68]&amp;lt;/ref&amp;gt; meaning of nSequence.  As the name implies, a duplex payment channel is composed of two unidirectional payment channels, one in both directions.  The unidirectional payment channels are essentially Spillman channels, but using relative lock time (nSequence) instead of nLockTime.&lt;br /&gt;
&lt;br /&gt;
However, instead of funding unidirectional payment channels directly from an on-chain funding transaction, there is an &amp;quot;invalidation tree&amp;quot; of off-chain transactions between the funding transaction and the payment channel finalization transactions.  The invalidation tree transactions also use relative lock time; the first version of the transaction has a large relative lock time, and the next version of the transaction (which &#039;&#039;invalidates&#039;&#039; the first) uses a slightly smaller relative lock time, and so on.  There is also a &amp;quot;kick-off&amp;quot; transaction that starts the timeout for the relative locktime.  The sequence of transactions is thus: funding -&amp;gt; kickoff -&amp;gt; invalidation tree -&amp;gt; payment channel.&lt;br /&gt;
&lt;br /&gt;
Initially, the invalidation transaction may have a relative lock time of 100 days, and then its outputs go to two unidirectional payment channels, one in either direction.  Both parties may then use the payment channels until one channel is exhausted.  The parties may then reset the payment channels, creating a new invalidation transaction with a relative lock time of 99 days that redistributes the money correctly, but with the unidirectional payment channels reset.&lt;br /&gt;
&lt;br /&gt;
The payment channel may be closed at any time by either party (without the help of the other) by broadcasting the kickoff transaction on the blockchain.  In case of such a unilateral close, both parties must wait out the relative lock times until they can broadcast the payment channel finalization transactions.&lt;br /&gt;
&lt;br /&gt;
Parties should prefer the bilateral (cooperative) close, which collapses the kickoff, invalidation tree, and payment channel transactions into a single simple transaction that pays out the funds to both parties.&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels have indefinite lifetime, but there is a limit on number of updates possible due to the invalidation tree.  This limit can be multiplied by adding additional layers to the invalidation tree, with resetting of the lower layers.  Finally, in case of a unilateral close duplex payment channels require significant wait times and significant number of transactions to be published on the blockchain.&lt;br /&gt;
&lt;br /&gt;
The invalidation tree structure may actually have more than two participants; it would be possible for groups of 3 or more parties to build multiple payment channels between them that are backed by this invalidation tree structure, and to rebalance their payment channels without hitting the blockchain.&amp;lt;ref name=&#039;scaling_funding_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/a20a865ce40d40c8f942cf206a7cba96/Scalable_Funding_Of_Blockchain_Micropayment_Networks%20(1).pdf Scalable Funding of Bitcoin Micropayment Channel Networks]&amp;lt;/ref&amp;gt;  It would also be possible for the invalidation tree structure to fund Poon-Dryja rather than pairs of unidirectional payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Russell-Osuntokun eltoo Channels ===&lt;br /&gt;
&lt;br /&gt;
Eltoo channels were presented in a paper&amp;lt;ref name=&#039;eltoo_pdf&#039;&amp;gt;[https://blockstream.com/eltoo.pdf eltoo: A Simple Layer2 Protocol for Bitcoin] Decker, C.; Russell, R., Osuntokun, O. &#039;&#039;&#039;Retrieved 2018-05-02&#039;&#039;&#039;&amp;lt;/ref&amp;gt; by Christian Decker, Rusty Russell, and Olauluwa Osuntokun in April 30, 2018. This type of channel requires a new &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;&amp;lt;ref name=&#039;bip_sighash_noinput&#039;&amp;gt;[https://github.com/cdecker/bips/blob/noinput/bip-xyz.mediawiki &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;]&amp;lt;/ref&amp;gt; signing flag.&lt;br /&gt;
&lt;br /&gt;
Roughly, each update of the channel requires creating two transactions: an update transaction and a CSV-encumbered settlement transaction that spends the update transaction. Via &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt; and an unusual use of &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt;, any later update transaction can spend any earlier update transaction during the time that the settlement transaction is encumbered; only the latest update transaction cannot be spent by another update transaction (since it has no later update) and can only be spent by its corresponding settlement transaction after the CSV delay has passed.  Thus even if an attacker or disrupter publishes an old update transaction, it cannot get the old state published since the latest transaction can still be published while the CSV-delay on the old settlement transaction hasn&#039;t completed yet.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt; is not used to enforce a particular future time, but rather to enforce an ordering on the update transactions, such that a later update transaction can spend an earlier update transaction, but not vice versa.  This is because &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt; ensures that the spending transaction has a &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; equal to, &#039;&#039;&#039;or greater than&#039;&#039;&#039;, the value specified in the spent output SCRIPT.  Each update transaction&#039;s output SCRIPT has an &amp;quot;update&amp;quot; branch that allows any update transaction to spend it, as long as that update transaction has a higher &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; than it currently has.  We use past &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; Unix timestamps, which start at 500,000,000 and reach up to about ~1,500,000,000 (somewhat less than the Unix timestamp as of time of writing), giving a limit of about 1,000,000,000 (1 billion) updates.  If an old update transaction is spent, it will allow any later update transaction to spend it, thus preventing publication of old settlement transactions.&lt;br /&gt;
&lt;br /&gt;
This has the advantage of not requiring a punishment branch (unlike Poon-Dryja), simplifying watchtower design and reducing the punishment of accidentally using old state (which would lead to total loss of funds under Poon-Dryja, but will only lead to wasting of fees in Decker-Russell-Osuntokun).  However, it requires a new feature in the base blockchain (&amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=65340</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=65340"/>
		<updated>2018-05-02T06:05:54Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: /* Decker-Russell-Osuntokun eltoo Channels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].  Specifically, many designs require a way to be able to spend an unsigned transaction, in order to ensure that the channel can be opened atomically.  Thus, these designs require a malleability fix that separates the signatures from the part of the transaction that is hashed to form the txid.&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Wattenhofer duplex payment channels ===&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels were presented in a paper&amp;lt;ref name=&#039;duplex_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels] Decker, C.; Wattenhofer, R.&amp;lt;/ref&amp;gt; by Christian Decker and Roger Wattenhofer.  This type of payment channel requires the new BIP68&amp;lt;ref name=&#039;bip68&#039;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68]&amp;lt;/ref&amp;gt; meaning of nSequence.  As the name implies, a duplex payment channel is composed of two unidirectional payment channels, one in both directions.  The unidirectional payment channels are essentially Spillman channels, but using relative lock time (nSequence) instead of nLockTime.&lt;br /&gt;
&lt;br /&gt;
However, instead of funding unidirectional payment channels directly from an on-chain funding transaction, there is an &amp;quot;invalidation tree&amp;quot; of off-chain transactions between the funding transaction and the payment channel finalization transactions.  The invalidation tree transactions also use relative lock time; the first version of the transaction has a large relative lock time, and the next version of the transaction (which &#039;&#039;invalidates&#039;&#039; the first) uses a slightly smaller relative lock time, and so on.  There is also a &amp;quot;kick-off&amp;quot; transaction that starts the timeout for the relative locktime.  The sequence of transactions is thus: funding -&amp;gt; kickoff -&amp;gt; invalidation tree -&amp;gt; payment channel.&lt;br /&gt;
&lt;br /&gt;
Initially, the invalidation transaction may have a relative lock time of 100 days, and then its outputs go to two unidirectional payment channels, one in either direction.  Both parties may then use the payment channels until one channel is exhausted.  The parties may then reset the payment channels, creating a new invalidation transaction with a relative lock time of 99 days that redistributes the money correctly, but with the unidirectional payment channels reset.&lt;br /&gt;
&lt;br /&gt;
The payment channel may be closed at any time by either party (without the help of the other) by broadcasting the kickoff transaction on the blockchain.  In case of such a unilateral close, both parties must wait out the relative lock times until they can broadcast the payment channel finalization transactions.&lt;br /&gt;
&lt;br /&gt;
Parties should prefer the bilateral (cooperative) close, which collapses the kickoff, invalidation tree, and payment channel transactions into a single simple transaction that pays out the funds to both parties.&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels have indefinite lifetime, but there is a limit on number of updates possible due to the invalidation tree.  This limit can be multiplied by adding additional layers to the invalidation tree, with resetting of the lower layers.  Finally, in case of a unilateral close duplex payment channels require significant wait times and significant number of transactions to be published on the blockchain.&lt;br /&gt;
&lt;br /&gt;
The invalidation tree structure may actually have more than two participants; it would be possible for groups of 3 or more parties to build multiple payment channels between them that are backed by this invalidation tree structure, and to rebalance their payment channels without hitting the blockchain.&amp;lt;ref name=&#039;scaling_funding_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/a20a865ce40d40c8f942cf206a7cba96/Scalable_Funding_Of_Blockchain_Micropayment_Networks%20(1).pdf Scalable Funding of Bitcoin Micropayment Channel Networks]&amp;lt;/ref&amp;gt;  It would also be possible for the invalidation tree structure to fund Poon-Dryja rather than pairs of unidirectional payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Russell-Osuntokun eltoo Channels ===&lt;br /&gt;
&lt;br /&gt;
Eltoo channels were presented in a paper&amp;lt;ref name=&#039;eltoo_pdf&#039;&amp;gt;[https://blockstream.com/eltoo.pdf eltoo: A Simple Layer2 Protocol for Bitcoin] Decker, C.; Russell, R., Osuntokun, O.&amp;lt;/ref&amp;gt; by Christian Decker, Rusty Russell, and Olauluwa Osuntokun in April 30, 2018. This type of channel requires a new &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;&amp;lt;ref name=&#039;bip_sighash_noinput&#039;&amp;gt;[https://github.com/cdecker/bips/blob/noinput/bip-xyz.mediawiki &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;]&amp;lt;/ref&amp;gt; signing flag.&lt;br /&gt;
&lt;br /&gt;
Roughly, each update of the channel requires creating two transactions: an update transaction and a CSV-encumbered settlement transaction that spends the update transaction. Via &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt; and an unusual use of &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt;, any later update transaction can spend any earlier update transaction during the time that the settlement transaction is encumbered; only the latest update transaction cannot be spent by another update transaction (since it has no later update) and can only be spent by its corresponding settlement transaction after the CSV delay has passed.  Thus even if an attacker or disrupter publishes an old update transaction, it cannot get the old state published since the latest transaction can still be published while the CSV-delay on the old settlement transaction hasn&#039;t completed yet.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt; is not used to enforce a particular future time, but rather to enforce an ordering on the update transactions, such that a later update transaction can spend an earlier update transaction, but not vice versa.  This is because &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt; ensures that the spending transaction has a &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; equal to, &#039;&#039;&#039;or greater than&#039;&#039;&#039;, the value specified in the spent output SCRIPT.  Each update transaction&#039;s output SCRIPT has an &amp;quot;update&amp;quot; branch that allows any update transaction to spend it, as long as that update transaction has a higher &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; than it currently has.  We use past &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; Unix timestamps, which start at 500,000,000 and reach up to about ~1,500,000,000 (somewhat less than the Unix timestamp as of time of writing), giving a limit of about 1,000,000,000 (1 billion) updates.  If an old update transaction is spent, it will allow any later update transaction to spend it, thus preventing publication of old settlement transactions.&lt;br /&gt;
&lt;br /&gt;
This has the advantage of not requiring a punishment branch (unlike Poon-Dryja), simplifying watchtower design and reducing the punishment of accidentally using old state (which would lead to total loss of funds under Poon-Dryja, but will only lead to wasting of fees in Decker-Russell-Osuntokun).  However, it requires a new feature in the base blockchain (&amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=65339</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=65339"/>
		<updated>2018-05-02T05:59:42Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: /* Decker-Russell-Osuntokun eltoo Channels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].  Specifically, many designs require a way to be able to spend an unsigned transaction, in order to ensure that the channel can be opened atomically.  Thus, these designs require a malleability fix that separates the signatures from the part of the transaction that is hashed to form the txid.&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Wattenhofer duplex payment channels ===&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels were presented in a paper&amp;lt;ref name=&#039;duplex_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels] Decker, C.; Wattenhofer, R.&amp;lt;/ref&amp;gt; by Christian Decker and Roger Wattenhofer.  This type of payment channel requires the new BIP68&amp;lt;ref name=&#039;bip68&#039;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68]&amp;lt;/ref&amp;gt; meaning of nSequence.  As the name implies, a duplex payment channel is composed of two unidirectional payment channels, one in both directions.  The unidirectional payment channels are essentially Spillman channels, but using relative lock time (nSequence) instead of nLockTime.&lt;br /&gt;
&lt;br /&gt;
However, instead of funding unidirectional payment channels directly from an on-chain funding transaction, there is an &amp;quot;invalidation tree&amp;quot; of off-chain transactions between the funding transaction and the payment channel finalization transactions.  The invalidation tree transactions also use relative lock time; the first version of the transaction has a large relative lock time, and the next version of the transaction (which &#039;&#039;invalidates&#039;&#039; the first) uses a slightly smaller relative lock time, and so on.  There is also a &amp;quot;kick-off&amp;quot; transaction that starts the timeout for the relative locktime.  The sequence of transactions is thus: funding -&amp;gt; kickoff -&amp;gt; invalidation tree -&amp;gt; payment channel.&lt;br /&gt;
&lt;br /&gt;
Initially, the invalidation transaction may have a relative lock time of 100 days, and then its outputs go to two unidirectional payment channels, one in either direction.  Both parties may then use the payment channels until one channel is exhausted.  The parties may then reset the payment channels, creating a new invalidation transaction with a relative lock time of 99 days that redistributes the money correctly, but with the unidirectional payment channels reset.&lt;br /&gt;
&lt;br /&gt;
The payment channel may be closed at any time by either party (without the help of the other) by broadcasting the kickoff transaction on the blockchain.  In case of such a unilateral close, both parties must wait out the relative lock times until they can broadcast the payment channel finalization transactions.&lt;br /&gt;
&lt;br /&gt;
Parties should prefer the bilateral (cooperative) close, which collapses the kickoff, invalidation tree, and payment channel transactions into a single simple transaction that pays out the funds to both parties.&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels have indefinite lifetime, but there is a limit on number of updates possible due to the invalidation tree.  This limit can be multiplied by adding additional layers to the invalidation tree, with resetting of the lower layers.  Finally, in case of a unilateral close duplex payment channels require significant wait times and significant number of transactions to be published on the blockchain.&lt;br /&gt;
&lt;br /&gt;
The invalidation tree structure may actually have more than two participants; it would be possible for groups of 3 or more parties to build multiple payment channels between them that are backed by this invalidation tree structure, and to rebalance their payment channels without hitting the blockchain.&amp;lt;ref name=&#039;scaling_funding_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/a20a865ce40d40c8f942cf206a7cba96/Scalable_Funding_Of_Blockchain_Micropayment_Networks%20(1).pdf Scalable Funding of Bitcoin Micropayment Channel Networks]&amp;lt;/ref&amp;gt;  It would also be possible for the invalidation tree structure to fund Poon-Dryja rather than pairs of unidirectional payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Russell-Osuntokun eltoo Channels ===&lt;br /&gt;
&lt;br /&gt;
Eltoo channels were presented in a paper&amp;lt;ref name=&#039;eltoo_pdf&#039;&amp;gt;[https://blockstream.com/eltoo.pdf eltoo: A Simple Layer2 Protocol for Bitcoin] Decker, C.; Russell, R., Osuntokun, O.&amp;lt;/ref&amp;gt; by Christian Decker, Rusty Russell, and Olauluwa Osuntokun in April 30, 2018. This type of channel requires a new &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;&amp;lt;ref name=&#039;bip_sighash_noinput&#039;&amp;gt;[https://github.com/cdecker/bips/blob/noinput/bip-xyz.mediawiki &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;]&amp;lt;/ref&amp;gt; signing flag.&lt;br /&gt;
&lt;br /&gt;
Roughly, each update of the channel requires creating two transactions: an update transaction and a CSV-encumbered settlement transaction that spends the update transaction. Via &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt; and an unusual use of &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt;, any later update transaction can spend any earlier update transaction during the time that the settlement transaction is encumbered; only the latest update transaction cannot be spent by another update transaction (since it has no later update) and can only be spent by its corresponding settlement transaction after the CSV delay has passed.  Thus even if an attacker or disrupter publishes an old update transaction, it cannot get the old state published since the latest transaction can still be published while the CSV-delay on the old settlement transaction hasn&#039;t completed yet.&lt;br /&gt;
&lt;br /&gt;
This has the advantage of not requiring a punishment branch (unlike Poon-Dryja), simplifying watchtower design and reducing the punishment of accidentally using old state (which would lead to total loss of funds under Poon-Dryja, but will only lead to wasting of fees in Decker-Russell-Osuntokun).  However, it requires a new feature in the base blockchain (&amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=65338</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=65338"/>
		<updated>2018-05-02T03:32:30Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: eltoo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].  Specifically, many designs require a way to be able to spend an unsigned transaction, in order to ensure that the channel can be opened atomically.  Thus, these designs require a malleability fix that separates the signatures from the part of the transaction that is hashed to form the txid.&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Wattenhofer duplex payment channels ===&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels were presented in a paper&amp;lt;ref name=&#039;duplex_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels] Decker, C.; Wattenhofer, R.&amp;lt;/ref&amp;gt; by Christian Decker and Roger Wattenhofer.  This type of payment channel requires the new BIP68&amp;lt;ref name=&#039;bip68&#039;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68]&amp;lt;/ref&amp;gt; meaning of nSequence.  As the name implies, a duplex payment channel is composed of two unidirectional payment channels, one in both directions.  The unidirectional payment channels are essentially Spillman channels, but using relative lock time (nSequence) instead of nLockTime.&lt;br /&gt;
&lt;br /&gt;
However, instead of funding unidirectional payment channels directly from an on-chain funding transaction, there is an &amp;quot;invalidation tree&amp;quot; of off-chain transactions between the funding transaction and the payment channel finalization transactions.  The invalidation tree transactions also use relative lock time; the first version of the transaction has a large relative lock time, and the next version of the transaction (which &#039;&#039;invalidates&#039;&#039; the first) uses a slightly smaller relative lock time, and so on.  There is also a &amp;quot;kick-off&amp;quot; transaction that starts the timeout for the relative locktime.  The sequence of transactions is thus: funding -&amp;gt; kickoff -&amp;gt; invalidation tree -&amp;gt; payment channel.&lt;br /&gt;
&lt;br /&gt;
Initially, the invalidation transaction may have a relative lock time of 100 days, and then its outputs go to two unidirectional payment channels, one in either direction.  Both parties may then use the payment channels until one channel is exhausted.  The parties may then reset the payment channels, creating a new invalidation transaction with a relative lock time of 99 days that redistributes the money correctly, but with the unidirectional payment channels reset.&lt;br /&gt;
&lt;br /&gt;
The payment channel may be closed at any time by either party (without the help of the other) by broadcasting the kickoff transaction on the blockchain.  In case of such a unilateral close, both parties must wait out the relative lock times until they can broadcast the payment channel finalization transactions.&lt;br /&gt;
&lt;br /&gt;
Parties should prefer the bilateral (cooperative) close, which collapses the kickoff, invalidation tree, and payment channel transactions into a single simple transaction that pays out the funds to both parties.&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels have indefinite lifetime, but there is a limit on number of updates possible due to the invalidation tree.  This limit can be multiplied by adding additional layers to the invalidation tree, with resetting of the lower layers.  Finally, in case of a unilateral close duplex payment channels require significant wait times and significant number of transactions to be published on the blockchain.&lt;br /&gt;
&lt;br /&gt;
The invalidation tree structure may actually have more than two participants; it would be possible for groups of 3 or more parties to build multiple payment channels between them that are backed by this invalidation tree structure, and to rebalance their payment channels without hitting the blockchain.&amp;lt;ref name=&#039;scaling_funding_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/a20a865ce40d40c8f942cf206a7cba96/Scalable_Funding_Of_Blockchain_Micropayment_Networks%20(1).pdf Scalable Funding of Bitcoin Micropayment Channel Networks]&amp;lt;/ref&amp;gt;  It would also be possible for the invalidation tree structure to fund Poon-Dryja rather than pairs of unidirectional payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Russell-Osuntokun eltoo Channels ===&lt;br /&gt;
&lt;br /&gt;
Eltoo channels were presented in a paper&amp;lt;ref name=&#039;eltoo_pdf&#039;&amp;gt;[https://blockstream.com/eltoo.pdf eltoo: A Simple Layer2 Protocol for Bitcoin] Decker, C.; Russell, R., Osuntokun, O.&amp;lt;/ref&amp;gt; by Christian Decker, Rusty Russell, and Olauluwa Osuntokun in April 30, 2018. This type of channel requires a new &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;&amp;lt;ref name=&#039;bip_sighash_noinput&#039;&amp;gt;[https://github.com/cdecker/bips/blob/noinput/bip-xyz.mediawiki &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;]&amp;lt;/ref&amp;gt; signing flag.&lt;br /&gt;
&lt;br /&gt;
Roughly, each update of the channel requires creating two transactions: an update transaction and a CSV-encumbered settlement transaction that spends the update transaction. Via &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt; and an unusual use of &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt;, any later update transaction can spend any earlier update transaction during the time that the settlement transaction is encumbered; only the latest update transaction cannot be spent by another update transaction (since it has no later update) and can only be spent by its corresponding settlement transaction after the CSV delay has passed.  Thus even if an attacker or disrupter publishes an old update transaction, it cannot get the old state published since the latest transaction can still be published while the CSV-delay on the old settlement transaction is still passing.&lt;br /&gt;
&lt;br /&gt;
This has the advantage of not requiring a punishment branch (unlike Poon-Dryja), simplifying watchtower design and reducing the punishment of accidentally using old state (which would lead to total loss of funds under Poon-Dryja, but will only lead to wasting of fees in Decker-Russell-Osuntokun).  However, it requires a new feature in the base blockchain (&amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Bitcoin_Core_compatible_devices&amp;diff=64290</id>
		<title>Bitcoin Core compatible devices</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Bitcoin_Core_compatible_devices&amp;diff=64290"/>
		<updated>2017-11-28T15:25:46Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A list of devices which are able to run recent versions of Bitcoin Core.&lt;br /&gt;
Note that these devices have *not* been tested to meet (currently undetermined) minimum specifications.&lt;br /&gt;
&lt;br /&gt;
== Desktop/Laptops ==&lt;br /&gt;
&lt;br /&gt;
* All Intel architecture 32-bit and 64-bit PCs and Macs.  Pre-compiled executables are available from [https://bitcoin.org/en/download Bitcoin.org] for Windows, OS X, and most popular Linuxes.  Users can compile executables for other Linuxes and the BSD-derived operating systems.&lt;br /&gt;
&lt;br /&gt;
== ARM-based Chipsets ==&lt;br /&gt;
&lt;br /&gt;
* Raspberry Pi v1 running Raspbian or another Linux&amp;lt;ref&amp;gt;[http://blog.pryds.eu/2014/06/compile-bitcoin-core-on-raspberry-pi.html Tutorial: Bitcoin Core on a Raspberry Pi], retrieved 26 August 2015&amp;lt;/ref&amp;gt;, although it will run very slowly and the initial block chain sync may take more than a week.&lt;br /&gt;
&lt;br /&gt;
* Raspberry Pi v2 running Raspbian or another Linux&amp;lt;ref&amp;gt;[https://web.archive.org/web/20150909172127/http://n-o-d-e.net/post/115030545546/how-to-build-a-bitcoin-node-on-the-raspberry-pi-2 How to build a Bitcoin node on the Raspberry Pi 2], archive.org copy 09 September 2015&amp;lt;/ref&amp;gt;.  Being about six times faster than the original RPi, it has the potential to be much more usable.&lt;br /&gt;
&lt;br /&gt;
* ODroid U2 running Linux, although it&#039;s &amp;quot;not reliable due to thermal issues&amp;quot;&amp;lt;ref name=&amp;quot;gmaxwell-irc&amp;quot;&amp;gt;[http://bitcoinstats.com/irc/bitcoin-dev/logs/2015/05/09#l1431157210.0 #bitcoin IRC log] 9 May 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Novena (Cortex A9) running Linux&amp;lt;ref name=&amp;quot;gmaxwell-irc&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Bitcoin Core documentation}}&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64287</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64287"/>
		<updated>2017-11-26T00:31:36Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].  Specifically, many designs require a way to be able to spend an unsigned transaction, in order to ensure that the channel can be opened atomically.  Thus, these designs require a malleability fix that separates the signatures from the part of the transaction that is hashed to form the txid.&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Wattenhofer duplex payment channels ===&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels were presented in a paper&amp;lt;ref name=&#039;duplex_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels] Decker, C.; Wattenhofer, R.&amp;lt;/ref&amp;gt; by Christian Decker and Roger Wattenhofer.  This type of payment channel requires the new BIP68&amp;lt;ref name=&#039;bip68&#039;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68]&amp;lt;/ref&amp;gt; meaning of nSequence.  As the name implies, a duplex payment channel is composed of two unidirectional payment channels, one in both directions.  The unidirectional payment channels are essentially Spillman channels, but using relative lock time (nSequence) instead of nLockTime.&lt;br /&gt;
&lt;br /&gt;
However, instead of funding unidirectional payment channels directly from an on-chain funding transaction, there is an &amp;quot;invalidation tree&amp;quot; of off-chain transactions between the funding transaction and the payment channel finalization transactions.  The invalidation tree transactions also use relative lock time; the first version of the transaction has a large relative lock time, and the next version of the transaction (which &#039;&#039;invalidates&#039;&#039; the first) uses a slightly smaller relative lock time, and so on.  There is also a &amp;quot;kick-off&amp;quot; transaction that starts the timeout for the relative locktime.  The sequence of transactions is thus: funding -&amp;gt; kickoff -&amp;gt; invalidation tree -&amp;gt; payment channel.&lt;br /&gt;
&lt;br /&gt;
Initially, the invalidation transaction may have a relative lock time of 100 days, and then its outputs go to two unidirectional payment channels, one in either direction.  Both parties may then use the payment channels until one channel is exhausted.  The parties may then reset the payment channels, creating a new invalidation transaction with a relative lock time of 99 days that redistributes the money correctly, but with the unidirectional payment channels reset.&lt;br /&gt;
&lt;br /&gt;
The payment channel may be closed at any time by either party (without the help of the other) by broadcasting the kickoff transaction on the blockchain.  In case of such a unilateral close, both parties must wait out the relative lock times until they can broadcast the payment channel finalization transactions.&lt;br /&gt;
&lt;br /&gt;
Parties should prefer the bilateral (cooperative) close, which collapses the kickoff, invalidation tree, and payment channel transactions into a single simple transaction that pays out the funds to both parties.&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels have indefinite lifetime, but there is a limit on number of updates possible due to the invalidation tree.  This limit can be multiplied by adding additional layers to the invalidation tree, with resetting of the lower layers.  Finally, in case of a unilateral close duplex payment channels require significant wait times and significant number of transactions to be published on the blockchain.&lt;br /&gt;
&lt;br /&gt;
The invalidation tree structure may actually have more than two participants; it would be possible for groups of 3 or more parties to build multiple payment channels between them that are backed by this invalidation tree structure, and to rebalance their payment channels without hitting the blockchain.&amp;lt;ref name=&#039;scaling_funding_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/a20a865ce40d40c8f942cf206a7cba96/Scalable_Funding_Of_Blockchain_Micropayment_Networks%20(1).pdf Scalable Funding of Bitcoin Micropayment Channel Networks]&amp;lt;/ref&amp;gt;  It would also be possible for the invalidation tree structure to fund Poon-Dryja rather than pairs of unidirectional payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64283</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64283"/>
		<updated>2017-11-23T15:01:37Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: /* Decker-Wattenhofer duplex payment channels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Wattenhofer duplex payment channels ===&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels were presented in a paper&amp;lt;ref name=&#039;duplex_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels] Decker, C.; Wattenhofer, R.&amp;lt;/ref&amp;gt; by Christian Decker and Roger Wattenhofer.  This type of payment channel requires the new BIP68&amp;lt;ref name=&#039;bip68&#039;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68]&amp;lt;/ref&amp;gt; meaning of nSequence.  As the name implies, a duplex payment channel is composed of two unidirectional payment channels, one in both directions.  The unidirectional payment channels are essentially Spillman channels, but using relative lock time (nSequence) instead of nLockTime.&lt;br /&gt;
&lt;br /&gt;
However, instead of funding unidirectional payment channels directly from an on-chain funding transaction, there is an &amp;quot;invalidation tree&amp;quot; of off-chain transactions between the funding transaction and the payment channel finalization transactions.  The invalidation tree transactions also use relative lock time; the first version of the transaction has a large relative lock time, and the next version of the transaction (which &#039;&#039;invalidates&#039;&#039; the first) uses a slightly smaller relative lock time, and so on.  There is also a &amp;quot;kick-off&amp;quot; transaction that starts the timeout for the relative locktime.  The sequence of transactions is thus: funding -&amp;gt; kickoff -&amp;gt; invalidation tree -&amp;gt; payment channel.&lt;br /&gt;
&lt;br /&gt;
Initially, the invalidation transaction may have a relative lock time of 100 days, and then its outputs go to two unidirectional payment channels, one in either direction.  Both parties may then use the payment channels until one channel is exhausted.  The parties may then reset the payment channels, creating a new invalidation transaction with a relative lock time of 99 days that redistributes the money correctly, but with the unidirectional payment channels reset.&lt;br /&gt;
&lt;br /&gt;
The payment channel may be closed at any time by either party (without the help of the other) by broadcasting the kickoff transaction on the blockchain.  In case of such a unilateral close, both parties must wait out the relative lock times until they can broadcast the payment channel finalization transactions.&lt;br /&gt;
&lt;br /&gt;
Parties should prefer the bilateral (cooperative) close, which collapses the kickoff, invalidation tree, and payment channel transactions into a single simple transaction that pays out the funds to both parties.&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels have indefinite lifetime, but there is a limit on number of updates possible due to the invalidation tree.  This limit can be multiplied by adding additional layers to the invalidation tree, with resetting of the lower layers.  Finally, in case of a unilateral close duplex payment channels require significant wait times and significant number of transactions to be published on the blockchain.&lt;br /&gt;
&lt;br /&gt;
The invalidation tree structure may actually have more than two participants; it would be possible for groups of 3 or more parties to build multiple payment channels between them that are backed by this invalidation tree structure, and to rebalance their payment channels without hitting the blockchain.&amp;lt;ref name=&#039;scaling_funding_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/a20a865ce40d40c8f942cf206a7cba96/Scalable_Funding_Of_Blockchain_Micropayment_Networks%20(1).pdf Scalable Funding of Bitcoin Micropayment Channel Networks]&amp;lt;/ref&amp;gt;  It would also be possible for the invalidation tree structure to fund Poon-Dryja rather than pairs of unidirectional payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64282</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64282"/>
		<updated>2017-11-23T15:00:25Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Wattenhofer duplex payment channels ===&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels were presented in a paper&amp;lt;ref name=&#039;duplex_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels] Decker, C.; Wattenhofer, R.&amp;lt;/ref&amp;gt; by Christian Decker and Roger Wattenhofer.  This type of payment channel requires the new BIP68&amp;lt;ref name=&#039;bip68&#039;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68]&amp;lt;/ref&amp;gt; meaning of nSequence.  As the name implies, a duplex payment channel is composed of two unidirectional payment channels, one in both directions.  The unidirectional payment channels are essentially Spillman channels, but using relative lock time (nSequence) instead of nLockTime.&lt;br /&gt;
&lt;br /&gt;
However, instead of funding unidirectional payment channels directly from an on-chain funding transaction, there is an &amp;quot;invalidation tree&amp;quot; of off-chain transactions between the funding transaction and the payment channel finalization transactions.  The invalidation tree transactions also use relative lock time; the first version of the transaction has a large relative lock time, and the next version of the transaction (which &#039;&#039;invalidates&#039;&#039; the first) uses a slightly smaller relative lock time, and so on.  There is also a &amp;quot;kick-off&amp;quot; transaction that starts the timeout for the relative locktime.  The sequence of transactions is thus: funding -&amp;gt; kickoff -&amp;gt; invalidation tree -&amp;gt; payment channel.&lt;br /&gt;
&lt;br /&gt;
Initially, the invalidation transaction may have a relative lock time of 100 days, and then its outputs go to two unidirectional payment channels, one in either direction.  Both parties may then use the payment channels until one channel is exhausted.  The parties may then reset the payment channels, creating a new invalidation transaction with a relative lock time of 99 days that redistributes the money correctly, but with the unidirectional payment channels reset.&lt;br /&gt;
&lt;br /&gt;
The payment channel may be closed at any time by either party (without the help of the other) by broadcasting the kickoff transaction on the blockchain.  In case of such a unilateral close, both parties must wait out the relative lock times until they can broadcast the payment channel finalization transactions.&lt;br /&gt;
&lt;br /&gt;
Parties should prefer the bilateral (cooperative) close, which collapses the kickoff, invalidation tree, and payment channel transactions into a single simple transaction that pays out the funds to both parties.&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels have indefinite lifetime, but there is a limit on number of updates possible due to the invalidation tree.  This limit can be multiplied by adding additional layers to the invalidation tree, with resetting of the lower layers.  Finally, in case of a unilateral close duplex payment channels require significant wait times and significant number of transactions to be published on the blockchain.&lt;br /&gt;
&lt;br /&gt;
The invalidation tree structure may actually have more than two participants; it would be possible for groups of 3 or more parties to build multiple payment channels between them that are backed by this invalidation tree structure, and to rebalance their payment channels without hitting the blockchain.&amp;lt;ref name=&#039;scaling_funding_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/a20a865ce40d40c8f942cf206a7cba96/Scalable_Funding_Of_Blockchain_Micropayment_Networks%20(1).pdf Scalable Funding of Bitcoin Micropayment Channel Networks]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64281</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64281"/>
		<updated>2017-11-23T14:22:09Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: /* Poon-Dryja payment channels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64280</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64280"/>
		<updated>2017-11-23T14:17:12Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64279</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64279"/>
		<updated>2017-11-23T14:07:38Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: /* Spillman-style payment channels */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and both parties need to finalize the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CLTV-style payment channels expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64278</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64278"/>
		<updated>2017-11-23T13:56:13Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and both parties need to finalize the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CLTV-style payment channels expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64277</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=64277"/>
		<updated>2017-11-23T13:51:21Z</updated>

		<summary type="html">&lt;p&gt;Almkglor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and both parties need to finalize the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CLTV-style payment channels expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Almkglor</name></author>
	</entry>
</feed>