Bitcoin Forum
November 13, 2024, 10:13:07 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Genesis block raw dump?  (Read 8188 times)
ThePiachu (OP)
Sr. Member
****
Offline Offline

Activity: 444
Merit: 313



View Profile WWW
November 23, 2011, 07:39:11 PM
 #1

I`m implementing some low-level Bitcoin operations currently, and I want to recreate the genesis block so I can communicate with the network. As I'm writing the implementation from scratch, and there are no raw dumps of the genesis block (getting to low level byte dumps), can someone check if what my code is generating is a proper dump of the genesis block?

01000000 - version
0000000000000000000000000000000000000000000000000000000000000000 - prev block
4A5E1E4BAAB89F3A32518A88C31BC87F618F76673E2CC77AB2127B7AFDEDA33B - merkle root
29AB5F49 - timestamp
FFFF001D - bits
1DAC2B7C - nonce
01000000 - version
01 - number of transaction
01 - inputs
0000000000000000000000000000000000000000000000000000000000000000FFFFFFFF - prev output
4D - script length
04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F7 2206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73 - scriptsig
FFFFFFFF - sequence
01 - outputs
00F2052A01000000 - 50 BTC
42 - pk_script length
04678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF3 8C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5F - pk_script
AC - OP_Checksig
00000000 - lock time

1HWbVLhxj7bhewhyapMZpyhqWAeAhJd51E
My Bitcoin Calculator:
http://tpbitcalc.appspot.com/
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5376
Merit: 13410


View Profile
November 23, 2011, 07:55:08 PM
 #2

Some of your data has the wrong endianness. Definitely the Merkle root, and maybe the difficulty and other things.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
ThePiachu (OP)
Sr. Member
****
Offline Offline

Activity: 444
Merit: 313



View Profile WWW
November 25, 2011, 08:05:45 PM
 #3

Okay, fixed the merkle root, as for the bits I'm not really sure whether the Block Explorer reverses that field, or leaves it as is, so I guess I should ask on the SE.


01000000 - version
0000000000000000000000000000000000000000000000000000000000000000 - prev block
3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A - merkle root
29AB5F49 - timestamp
FFFF001D - bits
1DAC2B7C - nonce
01000000 - version
01 - number of transaction
01 - inputs
0000000000000000000000000000000000000000000000000000000000000000FFFFFFFF - prev output
4D - script length
04FFFF001D0104455468652054696D65732030332F4A616E2F32303039204368616E63656C6C6F7 2206F6E206272696E6B206F66207365636F6E64206261696C6F757420666F722062616E6B73 - scriptsig
FFFFFFFF - sequence
01 - outputs
00F2052A01000000 - 50 BTC
42 - pk_script length
04678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF3 8C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5F - pk_script
AC - OP_Checksig
00000000 - lock time

1HWbVLhxj7bhewhyapMZpyhqWAeAhJd51E
My Bitcoin Calculator:
http://tpbitcalc.appspot.com/
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5376
Merit: 13410


View Profile
November 25, 2011, 11:29:57 PM
 #4

I think this is the accurate hex:
Code:
01000000
0000000000000000000000000000000000000000000000000000000000000000
3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a
29ab5f49
ffff001d
1dac2b7c
01
01000000
01
0000000000000000000000000000000000000000000000000000000000000000
ffffffff
4d
04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73
ffffffff
01
00f2052a01000000
43
4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac
00000000

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
ThePiachu (OP)
Sr. Member
****
Offline Offline

Activity: 444
Merit: 313



View Profile WWW
November 28, 2011, 10:15:47 PM
 #5

Hmm, so the main difference (asides two lines being switched between themselves) is between my lines:

42 - pk_script length
04678AFDB0FE5548271967F1A67130B7105CD6A828E03909A67962E0EA1F61DEB649F6BC3F4CEF3 8C4F35504E51EC112DE5C384DF7BA0B8D578A4C702B6BF11D5F - pk_script
AC - OP_Checksig

And your lines:

43
4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce f38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac

Which is just the inclusion of "41" at the begining of pkscript. Here
http://blockexplorer.com/rawblock/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
we can see the line

"scriptPubKey":"04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3 8c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG"

So where does the "41" come from?

1HWbVLhxj7bhewhyapMZpyhqWAeAhJd51E
My Bitcoin Calculator:
http://tpbitcalc.appspot.com/
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5376
Merit: 13410


View Profile
November 29, 2011, 12:16:20 AM
 #6

It's a script op that pushes 0x41 bytes onto the stack.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
ThePiachu (OP)
Sr. Member
****
Offline Offline

Activity: 444
Merit: 313



View Profile WWW
November 29, 2011, 02:10:35 PM
 #7

Hmm, isn't that redundant with the pk_script length right before it? Also, I can't find a reference to that script op in the specification of tx https://en.bitcoin.it/wiki/Protocol_specification#tx .

1HWbVLhxj7bhewhyapMZpyhqWAeAhJd51E
My Bitcoin Calculator:
http://tpbitcalc.appspot.com/
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2301


Chief Scientist


View Profile WWW
November 29, 2011, 04:18:57 PM
 #8

Hmm, isn't that redundant with the pk_script length right before it?
No.
Quote
Also, I can't find a reference to that script op in the specification of tx https://en.bitcoin.it/wiki/Protocol_specification#tx .
See: https://en.bitcoin.it/wiki/Script
Opcodes 1-75 push data onto the stack.

How often do you get the chance to work on a potentially world-changing project?
ThePiachu (OP)
Sr. Member
****
Offline Offline

Activity: 444
Merit: 313



View Profile WWW
November 29, 2011, 09:36:30 PM
 #9

That is interesting, didn't expect that from the Tx example. Thanks for the help!

1HWbVLhxj7bhewhyapMZpyhqWAeAhJd51E
My Bitcoin Calculator:
http://tpbitcalc.appspot.com/
MykelSilver
Full Member
***
Offline Offline

Activity: 237
Merit: 100


View Profile
May 23, 2013, 10:13:50 AM
 #10

When I put this passphase (The Times 03/Jan/2009 Chancellor on brink of second bailout for banks) into the brainwallet from https://www.bitaddress.org/ I got a valid bitaddress: 1Nbm3JoDpwS4HRw9WmHaKGAzaeSKXoQ6Ej

Coincidence?

Anyone?

Source: https://en.bitcoin.it/wiki/Genesis_block
ThePiachu (OP)
Sr. Member
****
Offline Offline

Activity: 444
Merit: 313



View Profile WWW
May 23, 2013, 10:15:36 AM
 #11

When I put this passphase (The Times 03/Jan/2009 Chancellor on brink of second bailout for banks) into the brainwallet from bittaddress.org I got a valid bitaddress: 1Nbm3JoDpwS4HRw9WmHaKGAzaeSKXoQ6Ej

Coincidence?

Anyone?

Source: https://en.bitcoin.it/wiki/Genesis_block

One can make a brainwallet out of any string, and some Bitcoin people like to use "lucky charms" in form of phrases like that.

1HWbVLhxj7bhewhyapMZpyhqWAeAhJd51E
My Bitcoin Calculator:
http://tpbitcalc.appspot.com/
flake133
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
July 05, 2023, 08:06:30 AM
 #12

Thank you very much for your valuable thoughts so far.


May I ask, is it possible to dumb theymos' hex into Github's SHA256 online-tool to check whether it yields the correct hash?  Which is supposed to be this
Code:
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
.

It doesn't work for me yet. Do I need to apply something like the public-key private-key encryption beforehand?

Also, when you, theymos, write that this is proper hex, do you mean that one has to remove the '↵' before? I am sorry, this is perhaps a very stupid question.^^

Thank you very much.

SHA256 online-tool: https://emn178.github.io/online-tools/sha256.html
Genesis-Block: https://en.bitcoin.it/wiki/Genesis_block
vjudeu
Copper Member
Legendary
*
Offline Offline

Activity: 900
Merit: 2243



View Profile
July 05, 2023, 04:05:09 PM
 #13

Quote
Do I need to apply something like the public-key private-key encryption beforehand?
No, you only need to hash the 80-byte block header in binary mode.
Code:
SHA-256(0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c)=af42031e805ff493a07341e2f74ff58149d22ab9ba19f61343e2c86c71c5d66d
SHA-256(af42031e805ff493a07341e2f74ff58149d22ab9ba19f61343e2c86c71c5d66d)=6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
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!