Pieter Wuille [ARCHIVE] on Nostr: 📅 Original date posted:2022-10-26 📝 Original message:Hi all, On Saturday, ...
📅 Original date posted:2022-10-26
📝 Original message:Hi all,
On Saturday, October 8th, 2022 at 8:59 AM, Dhruv M <dhruv at bip324.com> wrote:
> We have refreshed the proposal for BIP324, a new bitcoin P2P protocol
> featuring opportunistic encryption, a mild bandwidth reduction, and the
> ability
> to negotiate upgrades before exchanging application messages. We'd like
> to invite community members to review the BIP[1] and the related Bitcoin
> Core
> code[2].
One open question we have regarding BIP324's design is how to deal with the
coordination of assigning the message type IDs.
For context, the current BIP324 draft introduces a notion of 1-byte message
type IDs, which take the place of the 12-byte command strings (in a backward
compatible way; it's still possible to send full strings). This offers a
mild bandwidth reduction (3 bytes per message overall), especially since many
messages on the network are fairly small.
However, it obviously raises the question of how the mapping table between the
1-byte IDs and the commands they represent should be maintained:
1. The most straightforward solution is using the BIP process as-is: let BIP324
introduce a fixed initial table, and future BIPs which introduce new
messages can introduce new mapping entries for it. In theory, this is no
worse than the current coordination difficulty about command strings, but
in practice the risk of collisions due to competing proposals is of course
significantly larger with 1-byte IDs vs. 12-byte strings.
2. An alternative approach is not using 1-byte IDs but slightly longer ones;
for example 3-byte IDs, each consisting of a 2-byte BIP number and a 1-byte
message index introduced by that BIP, at the cost of a smaller bandwidth
improvement. This significantly reduces collision risks, but doesn't remove
the coordination process concerns entirely (e.g. revisions changing what a
BIP introduces need to be taken into account and probably still mean BIPs
need to explicitly list which assignments they introduce).
3. Yet another possibility is not having a fixed table at all, and negotiate
the mapping dynamically. E.g. either side could send a message at
connection time with an explicit table of entries "when I send byte X, I
mean command Y".
4. Lastly, the whole feature could just be dropped from BIP324 (sticking with
command strings), and left for a follow-up (or independent) protocol
improvement. Since arguably this is purely an application-layer concern and
not a transport-layer one, it could even be added as an optional feature to
the (pre-BIP324) protocol today. That would however very likely mean that
BIP324 if adopted as-is isn't actually an (albeit small) bandwidth
reduction compared to today, and forego a possibility to fix a fairly
gratuitous inefficiency in the protocol from day one.
Our idea is to start out with approach (1), with a mapping table effectively
managed by the BIP process directly, but if and when collisions become a
concern (maybe due to many parallel proposals, maybe because the number of
messages just grows too big), switch to approach (3), possibly even
differentially (the sent mappings are just additions/overwrites of the
BIP-defined table mappings, rather than a full mapping).
That said, we're not all that convinced this is the best approach, and feel
this more a community/process question than a technical one, so it would be
good to see more opinions on the topic.
Cheers,
--
Dhruv, Pieter, Tim
Published at
2023-06-07 23:15:02Event JSON
{
"id": "d4f79aa0e7354cbf727f70da07e06d8e2d3102494415f392bac063a75c1d422a",
"pubkey": "5cb21bf5d7f25a9d46879713cbd32433bbc10e40ef813a3c28fe7355f49854d6",
"created_at": 1686179702,
"kind": 1,
"tags": [
[
"e",
"3afeacd7a7db7d2e3da01f7abfaa369c940862fffa3755a5339f9a36f3aa8c94",
"",
"root"
],
[
"e",
"5aeb715dbb0ddd2e364f6d0aa4273c088d2e27a12f8db1e0f76674576c899c56",
"",
"reply"
],
[
"p",
"5e51fd82c4f140da80669f67f87484540213839e8be8f93ee68584070089c0e1"
]
],
"content": "📅 Original date posted:2022-10-26\n📝 Original message:Hi all,\n\nOn Saturday, October 8th, 2022 at 8:59 AM, Dhruv M \u003cdhruv at bip324.com\u003e wrote:\n\n\u003e We have refreshed the proposal for BIP324, a new bitcoin P2P protocol\n\u003e featuring opportunistic encryption, a mild bandwidth reduction, and the\n\u003e ability\n\u003e to negotiate upgrades before exchanging application messages. We'd like\n\u003e to invite community members to review the BIP[1] and the related Bitcoin\n\u003e Core\n\u003e code[2].\n\nOne open question we have regarding BIP324's design is how to deal with the\ncoordination of assigning the message type IDs.\n\nFor context, the current BIP324 draft introduces a notion of 1-byte message\ntype IDs, which take the place of the 12-byte command strings (in a backward\ncompatible way; it's still possible to send full strings). This offers a\nmild bandwidth reduction (3 bytes per message overall), especially since many\nmessages on the network are fairly small.\n\nHowever, it obviously raises the question of how the mapping table between the\n1-byte IDs and the commands they represent should be maintained:\n\n1. The most straightforward solution is using the BIP process as-is: let BIP324\n introduce a fixed initial table, and future BIPs which introduce new\n messages can introduce new mapping entries for it. In theory, this is no\n worse than the current coordination difficulty about command strings, but\n in practice the risk of collisions due to competing proposals is of course\n significantly larger with 1-byte IDs vs. 12-byte strings.\n\n2. An alternative approach is not using 1-byte IDs but slightly longer ones;\n for example 3-byte IDs, each consisting of a 2-byte BIP number and a 1-byte\n message index introduced by that BIP, at the cost of a smaller bandwidth\n improvement. This significantly reduces collision risks, but doesn't remove\n the coordination process concerns entirely (e.g. revisions changing what a\n BIP introduces need to be taken into account and probably still mean BIPs\n need to explicitly list which assignments they introduce).\n\n3. Yet another possibility is not having a fixed table at all, and negotiate\n the mapping dynamically. E.g. either side could send a message at\n connection time with an explicit table of entries \"when I send byte X, I\n mean command Y\".\n\n4. Lastly, the whole feature could just be dropped from BIP324 (sticking with\n command strings), and left for a follow-up (or independent) protocol\n improvement. Since arguably this is purely an application-layer concern and\n not a transport-layer one, it could even be added as an optional feature to\n the (pre-BIP324) protocol today. That would however very likely mean that\n BIP324 if adopted as-is isn't actually an (albeit small) bandwidth\n reduction compared to today, and forego a possibility to fix a fairly\n gratuitous inefficiency in the protocol from day one.\n\nOur idea is to start out with approach (1), with a mapping table effectively\nmanaged by the BIP process directly, but if and when collisions become a\nconcern (maybe due to many parallel proposals, maybe because the number of\nmessages just grows too big), switch to approach (3), possibly even\ndifferentially (the sent mappings are just additions/overwrites of the\nBIP-defined table mappings, rather than a full mapping).\n\nThat said, we're not all that convinced this is the best approach, and feel\nthis more a community/process question than a technical one, so it would be\ngood to see more opinions on the topic.\n\nCheers,\n\n-- \nDhruv, Pieter, Tim",
"sig": "1e52a4fa8bac3f7e08ab2098970255390e30073d488ff3ccc4fcccd5a5534bda6f3475614adcc1167768566f0361f5dfea1c17953a78e4571ce38766f58238c7"
}