Bitcoin Forum
June 24, 2021, 12:34:29 AM *
News: Latest Bitcoin Core release: 0.21.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why check for pchMessageStart in blocks?  (Read 62 times)
dnprock
Member
**
Offline Offline

Activity: 322
Merit: 15

Bitflate developer


View Profile WWW
January 24, 2021, 01:36:06 AM
 #1

I notice there's a check for message_start in the function ReadRawBlockFromDisk.

https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1207

If I understand correctly, message_start is used to identify Bitcoin Core clients.

https://bitcointalk.org/index.php?topic=2997687.0

Why does the function ReadRawBlockFromDisk check for message_start? Does that mean message_start is also written into blocks?

Thanks.
Be very wary of relying on JavaScript for security on sites such as blockchain.info and brainwallet.org. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
ranochigo
Legendary
*
Offline Offline

Activity: 2380
Merit: 2238

@ me if you need my response


View Profile
January 24, 2021, 03:36:41 AM
 #2

The magic bytes are prepended at the start of the blocks on the disk and are in a sense delimiters for the blocks represented on the disk. The magic bytes are not related to the block itself but it's included with every block in the blk.dat[1]. They are not a component in the blocks itself, per se.

It doesn't mean that the magic bytes can only appear at the start of the block though, they could also appear in the middle of the blocks as some arbitrary data.

[1] https://en.bitcoin.it/wiki/Block#Block_structure

dnprock
Member
**
Offline Offline

Activity: 322
Merit: 15

Bitflate developer


View Profile WWW
January 24, 2021, 06:32:37 AM
 #3

ranochigo, thanks for the quick response and link.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!