A blockchain is like a special kind of notebook that everyone can see and write in, but no one can erase or change what’s already written. It’s used to keep track of things like money, property, or even votes in a way that everyone can trust.
Let’s think of each block in a blockchain as a page in this notebook. Each page (block) has three main parts:
Data
: Information we want to store (e.g., transactions).Hash
: A unique code (like a fingerprint) that identifies this page.Previous Hash
: The code of the previous page, linking it to the last page.
# Block 1
DATA="First Transaction"
HASH="abc123"
PREV_HASH="000000"
# Block 2
DATA="Second Transaction"
HASH="def456"
PREV_HASH="abc123"
# Block 3
DATA="Third Transaction"
HASH="ghi789"
PREV_HASH="def456"
1. Immutability
Once something is written in the notebook (blockchain), it can’t be changed. If someone tries to change a page (block), the code (hash) changes, and it won’t match the code on the next page. This breaks the chain, so everyone knows something fishy happened.
Hashing
A hash is a unique code generated from data. For example, when you input data (like a transaction) into a hashing function, it outputs a fixed-length string of characters that appears random. Even a tiny change in the input data results in a completely different hash.
In a blockchain, each block contains the hash of its data and the hash of the previous block. This creates a chain of blocks, where each block is dependent on the previous one. This dependency ensures that if someone tries to change any data in a previous block, the hash of that block will change. Since the next block points to this hash, the change would break the chain, making it obvious that tampering occurred.
Consensus Mechanisms
Blockchains use consensus mechanisms like
Proof of Work (PoW)
orProof of Stake (PoS)
to validate and add new blocks to the chain. These mechanisms require the majority of participants (nodes) to agree on the validity of a new block.Once a block is added to the blockchain, altering it would require recalculating the hashes of that block and all subsequent blocks and gaining the consensus of the majority of the network participants, which is practically impossible in a large, decentralized network.
2. Transparency
In many blockchains, like Bitcoin or Ethereum, the entire ledger (the list of all transactions) is publicly accessible. Anyone can download a copy of the blockchain and view every transaction that has ever occurred.
Tools known as
blockchain explorers
allow users to search and view transactions, blocks, and other data on a blockchain. This level of transparency is uncommon in traditional financial systems, where such detailed records are usually private.
3. Decentralization
A blockchain operates on a decentralized network of computers (nodes), where each node has a copy of the blockchain. This means there is no central authority or single point of failure.
When a new transaction is made, it is broadcast to all nodes in the network. These nodes validate the transaction, and once a consensus is reached, the transaction is added to the blockchain.
Different consensus protocols are used to agree on the state of the blockchain. In
Proof of Work (PoW)
, nodes (called miners) compete to solve complex mathematical puzzles, and the first to solve it gets to add the new block. InProof of Stake (PoS)
, validators are chosen based on the number of coins they hold and are willing tostake
as collateral.