Blockchain Technology (BIC702) · Assignment 2

The genesis block is block #0 of a blockchain.

A blockchain is a list of blocks. Each block stores the hash of the block before it, which links the blocks together. The first block has no block before it. That first block is the genesis block.

previous hash of the genesis block =
0000000000000000000000000000000000000000000000000000000000000000
1

No previous block

Its previous-hash field is set to 32 zero bytes, because there is no block to point to.

2

Written into the software

Every node has the genesis block in its code. Nodes with a different genesis block are on a different chain.

3

Mined like any block

It has a header, a transaction and a proof-of-work hash, the same as every block after it.

1

Bitcoin's genesis block, rebuilt

Satoshi Nakamoto mined Bitcoin's first block on 3 January 2009. This section builds that block again from its parts, in four steps, and checks the result against the real block.

Each step uses the output of the step before it. Edit the message in step 1 and watch every later step change.

1

The coinbase transaction

A coinbase transaction creates new coins. In the genesis block it is the only transaction, and it creates 50 BTC. Satoshi wrote a newspaper headline into it. The headline proves the block was not made before that date.

1Coinbase message
2Transaction bytes (message highlighted)
2

The Merkle root

The Merkle root is one hash that represents every transaction in the block. With a single transaction, it is the double SHA-256 hash of that transaction. Change the transaction and the Merkle root changes.

3

The 80-byte header

The header is the part of the block that gets hashed. It has six fields. Numbers are stored lowest byte first (little-endian), so the bytes can look reversed. The transactions are not hashed directly; the Merkle root stands in for them.

4

The block hash

The block hash is the double SHA-256 hash of the header, shown byte-reversed as Bitcoin does. It must be lower than the target set by the bits field. A low number written in hex starts with zeros. Those zeros are the proof-of-work.

2

Mine your own genesis block

This block uses the same format as Bitcoin. You choose the coinbase message and the difficulty.

Mining means changing the nonce and hashing the header again until the hash is below the target. There is no shortcut; the only way is to try nonces one by one. Each extra bit of difficulty doubles the average number of tries.

1

Settings

The message goes into the coinbase transaction, like Satoshi's headline. Bitcoin allows at most 100 bytes in that field, which leaves room for a 91-byte message.

1Coinbase message
2Difficulty: 20 zero bits

The hash must start with this many zero bits. Average tries needed: 1,048,576.

3Expected time
Measuring this computer's speed…
2

Progress

Each try changes the nonce by one and hashes the header twice with SHA-256.

1Nonce
0
number being tried
2Hash rate
0
tries per second
3Tries
0
hashes computed so far
4Time
0.00 s
since mining started
Chance of finding it by now: 0%
5Latest hash
—
3

Tamper test

Block #1 stores the hash of the genesis block. If someone edits the genesis block, its hash changes and no longer matches the hash stored in Block #1. The link breaks, and every node can see it.

Edit the message or the nonce below to try it.

1

Edit the genesis block

Changing a single character is enough. The timestamp and difficulty stay the same.

1Coinbase message
2Nonce
2

What the other nodes see

Every node recomputes the hash and compares it with the one stored in Block #1.

Genesis block (#0)PoW valid
Hash of the edited block (changed digits in red)
Block #1link intact
Previous hash stored in Block #1