|
| 1 | +<pre> |
| 2 | + BIP: ??? |
| 3 | + Layer: Peer Services |
| 4 | + Title: WTXID-based transaction relay |
| 5 | + Author: Suhas Daftuar < [email protected]> |
| 6 | + Comments-Summary: No comments yet. |
| 7 | + Comments-URI: |
| 8 | + Status: Draft |
| 9 | + Type: Standards Track |
| 10 | + Created: 2020-02-03 |
| 11 | + License: BSD-2-Clause |
| 12 | +</pre> |
| 13 | + |
| 14 | +==Abstract== |
| 15 | + |
| 16 | +This BIP describes two changes to the p2p protocol to support transaction relay |
| 17 | +based on the BIP 141 wtxid of a transaction, rather than its txid. |
| 18 | + |
| 19 | +==Motivation== |
| 20 | + |
| 21 | +Historically, the INV messages sent on the Bitcoin peer-to-peer network to |
| 22 | +announce transactions refer to transactions by their txid, which is a hash of |
| 23 | +the transaction that does not include the witness (see BIP 141). This has been |
| 24 | +the case even since Segregated Witness (BIP 141/143/144) has been adopted by |
| 25 | +the network. |
| 26 | + |
| 27 | +Not committing to the witness in transaction announcements creates |
| 28 | +inefficiencies: because a transaction's witness can be malleated without |
| 29 | +altering the txid, a node in receipt of a witness transaction that the node |
| 30 | +does not accept will generally still download that same transaction when |
| 31 | +announced by other peers. This is because the alternative -- of not downloading |
| 32 | +a given txid after rejecting a transaction with that txid -- would allow a |
| 33 | +third party to interfere with transaction relay by malleating a transaction's |
| 34 | +witness and announcing the resulting invalid transaction to nodes, preventing |
| 35 | +relay of the valid version of the transaction as well. |
| 36 | + |
| 37 | +We can eliminate this concern by using the wtxid in place of the txid when |
| 38 | +announcing and fetching transactions. |
| 39 | + |
| 40 | +==Specification== |
| 41 | + |
| 42 | +# A new wtxidrelay message is added, which is defined as an empty message where pchCommand == "wtxidrelay". |
| 43 | +# The protocol version of nodes implementing this BIP must be set to 70016 or higher. |
| 44 | +# The wtxidrelay message must be sent in response to a VERSION message from a peer whose protocol version is >= 70016, and prior to sending a VERACK. |
| 45 | +# A new inv type MSG_WTX (0x00000005) is added, for use in both INV messages and GETDATA requests, indicating that the hash being referenced is a transaction's wtxid. In the case of GETDATA requests, MSG_WTX implies that the transaction being requested should be serialized with witness as well, as described in BIP 144. |
| 46 | +# After a node has sent and received a "wtxidrelay" message to/from a given peer, the node is required to use the MSG_WTX inv-type when announcing transactions to that peer, or requesting announced transactions from that peer. |
| 47 | +
|
| 48 | +==Backward compatibility== |
| 49 | + |
| 50 | +As wtxid-based transaction relay is only enabled between peers that both support it, older clients remain fully compatible and interoperable after this change. |
| 51 | + |
| 52 | +==Implementation== |
| 53 | + |
| 54 | +https://github.com/bitcoin/bitcoin/pull/18044 |
| 55 | + |
| 56 | +==Copyright== |
| 57 | + |
| 58 | +This BIP is licensed under the 2-clause BSD license. |
0 commit comments