Title: pchMessageStart - what is for? (in BC 0.8) Post by: Many Coins on February 22, 2018, 12:56:55 PM Hello!
Tell me please, what is for: Code: pchMessageStart[0] = 0xfc; and Code: pchMessageStart[4] = { 0xfb, 0xc0, 0xb6, 0xdb }; What does it do? Thank you! Title: Re: pchMessageStart - what is for? (in BC 0.8) Post by: achow101 on February 22, 2018, 04:12:54 PM Those are the magic bytes. They prepend every single network message so that the message can be identified as being a Bitcoin message.
Title: Re: pchMessageStart - what is for? (in BC 0.8) Post by: Many Coins on February 23, 2018, 06:38:11 AM Those are the magic bytes. They prepend every single network message so that the message can be identified as being a Bitcoin message. Is it different from, for example, litecoin? But why? Because they have different genesis blocks and seed-nodes, they will not be confused in any way. And are these values arbitrary? Or are there any rules for choosing them? Title: Re: pchMessageStart - what is for? (in BC 0.8) Post by: Xynerise on February 23, 2018, 07:31:03 AM Is it different from, for example, litecoin? But why? Because they have different genesis blocks and seed-nodes, they will not be confused in any way. Apparently Litecoin and Viacoin (the only 2 bitcoin code forks I checked) have the same magic bytes:Code: pchMessageStart[0] = 0xfb; Quote And are these values arbitrary? Or are there any rules for choosing them? The same file linked above has this comment:Code: The message start string is designed to be unlikely to occur in normal data. Title: Re: pchMessageStart - what is for? (in BC 0.8) Post by: Many Coins on February 23, 2018, 07:28:45 PM Apparently Litecoin and Viacoin (the only 2 bitcoin code forks I checked) have the same magic bytes: why not :) Title: Re: pchMessageStart - what is for? (in BC 0.8) Post by: achow101 on February 24, 2018, 04:17:40 AM Is it different from, for example, litecoin? Yes.But why? Because they have different genesis blocks and seed-nodes, they will not be confused in any way. To make sure that there's no crosstalk or confusion in the first place as figuring out that they have different genesis blocks still costs bandwidth and computing power.And are these values arbitrary? Or are there any rules for choosing them? They're arbitrary. The common recommendation for new altcoins is to just randomly generate new magic bytes.Title: Re: pchMessageStart - what is for? (in BC 0.8) Post by: Many Coins on February 24, 2018, 10:41:40 AM But why? Because they have different genesis blocks and seed-nodes, they will not be confused in any way. To make sure that there's no crosstalk or confusion in the first place as figuring out that they have different genesis blocks still costs bandwidth and computing power.And are these values arbitrary? Or are there any rules for choosing them? They're arbitrary. The common recommendation for new altcoins is to just randomly generate new magic bytes.Thank you! It is clear now. |