Adds a BIP for SENDTEMPLATE, GETTEMPLATE, TEMPLATE p2p messages. Discussion links:
https://delvingbitcoin.org/t/sharing-block-templates/1906
https://gnusha.org/pi/bitcoindev/aJvZwR_bPeT4LaH6@erisian.com.au/T/#u
Adds a BIP for SENDTEMPLATE, GETTEMPLATE, TEMPLATE p2p messages. Discussion links:
https://delvingbitcoin.org/t/sharing-block-templates/1906
https://gnusha.org/pi/bitcoindev/aJvZwR_bPeT4LaH6@erisian.com.au/T/#u
Post to bitcoindev group hasn’t made it through
fixed, published
11+ License: BSD-3-Clause
12+```
13+
14+## Abstract
15+
16+This BIP describes the use of [BIP-152 compact blocks][BIP-152] enccoding
0This BIP describes the use of [BIP-152 compact blocks][BIP-152] encoding
69+and should be the hash of a block made up of those transactions.
70+4. The transactions making up the payload of the template should be valid
71+as a block -- for example all unconfirmed parents of a transaction should be
72+included before the transaction, and consensus limits should be respected.
73+5. A block containing the transactions making up the payload must not
74+exceed four million weight units as defined in [BIP-141][BIP-141].
See discussion in the delving thread.
I think having two blocks of txs could make sense, but in adversarial situations it doubles the potential memory usage and it’s not immediately clear what would be a sensible way of addressing that.
My thought is that deploying a simple design and getting some real-world data to iterate on makes sense. You could update the specification to announce “SENDTEMPLATE 2” indicating you support v2, which indicates to your peers they can send you a “GETTEMPLATE 2” message requesting a 2MvB template rather than a 1MvB template, eg.
Likewise sending set differences through could make sense (and wouldn’t need the complexity of minisketch since the sender knows their own previous templates), but there’s still a lot of design space left, so getting real-world data also seems useful for resolving that. (Likewise an updated spec could allow SENDTEMPLATE 2D
to indicate deltas are supported, and GETTEMPLATE 2 $hash
could request a 2MvB template encoded as a delta against the previous template with hash $hash
)
47+3. If a node implements this BIP, it must send the `sendtemplate`
48+message after `version` and before `verack`.
49+
50+### `gettemplate`
51+
52+1. The `gettemplate` message is defined as a message with `pchCommand ==
Any reason to not also allocate a message ID from the range specific in BIP 324?
The guidelines specify that if a message is sent more than once per connection then a number you be allocated (IIUC both this and the template
message):
We recommend reserving 1-byte type IDs for message types that are sent more than once per direction per connection.
58+3. A `gettemplate` message must not be sent if a `sendtemplate` message
59+was not already received.
60+4. Upon receipt of a `gettemplate` message, a node may reply with a
61+`template` message.
62+
63+### `template`
blocktemplate
instead? Otherwise, at a glance the semantics of the message are ambiguous.
30+and (b) provides a way for transactions that may have dropped out of
31+nodes' mempools to be rebroadcast across the network by third parties,
32+potentially providing better privacy than if only the nodes directly
33+involved in the transaction would rebroadcast it.
34+
35+## Specification
Ah yeah I meant service flag 😅.
The service flag would also allow for peers to find other supporting peers via DNS queries.
14+```
15+
16+## Abstract
17+
18+This BIP describes the use of [BIP-152 compact blocks][BIP-152] encoding
19+for sharing block templates (ie, the next block's predicted transactions)
0for sharing block templates (i.e., the next block's predicted transactions)
78+[BIP-141][BIP-141]. Note that this is twice the block weight limit, and
79+does not include the overhead that assembling those transactions into
80+a block would involve (header, coinbase and tx count serialization),
81+so this can be slightly more than two blocks' worth of transactions.
82+6. After sending a `template` message, a node should accept a
83+`sendblocktxns` message that specify the template's `header` hash, and
0`sendblocktxns` message that specifies the template's `header` hash, and
83+`sendblocktxns` message that specify the template's `header` hash, and
84+respond with a `blocktxns` message including the appropriate transaction
85+data, exactly as if it had sent a `cmpctblock` message with the same
86+payload as the `template` message. It should be able to provide such
87+transactions for a moderate amount of time after sending a template
88+(eg, five minutes). If it cannot provide a correct `blocktxns` response,
0(e.g., five minutes). If it cannot provide a correct `blocktxns` response,
68+2. A `template` message may only be sent in response to a `gettemplate`
69+message.
70+3. The `header` hash included in the payload must be a unique hash,
71+and should be the hash of a block made up of those transactions.
72+4. The transactions making up the payload of the template should be
73+valid for block inclusion -- for example all unconfirmed parents of a
0valid for block inclusion -- for example, all unconfirmed parents of a
8+ Status: Draft
9+ Type: Standards Track
10+ Created: 2025-09-05
11+ License: BSD-3-Clause
12+ Post-History: https://gnusha.org/pi/bitcoindev/aJvZwR_bPeT4LaH6@erisian.com.au/T/#u
13+ https://delvingbitcoin.org/t/sharing-block-templates/1906
Requires: 141, 152
I may have overlooked it, but at first glance it looks like the draft is missing important specification on how to implement the goals set forth in the Motivation section. For instance, which peers to request templates from, when/how often, and how the template data is to be used. (Perhaps also limits on memory use for storing templates and/or how this interacts with the -maxmempool limits.) Do you intend to add these to the Specification or Recommendations section, or for a separate BIP?
A few non-blocking comments follow.
124+ * adding a payload to the `gettemplate` message so that peers can
125+ indicate they will accept a new encoding of the template
126+ * adding a payload to the `sendtemplate` message to indicate that the
127+ `gettemplate` payload will be accepted
128+
129+## Recommendations
Perhaps this could use some recommendations re privacy implications?
IIRC, there was some push back augments devs re BIP 35 (mempool
message), as it can be used to implement relay correlation and tagging attacks against peers. As the message enables a peer to obtain the entire mempool of another peer, it can feasibly be used by an adversary to figure out: who relayed what, which transactions may have originated directly from the node, etc.
Some related PRs from the bitcoind repo:
mempool
message (white list applied), the start of some of the inv trickle/batch re address privacy concernsAlso pool operators may want to filter out transactions that they received via out of band transaction submission.
As the message enables a peer to obtain the entire mempool of another peer, it can feasibly be used by an adversary to figure out: who relayed what, which transactions may have originated directly from the node, etc.
Are you here talking about the mempool
message or this proposal? It seems to me that the top two blocks of the mempool would be significantly more difficult/expensive to exploit for fingerprinting than the whole mempool, especially if nodes repeatedly use this new peer service to synchronize their top mempool as any new transactions that are received this way would be broadcast to peers.
I may have overlooked it, but at first glance it looks like the draft is missing important specification on how to implement the goals set forth in the Motivation section. For instance, which peers to request templates from, when/how often, and how the template data is to be used.
I see those as implementation quality issues, which would be added in the “recommendations” section, once it’s more clear what those recommendations should be.
mempool
message
Could the editors please clarify which of these concerns are blockers for merging this BIP in “Draft” status?
I don’t perceive the stated concerns as blockers, but agree that this document should be enhanced in the future with further discussion of privacy implications. I’m gonna wait for a few days to allow time for others to comment.
that this document should be enhanced in the future with further discussion of privacy implications.
That’s what the “TBA” in the otherwise empty recommendations section is for (as well as efficiency implications and potentially other things)
Could the editors please clarify which of these concerns are blockers for merging this BIP in “Draft” status?
I’ve been told some editors are privately blocking merge of this PR despite being unwilling to identify any issues as blockers publicly. I don’t think that’s appropriate, or in accordance with the BIP 2 process, so I’m instead requesting this PR be merged now as-is, publishing the BIP as a draft so it can be easily referenced for further discussion and exploration.