Home Articles Tags

Last Updated: 4.August.2025

Tags: #bitcoin, #blockchain

Blockchain

* This article is about bitcoin's blockchain. There are many other more advanced blockchains, but I want to focus on the fundamentals

A blockchain is literally a chian of blocks. A block records transactions and blocks are chained in a time order.

Block

A block consists of a header, transactions and some metadata. A header contains a hash of its previous block header, a hash of its transactions, timestamp, and PoW (Proof Of Work). PoW contains 2 fields: target and nonce.

target is a 256-bit number, and when you hash the header, the result must be less than equal to target. If you want to create a block, you have to brute-force nonce value until the hash becomes small enough. target value is adjusted every 2 weeks. If the players are creating too many blocks (more than a block in 10 minutes), target becomes smaller so that it's more difficult to create a block, and vice versa.

It's somewhat like git in that you cannot rewrite history. If you try to change something in an old block, the hash of the old block would change, which would invalid all the following blocks.

Transactions

Let's say Alice wants to send 10 bitcoins to Bob. They broadcast "Alice sends 10 bitcoins to Bob" to a lot of nodes in the network. The message is signed with Alice's private key.

The message sits in a memory pool. The nodes in the network tries to create a new block with transactions in the memory pool. A node can choose arbitrary transactions, but they usually choose transactions with higher fees.

As I mentioned above, creating a block is a tedious process. When a node successfully creates a node, it broadcasts "hey folks, this is a new node that I've just created. Could you verify this?" If the new node is valid, the other nodes accept the new node, add the node to their chain, and start creating a new node from there.

Prevent frauds

Unlike traditional financial systems, there's no central authority in a blockchain. Instead, each node verifies the transactions and shares the results.

Incentives

If you create a block, you can add a special transaction to the block, which gives a few coins to you (Subsidy). This gives you an incentive to verify the transactions and blocks. How many coins the special block creates is controlled by the protocol. It's reduced every 4 years, and will eventually become 0.

Also, a transaction can explicitly give a fee to the creator. This fee will motivate nodes to create blocks even thought there's no Subsidy.