← Back to Home

Book Exercises

Interactive blockchain demos to accompany the textbook. Explore hashing, blocks, chains, distributed consensus, tokens, and coinbase transactions hands-on.

This section has been forked and inspired from work from Professor Anders Brownworth, check his work at andersbrownworth.com

Exercise 1

SHA-256 Hash

Type anything below and watch the SHA-256 hash update in real time. Notice how even a tiny change produces a completely different hash.

Watch video explainer
Exercise 2

Block

A block bundles a block number, nonce, and data. The hash must start with "0000" to be valid. Click Mine to find a valid nonce.

Watch video explainer
Exercise 3

Blockchain

Each block's "Prev" field contains the previous block's hash, chaining them together. Tampering with any block invalidates all subsequent blocks.

Watch video explainer
Exercise 4

Distributed Blockchain

Three peers each hold an identical copy of the blockchain. Modify a block on one peer and see how it diverges from the others.

Watch video explainer
Exercise 5

Tokens

Instead of free-form data, blocks now contain financial transactions (value, sender, recipient). Altering any transaction breaks the chain.

Watch video explainer
Exercise 6

Coinbase Transactions

Miners earn a coinbase reward for each block. This is how new currency enters the system. Observe how coinbase transactions differ from regular transfers.

Watch video explainer
Exercise 7

Public / Private Key Pairs

Generate a private key and see the corresponding public key derived from the secp256k1 elliptic curve. The private key is a large number; the public key is a point on the curve.

Watch video explainer
Exercise 8

Digital Signatures

Sign a message with your private key, then verify it with the public key. This proves authorship without revealing the private key.

Watch video explainer
Exercise 9

Signed Transaction

Sign a financial transaction (amount, from, to) with your private key. The "from" field is your public key. Anyone can verify the signature without your private key.

Watch video explainer
$ From
$ From
Exercise 10

Signed Blockchain

A full blockchain where every transaction is cryptographically signed. Each transaction includes a sequence number and signature that can be independently verified.

Watch video explainer