Crypto Trading · lesson 2 of 29
How a Blockchain Works
Learn this in a 5-minute interactive lesson
Real charts and practice questions. Free, no sign-up needed.
Transactions wait in line
When you send crypto, your wallet creates a transaction: a message that says, roughly, "move 0.1 BTC from this address to that address," signed with your secret key to prove it's really you. The transaction is broadcast to the network and waits in a queue, called the mempool, with thousands of others.
Every so often, the network bundles a batch of waiting transactions into a block and adds it to the chain. On Bitcoin that happens about every 10 minutes. On Ethereum, it's every 12 seconds. Transactions that offer a higher fee usually get picked first, a bit like paying extra for express delivery.
Fingerprints that link the blocks
Each block gets a hash, a short code that works like a fingerprint. A hash is calculated from everything inside the block. Change even one tiny detail, a single digit in a single transaction, and the fingerprint comes out completely different.
Here's the clever bit: every block also contains the fingerprint of the block before it. So the blocks are linked together in a chain. If someone tried to change a transaction from last year, that block's fingerprint would change, which would break the link to the next block, and the next, all the way to today. Every computer on the network would immediately see that the cheater's copy doesn't match everyone else's.
Who gets to add the next block?
Thousands of computers, called nodes, keep a copy of the blockchain and check every new block against the rules. But someone has to actually propose the next block, and the network needs a fair way to choose who, without a boss. This is called a consensus mechanism, and there are two main kinds.
Proof of work (PoW), used by Bitcoin: special computers called miners compete to solve a very hard maths puzzle by trying trillions of guesses. The first to solve it gets to add the next block and earns newly created bitcoin plus the fees in that block. To cheat, you'd need more computing power than most of the rest of the network combined, which would cost billions of dollars in machines and electricity. That cost is what keeps Bitcoin secure. The downside is that it uses a lot of energy.
Proof of stake (PoS), used by Ethereum since 2022: instead of machines and electricity, validators lock up coins as a deposit, called a stake. The network picks validators to propose and check blocks. Honest work earns rewards. Cheating gets part of your deposit taken away, which is called slashing. It uses far less energy, and the security comes from how much money is staked.
Addresses and keys
To use a blockchain, you need a pair of linked codes:
- A public address is like your email address or bank account number. You can give it to anyone so they can send you crypto. It looks something like `bc1q8r…7xk2`.
- A private key is like the password that lets you spend from that address. Anyone who has it can take everything. You never share it.
Think of a letterbox with a slot. Anyone can push letters through the slot (your address), but only the person with the key (your private key) can open the box and take things out. Most wallets turn your private key into a list of 12 or 24 words called a seed phrase, which is easier to write down. Chapter 9 is all about protecting it.
Confirmations
Once your transaction is in a block, it has one confirmation. Each new block added on top adds another. The more confirmations, the harder it would be to undo, so exchanges usually wait for several before crediting your deposit. For Bitcoin that might mean waiting for a few blocks, around 10 to 60 minutes. For faster chains, it can be seconds.
Open a block explorer in your browser, such as mempool.space for Bitcoin or etherscan.io for Ethereum. Look at the latest block: how many transactions it contains, the fees, and the time. Click on any transaction and see the addresses and amounts. You've just read a page of the world's most public ledger. No account needed.
Key terms from this lesson
- Transaction
- a signed instruction to move crypto from one address to another.
- Mempool
- the queue of transactions waiting to be added to a block.
- Block
- a batch of transactions added to the blockchain together.
- Hash
- a short code calculated from data, which changes completely if the data changes.
- Node
- a computer that keeps a copy of the blockchain and checks the rules.
- Proof of work
- a consensus method in which miners compete using computing power.
- Proof of stake
- a consensus method in which validators lock up coins as a deposit.
- Public address
- the code people use to send you crypto.
- Private key
- the secret code that lets you spend from an address.
- Confirmation
- each block added after the one containing your transaction.
- Block explorer
- a website for looking up blocks, addresses, and transactions.
Learn this in a 5-minute interactive lesson
Real charts and practice questions. Free, no sign-up needed.
Related guides
Pajama Markets provides education, not financial advice. Trading forex, crypto and leveraged products carries a high risk of losing money. Practise on a demo account first.