Bitcoin Forum
November 16, 2024, 08:44:41 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What does "pchMessage" mean ?  (Read 644 times)
cudjex (OP)
Sr. Member
****
Offline Offline

Activity: 507
Merit: 252


View Profile
February 02, 2014, 05:45:46 PM
 #1

Hey

I'm trying to understand some things about coins.

When I look to Saturncoin's main.cpp, pchMessage value is :a
Code:
unsigned char pchMessageStart[4] = { 0xfa, 0xb4, 0xad, 0xcb }; 
In Litecoin's main.cpp :
Code:
unsigned char pchMessageStart[4] = { 0xfb, 0xc0, 0xb6, 0xdb };
In Dogecoin :
Code:
unsigned char pchMessageStart[4] = { 0xc0, 0xc0, 0xc0, 0xc0 };

So what is this and how it works ?

cudjex (OP)
Sr. Member
****
Offline Offline

Activity: 507
Merit: 252


View Profile
February 02, 2014, 08:17:13 PM
 #2

Nobody knows this ?
jimhsu
Sr. Member
****
Offline Offline

Activity: 364
Merit: 264


View Profile
February 02, 2014, 08:26:41 PM
 #3

These are the magic bytes. They serve a variety of purposes, including indicating the proper network, and serving as a start for explorers such as Abe to parse. Some altcoins that don't change the magic bytes (n00b launches) have problems such as trying to download the litecoin blockchain on start.

As for what "pchMessage" means exactly, I don't know.

For more info, see http://james.lab6.com/2012/01/12/bitcoin-285-bytes-that-changed-the-world/

Dans les champs de l'observation le hasard ne favorise que les esprits préparé
cudjex (OP)
Sr. Member
****
Offline Offline

Activity: 507
Merit: 252


View Profile
February 02, 2014, 08:38:04 PM
 #4


Thanks for your clarification jimhsu. I didn't know it's affecting to download different blockchain.
Sharrow
Member
**
Offline Offline

Activity: 66
Merit: 10


View Profile
February 02, 2014, 08:51:21 PM
Last edit: February 02, 2014, 09:17:58 PM by Sharrow
 #5

These entries should always be altered when creating an altcoin otherwise there could be cross-talk with other currencies using similar code. It's best to do it right at the very start, before the genesis hash is created and the coin is released otherwise you will have a major fork to deal with.

One way to do it is to go to an online hexadecimal converter and use it to produce random characters for the end of your pchMessage 0x?? strings. Think up four random numbers between 0 and 255 and convert them from decimal to hex i.e. 177 = b1, 223 = df.

Change the last part of your 0x?? strings to your new values and make sure it's done for the main network in main.cpp.
cudjex (OP)
Sr. Member
****
Offline Offline

Activity: 507
Merit: 252


View Profile
February 02, 2014, 09:39:03 PM
 #6

These entries should always be altered when creating an altcoin otherwise there could be cross-talk with other currencies using similar code. It's best to do it right at the very start, before the genesis hash is created and the coin is released otherwise you will have a major fork to deal with.

One way to do it is to go to an online hexadecimal converter and use it to produce random characters for the end of your pchMessage 0x?? strings. Think up four random numbers between 0 and 255 and convert them from decimal to hex i.e. 177 = b1, 223 = df.

Change the last part of your 0x?? strings to your new values and make sure it's done for the main network in main.cpp.


Thanks for your great answer.
nibyokwy
Newbie
*
Offline Offline

Activity: 51
Merit: 0


View Profile
February 02, 2014, 10:30:55 PM
 #7

As for what "pchMessage" means exactly, I don't know.
the 'pch' is hungarian notation and usually means 'pointer to character'. it's a way of encoding the type of the variable in the variable name to make readers of the code understand the intended types easier.
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!