Bitcoin Forum
September 25, 2018, 12:30:30 AM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: What are these variables in the Genesis Block and how were they determined?  (Read 263 times)
the demon malloc
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
September 26, 2017, 07:41:30 PM
 #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.
1537835430
Hero Member
*
Offline Offline

Posts: 1537835430

View Profile Personal Message (Offline)

Ignore
1537835430
Reply with quote  #2

1537835430
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1656


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


View Profile WWW
September 26, 2017, 08:23:57 PM
 #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: 2198
Merit: 1373



View Profile
September 26, 2017, 08:35:26 PM
 #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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!