1. Introduction
Welcome back to My Web3 Journey!
In Part 1, I laid out the roadmap and tools I plan to use. Now it's time to actually understand what we're building on top of — the blockchain.
Before writing a single line of Solidity or connecting a wallet, I think it's critical to understand how blockchain works under the hood. Not at a PhD level, but enough to reason about why things behave the way they do when you build dApps later.
Let's break it down.
2. What Is a Blockchain?
At its core, a blockchain is just a database — but a very special one.
A regular database (like MySQL) is controlled by one company or server. They can edit, delete, or hide data. A blockchain, on the other hand, is:
- Distributed — thousands of computers (nodes) each hold a copy
- Immutable — once data is written, it cannot be changed
- Transparent — anyone can read the data at any time
Think of it like a Google Doc that everyone can read, but nobody can edit or delete past entries.
3. How a Block Works
A blockchain is made up of blocks linked together in a chain. Each block contains:
| Field | Description |
|---|---|
| Data | Transactions (who sent what to whom) |
| Timestamp | When the block was created |
| Hash | A unique fingerprint of this block |
| Previous Hash | The fingerprint of the block before it |
The hash is what makes this clever. If you change anything in a block — even one character — its hash completely changes. And since the next block stores the previous hash, the whole chain after it becomes invalid.
That's why blockchain data is practically impossible to tamper with. You'd have to rewrite every block after it, simultaneously, on thousands of computers.
4. Consensus — Who Gets to Add a Block?
Here's the problem: thousands of computers around the world each hold a copy of the blockchain. When someone submits a new transaction, who decides which computer gets to write the next block?
If there's no rule, two computers could write conflicting blocks at the same time — and the chain would split into chaos.
This problem is solved by a consensus mechanism — a set of rules all nodes agree to follow so they can reach agreement without trusting each other.
There are two main approaches: Proof of Work and Proof of Stake.
Proof of Work (PoW)
Used by: Bitcoin
Think of PoW like a math competition. Every time a new block needs to be added, all the miners on the network race to solve a very hard puzzle.
What's the puzzle?
The network gives miners a target: "Find a number that, when added to this block's data and hashed, produces a result below a certain threshold." The threshold adjusts every 2 weeks to keep block time around 10 minutes — the harder the target, the more leading zeros the hash must have.
There's no clever trick to solve it — miners just try billions of random numbers per second until one works. It's pure brute force.
EV (Expected Value) = the average reward you'd earn across many attempts. EV = 0.9 means you earn 90% of the maximum possible reward on average.
The diagram shows why PoW naturally discourages "split voting." A miner who divides their hash power between two competing chains (EV = 0.5) earns less than one who commits fully to the stronger chain (EV = 0.9). Hash power is a finite resource — spending it on a losing fork has a real opportunity cost.
Real example: In 2023, Bitcoin miners collectively made around 500 quintillion attempts per second to find the winning number. The first one to find it broadcasts the block to the network, everyone else verifies it in milliseconds, and the winner earns the block reward (currently 3.125 BTC).
Why does this prevent cheating?
Because solving the puzzle costs real electricity and hardware. If a bad actor wanted to rewrite the blockchain, they'd need to redo all that work — faster than the honest miners are adding new blocks. To attack Bitcoin, you'd need to control more than 50% of the global mining power. That's practically impossible and absurdly expensive.
- ✅ Battle-tested security (Bitcoin has run for 15+ years without being hacked)
- ❌ Wastes enormous energy — Bitcoin uses roughly as much electricity as a mid-sized country
- ❌ Slow — Bitcoin processes ~7 transactions per second
Proof of Stake (PoS)
Used by: Ethereum (since "The Merge", September 2022)
PoS throws out the competition entirely and replaces it with a lottery weighted by skin in the game.
Instead of burning electricity, validators must stake (lock up) ETH as collateral — currently 32 ETH minimum. The network then randomly selects one validator to propose the next block. Other validators vote to confirm it.
But this raises a problem: since validators don't spend electricity, what stops them from voting on multiple competing chains at once to maximize their reward? This is known as the "Nothing at Stake" problem — and it was one of the biggest early criticisms of PoS.
Ethereum's answer is slashing: if a validator is caught voting on two conflicting chains, a portion of their staked ETH is automatically destroyed. Suddenly, split-voting goes from "free upside" to "guaranteed loss."
EV (Expected Value) = the average reward you'd earn over many attempts. A strategy with EV = 0.9 earns 90% of the maximum possible reward on average.
The diagram shows how slashing changes the math. Without slashing, a validator could vote on both chains (EV = high). With slashing, split-voting collapses in EV — making honest single-chain voting the only rational strategy.
Why does staking prevent cheating?
Because validators put up real money. If a validator tries to cheat — say, approving fraudulent transactions — the network slashes their stake (destroys a portion of their locked ETH). The financial punishment is so severe that cheating is never worth it.
Real example: Imagine 500,000 validators each locked up 32 ETH (~
100,000 at current prices). The protocol randomly picks one to propose the next block. If they behave honestly, they earn a small reward. If they try to cheat, they lose part of their100,000. The incentive to stay honest is obvious.
Why is PoS better for developers?
- ✅ ~99.95% less energy than PoW — Ethereum's electricity use dropped by that amount overnight after The Merge
- ✅ Faster — Ethereum finalizes blocks every ~12 seconds
- ✅ Foundation for future scalability (sharding, Layer 2, etc.)
- ❌ Requires 32 ETH to become a validator (high barrier — though you can pool with others via services like Lido)
Quick Comparison
| Proof of Work | Proof of Stake | |
|---|---|---|
| Used by | Bitcoin | Ethereum |
| How you participate | Buy mining hardware | Lock up ETH |
| Energy use | Very high | Very low |
| Speed | ~7 tx/sec | ~15–30 tx/sec |
| Penalty for cheating | Wasted electricity | Slashed stake |
| Security | Proven, 15+ years | Strong, newer |
As a Web3 developer, you'll mostly work on Ethereum (PoS) — so understanding the validator/staking model matters more than mining internals.
5. Wallets — Your Identity on the Blockchain
In Web3, you don't have a username/password. Instead, you have a wallet — and it's more like a key pair than a bank account.
How it works
Every wallet has two keys:
- Private Key — like your password. Never share this. Whoever has it controls your wallet.
- Public Key → your wallet address (e.g.,
0xAb5...). Share this freely — it's how people send you crypto.
Analogy: Your public key is like your email address (anyone can send to it). Your private key is the password to your inbox.
When you sign a transaction, you use your private key to prove you authorized it — without ever revealing the key itself (thanks to cryptography).
Popular wallets
- MetaMask — the most common browser wallet for developers
- Phantom — popular for Solana
- Ledger / Trezor — hardware wallets for maximum security
We'll set up MetaMask properly in the next part.
6. Transactions — What Actually Happens
When you send ETH or interact with a smart contract, you're creating a transaction. Here's the lifecycle:
- You sign the transaction with your private key
- It's broadcast to the network
- Nodes validate it
- A validator picks it up and includes it in a block
- The block is added to the chain
- Done — it's permanent
Every transaction also pays a gas fee — a small amount of ETH paid to the validator who processed it. Think of gas like a tip you pay the post office to deliver your letter — the bigger the tip, the faster your letter gets prioritized. Gas prices fluctuate based on network demand: during busy periods (like a popular NFT mint), fees spike as everyone competes for the same block space.
7. Mainnet vs Testnet
You wouldn't deploy untested code to a production server, right? Same idea applies here.
| Mainnet | Testnet | |
|---|---|---|
| ETH value | Real money | Fake (free) |
| Purpose | Production | Development & testing |
| Examples | Ethereum Mainnet | Sepolia, Holesky |
As a beginner, you'll spend 90% of your time on testnets. You can get free test ETH from a faucet — a website that sends you test tokens so you can practice without spending real money.
8. Conclusion
That's the foundation. Now you understand:
- What blockchain is — a distributed, immutable ledger
- How blocks link — via cryptographic hashes
- How consensus works — PoW vs PoS
- What a wallet is — a key pair, not an account
- What a transaction does — signed, broadcast, validated, permanent
- Mainnet vs Testnet — always test before spending real ETH