Transaction replacement: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Sgornick (talk | contribs)
→‎See Also: Add entry for Fee bumping, which is not related to RBF but is an alternative to RBF that might be considered.
Luke-jr (talk | contribs)
Updates
Line 7: Line 7:
transaction replaceability widely available again.<ref>[https://bitcointalk.org/index.php?topic=199947.0 Initial replace-by-fee implementation available for testnet], BitcoinTalk forum, posted 2013-05-09, ''retrieved 2015-12-09''</ref>
transaction replaceability widely available again.<ref>[https://bitcointalk.org/index.php?topic=199947.0 Initial replace-by-fee implementation available for testnet], BitcoinTalk forum, posted 2013-05-09, ''retrieved 2015-12-09''</ref>


Beginning with Bitcoin Core 0.12.0 (eta Feb 1 2016), it is expected
Beginning with Bitcoin Core 0.12.0 (released Feb 2016), one type of transaction replaceability, [[Replace by fee|replace-by-fee]] (RBF), became widely available.
that one type of transaction replaceability, [[Replace by fee|replace-by-fee]] (RBF), will become widely available. This page
This page
attempts to document the current state of transaction replaceability for
attempts to document the current state of transaction replaceability for
wallet authors who want to use that feature.
wallet authors who want to use that feature.
Line 16: Line 16:
Transaction replacement is optional (it is not, and cannot be,
Transaction replacement is optional (it is not, and cannot be,
a consensus rule), but widespread adherence to the same basic policy
a consensus rule), but widespread adherence to the same basic policy
among nodes will help maintain a consistent network-wide mempool policy
among nodes can help predict a popular network-wide mempool policy
with the following expected benefits:
with the following expected benefits:


Line 27: Line 27:
=== Bitcoin Core 0.3.12 to 0.11.x ===
=== Bitcoin Core 0.3.12 to 0.11.x ===


Transaction replaceability is disallowed in a running node.
Transaction replacability is disallowed in a running node.


=== Bitcoin Core 0.12.0 ===
=== Bitcoin Core 0.12.0 to 0.16.0 ===


''Bitcoin Core 0.12.0 has been released in Feb 2016.''
''Bitcoin Core 0.12.0 was released in Feb 2016.''


Bitcoin Core 0.12.0 uses the initial implementation of opt-in full-RBF
Bitcoin Core 0.12.0 and later use the initial implementation of opt-in full-RBF
described in [https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki BIP 125].
described in [https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki BIP 125].


Line 41: Line 41:
5891f870d68d90408aa5ce5b597fb574f2d2cbca to
5891f870d68d90408aa5ce5b597fb574f2d2cbca to
16a2f93629f75d182871f288f0396afe6cdc8504 (inclusive).
16a2f93629f75d182871f288f0396afe6cdc8504 (inclusive).
=== Bitcoin Knots ===
Bitcoin Knots allows the user to easily configure its replacement policy.
Opt-in RBF, full RBF, and strict first-seen policies are supported.


=== Peter Todd's full-RBF patchset ===
=== Peter Todd's full-RBF patchset ===
Line 47: Line 52:
0.8.x and later that implement full-RBF for all transactions in the
0.8.x and later that implement full-RBF for all transactions in the
mempool. (Later versions also provide an option to enable RBF First-Seen-Safe (RBF-FSS) only.)
mempool. (Later versions also provide an option to enable RBF First-Seen-Safe (RBF-FSS) only.)
A rebased version of the most recent patch is also available for
contemporary [http://luke.dashjr.org/programs/bitcoin-ljr/ Bitcoin LJR] releases.


Notably, the patchset also implements preferential peering that allows
Notably, the patchset also implements preferential peering that allows
Line 54: Line 57:
can circulate even if full-RBF nodes represent a small minority of the
can circulate even if full-RBF nodes represent a small minority of the
network.
network.
As of 2015-12-08, there are no known large miners or mining pools that
implement full-RBF.


* [https://github.com/petertodd/bitcoin/branches/all?utf8=%E2%9C%93&query=replace-by-fee-v0.10 Replace by fee patches for Bitcoin Core 0.10.x]
* [https://github.com/petertodd/bitcoin/branches/all?utf8=%E2%9C%93&query=replace-by-fee-v0.10 Replace by fee patches for Bitcoin Core 0.10.x]

Revision as of 01:02, 6 March 2018

Transaction replaceability occurs when a full node allows one or more of the transactions in its memory pool (mempool) to be replaced with a different transaction that spends some or all of the same inputs. Transaction replaceability was enabled in the first version of Bitcoin[1] but was disabled in the 0.3.12 release with the comment, "Disable replacement feature for now".[2] Since then, there have been various attempts to make transaction replaceability widely available again.[3]

Beginning with Bitcoin Core 0.12.0 (released Feb 2016), one type of transaction replaceability, replace-by-fee (RBF), became widely available. This page attempts to document the current state of transaction replaceability for wallet authors who want to use that feature.

Node policies

Transaction replacement is optional (it is not, and cannot be, a consensus rule), but widespread adherence to the same basic policy among nodes can help predict a popular network-wide mempool policy with the following expected benefits:

  • Consistent policy makes it easy for wallet authors to write code that uses transaction replacement to provide usability-enhancing features.
  • Consistent policy helps ensure long-running mempools contain mostly the same transactions (mempool consistency), which makes it easier for wallets and nodes to make guesses about how long it will take a transaction to confirm.
  • Consistent mempools may help nodes more quickly validate newly-received blocks as well as reduce the bandwidth used to announce new blocks in the future.

Bitcoin Core 0.3.12 to 0.11.x

Transaction replacability is disallowed in a running node.

Bitcoin Core 0.12.0 to 0.16.0

Bitcoin Core 0.12.0 was released in Feb 2016.

Bitcoin Core 0.12.0 and later use the initial implementation of opt-in full-RBF described in BIP 125.

The initial implementation of opt-in full-RBF may be seen in Bitcoin Core PR#6871 and specifically the master branch commits from 5891f870d68d90408aa5ce5b597fb574f2d2cbca to 16a2f93629f75d182871f288f0396afe6cdc8504 (inclusive).

Bitcoin Knots

Bitcoin Knots allows the user to easily configure its replacement policy. Opt-in RBF, full RBF, and strict first-seen policies are supported.

Peter Todd's full-RBF patchset

Peter Todd has historically maintained patchsets against Bitcoin Core 0.8.x and later that implement full-RBF for all transactions in the mempool. (Later versions also provide an option to enable RBF First-Seen-Safe (RBF-FSS) only.)

Notably, the patchset also implements preferential peering that allows nodes implementing full-RBF to connect to each other so that replacements can circulate even if full-RBF nodes represent a small minority of the network.

Policy[4]: one or more transactions currently in the mempool (original transactions) will be replaced by a new transaction (replacement transaction) that spends one or more of the same inputs if,

  1. The replacement transaction pays an absolute higher fee than the original transactions.
  2. The replacement transaction must pay for its own bandwidth in addition to the amount paid by the original transactions at least by the rate set by the node's minimum relay fee setting. For example, if the minimum relay fee is 1 satoshi/byte and the replacement transaction is 500 bytes total, then the replacement must pay a fee at least 500 satoshis higher than the originals.
  3. No more than 100 original transactions are replaced by the replacement transaction

See Also

References

  1. Replacement in original Bitcoin source code, Satoshi Nakamoto, GitHub, Retrieved 2015-12-08
  2. Commit disabling replacement "for now", Satoshi Nakamoto, GitHub, Retrieved 2015-12-08
  3. Initial replace-by-fee implementation available for testnet, BitcoinTalk forum, posted 2013-05-09, retrieved 2015-12-09
  4. RBF patchset for 0.11.2, Peter Todd, GitHub, Retrieved 2015-12-08