Tom Zander [ARCHIVE] on Nostr: 📅 Original date posted:2016-05-09 📝 Original message:On Sunday, May 08, 2016 ...
📅 Original date posted:2016-05-09
📝 Original message:On Sunday, May 08, 2016 03:24:22 AM Matt Corallo wrote:
> >> ===Intended Protocol Flow===
> >
> > I'm not a fan of the solution that a CNode should keep state and talk to
> > its remote nodes differently while announcing new blocks.
> > Its too complicated and ultimately counter-productive.
> >
> > The problem is that an individual node needs to predict network behaviour
> > in advance. With the downside that if it guesses wrong that both nodes
> > end up paying for the wrong guess.
> > This is not a good way to design a p2p layer.
>
> Nodes don't need to predict much in advance, and the cost for predicting
> wrong is 0 if your peers receive blocks with a few hundred ms between
> them (as we should expect) and you haven't set the announce bit on more
> than a few peers (as the spec requires for this reason).
You misunderstand the networking effects.
The fact that your node is required to choose which one to set the announce
bit on implies that it needs to predict which node will have the best data in
the future.
It needs to predict which nodes will not start being incommunicado and it
requires them to predict all the things that are not possible to predict in a
network.
In networking it is even more true than in stocks; results of the past are no
guarantee for the future.
This means you are creating a fragile system. Your system will only work in
laboratory situations. It will fail spectacularly when the network or the
internet is under stress or some parts fall away.
Another problem with your solution is that nodes send a much larger amount of
unsolicited data to peers in the form of the thin-block compared to the normal
inv or header-first data.
Saying this is mitigated by only subscribing on this data from a small
subsection of nodes means you position yourself in a situation that I
displayed above. A tradeoff of fragile and fast. With no possible way to make
a node automatically decide on a good equilibrium.
> It seems I forgot to add a suggested peer-preforwarding-selection
> algorithm in the text, but the intended use-case is to set the bit on
> peers which recently provided you blocks faster than other peers, up to
> only one or three peers. This is both simple and should be incredibly
> effective.
Network autorepair systems have been researched for decades, no real solution
has as of yet appeared.
PHDs are written on the subject and you want to make this a design for Bitcoin
based on "[it] should be incredibly effective", I think you are underestimating
the subject matter you are dealing with.
> > I would suggest that a new block is announced to all nodes equally and
> > then
> > individual nodes can respond with a request of either a 'compact' or a
> > normal block.
> > This is much more in line with the current design as well.
> >
> > Detection if remote nodes support compact blocks, for the purpose of
> > requesting a compact-block, can be done either via a network-bit or just a
> > protocol version. Or something else entirely, if you have better
> > suggestions.
>
> In line with recent trends, neither service bits nor protocol versions
> are particularly well-suited for this purpose.
Am I to understand that you choose the solution based on the fact that service
bits are too expensive to extend? (if not, please respond to my previous
question actually answering the suggestion)
That sounds like a rather bad way of doing design. Maybe you can add a second
service bits field of message instead and then do the compact blocks correctly.
> >> Variable-length integers: bytes are a MSB base-128 encoding of the
> >> number.
> >> The high bit in each byte signifies whether another digit follows.
> >> [snip bitwise spec]
> >
> > I suggest just referring to UTF-8 which describes this just fine.
> > it is good practice to refer to existing specs when possible and not copy
> > the details.
>
> Hmm? There is no UTF anywhere in this protocol. Indeed this section
> needs to be rewritten, as indicated. I'd recommend you read the code
> until I update the section with better text if you're confused.
Wait, you didn't steal the variable length encoding from an existing standard
and you programmed a new one?
I strongly suggest you don't reinvent this kind of protocol level encodings
but instead steal from something like UTF8. Which has been around for decades.
Please base your standard on other standards where possible.
Look at UTF-8 on wikipedia, you may have "invented" the same encoding that IBM
published in 1992.
> >> ====Short transaction IDs====
> >> Short transaction IDs are used to represent a transaction without
> >> sending a full 256-bit hash. They are calculated by:
> >> # single-SHA256 hashing the block header with the nonce appended (in
> >> little-endian)
> >> # XORing each 8-byte chunk of the double-SHA256 transaction hash with
> >> each corresponding 8-byte chunk of the hash from the previous step
> >> # Adding each of the XORed 8-byte chunks together (in little-endian)
> >> iteratively to find the short transaction ID
> >
> > I don't think this is needed. Just use the first 8 bytes.
> > The reason to do xor-ing doesn't hold up and extra complexity is unneeded.
> > Especially since you mention some lines down;
> >
> >> The short transaction ID calculation is designed to take absolutely
> >> minimal processing time during block compaction to avoid introducing
> >> serious DoS vulnerabilities
>
> I'm confused as to what, specifically, you're proposing this be changed
> to.
Just the first (highest) 8 bytes of a sha256 hash.
The amount of collisions will not be less if you start xoring the rest.
The whole reason for doing this extra work is also irrelevant as a spam
protection.
--
Tom Zander
Published at
2023-06-07 17:50:17Event JSON
{
"id": "b437b31e94ea2c769e754e0c8df6d79fafceab6bdfff47cf54fd77a2bbf1012c",
"pubkey": "dcb947d818dbfd7cf0baf26c0d5eb606b5a32336c5483fb53e05146315833ca7",
"created_at": 1686160217,
"kind": 1,
"tags": [
[
"e",
"37fe3d2b857e9599a14c87e34f77dee62e90bb6721200fbd7752c60823834c1e",
"",
"root"
],
[
"e",
"00004902145937fa62bc6c239527c736d61a838b87ee0c23bd71c4d87c7b70b7",
"",
"reply"
],
[
"p",
"cd753aa8fbc112e14ffe9fe09d3630f0eff76ca68e376e004b8e77b687adddba"
]
],
"content": "📅 Original date posted:2016-05-09\n📝 Original message:On Sunday, May 08, 2016 03:24:22 AM Matt Corallo wrote:\n\u003e \u003e\u003e ===Intended Protocol Flow===\n\u003e \u003e \n\u003e \u003e I'm not a fan of the solution that a CNode should keep state and talk to\n\u003e \u003e its remote nodes differently while announcing new blocks.\n\u003e \u003e Its too complicated and ultimately counter-productive.\n\u003e \u003e \n\u003e \u003e The problem is that an individual node needs to predict network behaviour\n\u003e \u003e in advance. With the downside that if it guesses wrong that both nodes\n\u003e \u003e end up paying for the wrong guess.\n\u003e \u003e This is not a good way to design a p2p layer.\n\u003e \n\u003e Nodes don't need to predict much in advance, and the cost for predicting\n\u003e wrong is 0 if your peers receive blocks with a few hundred ms between\n\u003e them (as we should expect) and you haven't set the announce bit on more\n\u003e than a few peers (as the spec requires for this reason).\n\nYou misunderstand the networking effects.\nThe fact that your node is required to choose which one to set the announce \nbit on implies that it needs to predict which node will have the best data in \nthe future.\nIt needs to predict which nodes will not start being incommunicado and it \nrequires them to predict all the things that are not possible to predict in a \nnetwork.\nIn networking it is even more true than in stocks; results of the past are no \nguarantee for the future.\n\nThis means you are creating a fragile system. Your system will only work in \nlaboratory situations. It will fail spectacularly when the network or the \ninternet is under stress or some parts fall away.\n\n\nAnother problem with your solution is that nodes send a much larger amount of \nunsolicited data to peers in the form of the thin-block compared to the normal \ninv or header-first data.\n\nSaying this is mitigated by only subscribing on this data from a small \nsubsection of nodes means you position yourself in a situation that I \ndisplayed above. A tradeoff of fragile and fast. With no possible way to make \na node automatically decide on a good equilibrium.\n\n\n\u003e It seems I forgot to add a suggested peer-preforwarding-selection\n\u003e algorithm in the text, but the intended use-case is to set the bit on\n\u003e peers which recently provided you blocks faster than other peers, up to\n\u003e only one or three peers. This is both simple and should be incredibly\n\u003e effective.\n\nNetwork autorepair systems have been researched for decades, no real solution \nhas as of yet appeared. \nPHDs are written on the subject and you want to make this a design for Bitcoin \nbased on \"[it] should be incredibly effective\", I think you are underestimating \nthe subject matter you are dealing with.\n\n\n\u003e \u003e I would suggest that a new block is announced to all nodes equally and\n\u003e \u003e then\n\u003e \u003e individual nodes can respond with a request of either a 'compact' or a\n\u003e \u003e normal block.\n\u003e \u003e This is much more in line with the current design as well.\n\u003e \u003e \n\u003e \u003e Detection if remote nodes support compact blocks, for the purpose of\n\u003e \u003e requesting a compact-block, can be done either via a network-bit or just a\n\u003e \u003e protocol version. Or something else entirely, if you have better\n\u003e \u003e suggestions.\n\u003e \n\u003e In line with recent trends, neither service bits nor protocol versions\n\u003e are particularly well-suited for this purpose.\n\nAm I to understand that you choose the solution based on the fact that service \nbits are too expensive to extend? (if not, please respond to my previous \nquestion actually answering the suggestion)\n\nThat sounds like a rather bad way of doing design. Maybe you can add a second \nservice bits field of message instead and then do the compact blocks correctly.\n\n\n\u003e \u003e\u003e Variable-length integers: bytes are a MSB base-128 encoding of the\n\u003e \u003e\u003e number.\n\u003e \u003e\u003e The high bit in each byte signifies whether another digit follows.\n\u003e \u003e\u003e [snip bitwise spec]\n\u003e \u003e \n\u003e \u003e I suggest just referring to UTF-8 which describes this just fine.\n\u003e \u003e it is good practice to refer to existing specs when possible and not copy\n\u003e \u003e the details.\n\u003e \n\u003e Hmm? There is no UTF anywhere in this protocol. Indeed this section\n\u003e needs to be rewritten, as indicated. I'd recommend you read the code\n\u003e until I update the section with better text if you're confused.\n\nWait, you didn't steal the variable length encoding from an existing standard \nand you programmed a new one?\nI strongly suggest you don't reinvent this kind of protocol level encodings \nbut instead steal from something like UTF8. Which has been around for decades.\n\nPlease base your standard on other standards where possible.\n\nLook at UTF-8 on wikipedia, you may have \"invented\" the same encoding that IBM \npublished in 1992.\n\n\n\u003e \u003e\u003e ====Short transaction IDs====\n\u003e \u003e\u003e Short transaction IDs are used to represent a transaction without\n\u003e \u003e\u003e sending a full 256-bit hash. They are calculated by:\n\u003e \u003e\u003e # single-SHA256 hashing the block header with the nonce appended (in\n\u003e \u003e\u003e little-endian)\n\u003e \u003e\u003e # XORing each 8-byte chunk of the double-SHA256 transaction hash with\n\u003e \u003e\u003e each corresponding 8-byte chunk of the hash from the previous step\n\u003e \u003e\u003e # Adding each of the XORed 8-byte chunks together (in little-endian)\n\u003e \u003e\u003e iteratively to find the short transaction ID\n\u003e \u003e \n\u003e \u003e I don't think this is needed. Just use the first 8 bytes.\n\u003e \u003e The reason to do xor-ing doesn't hold up and extra complexity is unneeded.\n\u003e \u003e Especially since you mention some lines down;\n\u003e \u003e \n\u003e \u003e\u003e The short transaction ID calculation is designed to take absolutely\n\u003e \u003e\u003e minimal processing time during block compaction to avoid introducing\n\u003e \u003e\u003e serious DoS vulnerabilities\n\u003e \n\u003e I'm confused as to what, specifically, you're proposing this be changed\n\u003e to.\n\nJust the first (highest) 8 bytes of a sha256 hash.\n\nThe amount of collisions will not be less if you start xoring the rest.\nThe whole reason for doing this extra work is also irrelevant as a spam \nprotection. \n\n-- \nTom Zander",
"sig": "ffcfef2896165332d5641e97f1e1da62a3a4cc06384c50f1e7dd824fd16bcbab4f04d2849647818e6a9748c2da696671b70b317bbe788565343a277684dc5817"
}