Bitcoin Forum
May 05, 2024, 01:57:06 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What are these variables in the Genesis Block and how were they determined?  (Read 396 times)
the demon malloc (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 1


View Profile
September 26, 2017, 07:41:30 PM
Merited by ABCbits (1)
 #1

Hi all!

I'm currently writing a program to generate a genesis block for a new altcoin fork that I'm coding for fun. So far I've identified a couple of sources that I've been working from, notably Gnaf's GenesisBlockZero and of course the original v8 Bitcoin source.

However I'm stuck at figuring out what the scripSig and scriptPubKey represent in the genesis block and how they are determined. These can be found on lines 2779 and 2781 on the main.cpp code here:

https://github.com/bitcoin/bitcoin/blob/0.8/src/main.cpp

I'll paste them here for convenience:

 txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));

 txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;

Could anyone help me out in figuring out what the numbers in the first one mean. And for the second one, where is that hash from??

Thanks for your time.
According to NIST and ECRYPT II, the cryptographic algorithms used in Bitcoin are expected to be strong until at least 2030. (After that, it will not be too difficult to transition to different algorithms.)
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714917426
Hero Member
*
Offline Offline

Posts: 1714917426

View Profile Personal Message (Offline)

Ignore
1714917426
Reply with quote  #2

1714917426
Report to moderator
1714917426
Hero Member
*
Offline Offline

Posts: 1714917426

View Profile Personal Message (Offline)

Ignore
1714917426
Reply with quote  #2

1714917426
Report to moderator
1714917426
Hero Member
*
Offline Offline

Posts: 1714917426

View Profile Personal Message (Offline)

Ignore
1714917426
Reply with quote  #2

1714917426
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
September 26, 2017, 08:23:57 PM
Last edit: September 26, 2017, 08:36:52 PM by theymos
Merited by ABCbits (4)
 #2

First of all, please do not use or refer to the Bitcoin Core 0.8 codebase. It is extremely outdated and insecure.

Could anyone help me out in figuring out what the numbers in the first one mean.
It is just making a script to put in the scriptSig of the only transaction in the genesis block. The stuff in the script mean nothing and have no consensus meaning except for the fact that they must be there otherwise the genesis block's hash will not match what it is supposed to be.
Code:
 << 486604799 
Push this number to the scriptSig. It just happens to be the decimal version of the nBits of the genesis block.

Code:
<< CBigNum(4) 
Push the number 4 to the scriptSig.

Code:
<< vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
Push the character array pszTimestamp to the scriptSig. This character array is just the string of "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"

And for the second one, where is that hash from??
That is not a hash. That is a public key. It is a normal Pay to Public Key output.



The forum is doing something weird with the code blocks here.

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
September 26, 2017, 08:35:26 PM
Merited by ABCbits (3)
 #3

EDIT:  Looks like achow101 was able to type up a response faster than me.  Since I already went to all the trouble to type this up, I'll just leave this here anyhow.

pszTimestamp is just arbitrary text.  Satoshi chose to use a headline from a newspaper to prove that the blockchain did not start any earlier than the date that newspaper was published.  Specifically, the value is:
Quote
The Times 03/Jan/2009 Chancellor on brink of second bailout for banks

You can see that in the code here:
https://github.com/bitcoin/bitcoin/blob/0.8/src/main.cpp#L2775


486604799 is a decimal representation of the difficulty target that was used.

486604799 in hex is 1D00FFFF and you can see that difficulty target being set here:
https://github.com/bitcoin/bitcoin/blob/0.8/src/main.cpp#L2788

The second one is not a hash.  It is an ECDSA public key. Specifically, it is one of Satoshi's public keys.
The generation transaction of the genesis block (and many blocks after that) do not use bitcoin addresses or P2PKH scripts.  They use P2PK scripts.  This requires 2 pieces of information, the public key and an OP_CHECKSIG op code.

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!