CKAICryptoKit AI Open CryptoKit AI
Lesson 2/25 · Foundations

What Is Blockchain and How Does It Work?

A blockchain is a shared digital record book that many computers keep in sync, where new entries are added in batches called blocks and each block is chained to the one before it. Once a block has been added, changing it would break the chain, so the record is extremely hard to alter. Blockchain is the technology underneath Bitcoin, Ethereum and almost every other cryptocurrency.

In lesson 1 you learned what crypto is. This lesson looks under the hood: what a blockchain is made of, how a transaction gets onto it, and what it can and cannot do.

What is a blockchain? An everyday picture

Imagine a notebook that a whole town shares. Every time someone pays someone else, the payment is written in the notebook. Two rules make it special:

  1. Everyone has their own identical copy of the notebook, not just one person.
  2. A new page is added only when most people agree it is correct, and old pages can't be quietly rewritten, because everyone else's copy would no longer match.

That is a blockchain in one sentence: a notebook (ledger) that is shared, checked by the group, and only ever added to.

Why was blockchain invented? The double-spending problem

Digital files are easy to copy. That is fine for a photo, but it is a disaster for money: if a digital coin could be copied, you could spend the same coin twice. This is called double-spending.

Before Bitcoin, the fix was a trusted middleman. A bank keeps the one official ledger and makes sure a dollar can only be spent once. In 2008, Satoshi Nakamoto's Bitcoin white paper showed another way: let a whole network keep the ledger and agree on it, so no single middleman is needed.

Left: one central ledger held by a bank, with three users depending on it. Right: five computers each holding an identical copy of a shared ledger, linked to one another
Figure 1. A bank keeps one central ledger that everyone has to trust. A blockchain gives many computers an identical copy, so no single place controls the record.

What is inside a blockchain?

A blockchain has three basic parts:

  • Blocks: each block is a batch of recent transactions, plus a timestamp and a link to the previous block.
  • Hashes (fingerprints): a hash is a short code generated from data by a math formula. Change even one character of the data and the code changes completely. Each block stores the hash of the block before it, which is what "chains" them together. Lesson 1 shows this in Figure 2.
  • Nodes: the computers that keep a copy of the blockchain and check that new transactions follow the rules. Anyone can run one on a public blockchain such as Bitcoin.

Because every block carries the fingerprint of the block before it, tampering with an old block changes its fingerprint and breaks the link to every block after it. Everyone else's copy would immediately disagree.

How does a transaction get added to the blockchain?

Here is what happens when you send crypto to a friend, in five steps:

  1. You send it. Your wallet creates the transaction and signs it with your private key. The signature proves it came from you without revealing the key.
  2. It is broadcast. The transaction is passed to nodes around the world.
  3. Nodes check it. Is the signature valid? Do you actually have the funds? Has this money already been spent? Invalid transactions are rejected.
  4. It goes into a block. A miner or validator (the participant chosen to build the next block) bundles your transaction with others.
  5. The block joins the chain. Once the network accepts the block, your transaction is confirmed.

Five numbered steps: you send a transaction, it is broadcast to the network, nodes check it, it is added to a new block, and the block joins the chain, at which point the transaction is confirmed
Figure 2. The path of a crypto transaction, from your wallet to a confirmed block. Steps 2 to 5 are done by the network, not by a bank.

Each new block added on top of yours is another confirmation, and the more confirmations a transaction has, the harder it is to reverse. That is why exchanges often wait for several confirmations before crediting a deposit.

How do computers agree? Consensus in simple terms

With no boss in charge, the network needs a rule for deciding who gets to add the next block. This rule is called a consensus mechanism. Two are common:

Proof of Work (PoW) Proof of Stake (PoS)
Used by Bitcoin Ethereum (since September 2022) and many newer blockchains
Who builds blocks Miners, who compete using computing power Validators, who lock up coins as a deposit
What it costs to take part Hardware and electricity Coins at stake
What discourages cheating Cheating wastes expensive energy Cheating can cost you your deposit
Speed Bitcoin adds a block about every 10 minutes on average Ethereum adds a block about every 12 seconds

Both do the same job: make cheating so expensive that honest behavior pays better.

Public and private blockchains

  • Public blockchains (Bitcoin, Ethereum) are open. Anyone can read the ledger, send transactions and, in most cases, help run the network.
  • Private blockchains are run by a company or a group and only approved members can take part. They are mostly used inside businesses.

When people talk about crypto, they almost always mean public blockchains.

Can a blockchain really not be changed?

Blockchains are often called "unchangeable" (immutable), and for large networks that is close to true in practice, but there are limits worth knowing:

  • The 51% attack. If one party controlled most of a network's mining power or staked coins, it could rewrite recent history. On large networks like Bitcoin, that would cost an enormous amount. Smaller networks have been attacked this way.
  • Blockchain records, it doesn't verify. The chain keeps what was written, but it can't tell whether the real-world information was true. Bad data in means a permanent record of bad data.
  • The weak points are usually around the chain. Stolen passwords, hacked exchanges, phishing sites and buggy smart contracts cause far more losses than breaking the blockchain itself.

Common myths

  • "Blockchain and Bitcoin are the same thing." No. Bitcoin is one application that runs on a blockchain. Thousands of other blockchains and apps exist.
  • "Blockchain transactions are anonymous." Not quite. Public blockchains are pseudonymous: you appear as a wallet address, not a name, but every transaction on that address is visible to anyone, and an address can often be linked to a real person (for example through an exchange account).
  • "A blockchain is always better than a normal database." Not at all. A blockchain is usually slower and costlier. It makes sense only when many parties who don't trust each other need to share one record.

What is blockchain used for?

  • Cryptocurrencies: sending value without a bank in the middle.
  • Smart contracts: programs that run on the blockchain and execute automatically when conditions are met. They power DeFi (decentralized finance) and NFTs.
  • Stablecoins: coins pegged to a currency such as the US dollar, used for payments and trading.
  • Other experiments: tracking goods through supply chains, digital records and more. Results here are mixed, and many ideas work just as well without a blockchain.

Frequently asked questions

Is blockchain the same as Bitcoin?

No. Bitcoin is a cryptocurrency, and it runs on its own blockchain. Blockchain is the underlying technology, and many other cryptocurrencies and apps use their own blockchains.

Can a blockchain be hacked?

Rewriting the history of a large blockchain like Bitcoin is considered practically impossible because of the cost. Most real-world thefts happen elsewhere: at hacked exchanges, through stolen wallet keys, phishing, or bugs in smart contract code. That is why protecting your own accounts matters.

Is blockchain anonymous?

No. Public blockchains are pseudonymous. Transactions are visible to everyone and tied to wallet addresses, and addresses can sometimes be linked to identities.

Who controls a blockchain?

On a public blockchain, no single company or person does. Rules are enforced by software that thousands of independent computers run, and changes usually require broad agreement from the community. That said, large holders and big mining or staking groups can have significant influence.

How long does a blockchain transaction take?

It depends on the network. Bitcoin adds a block about every 10 minutes on average, and Ethereum about every 12 seconds. Many services wait for several confirmations, and waiting times also vary with how busy the network is and the fee you pay.

Summary

  • A blockchain is a shared ledger kept by many computers, written in blocks that are chained together by hashes (fingerprints).
  • It was designed to solve double-spending without a trusted middleman such as a bank.
  • A transaction is signed, broadcast, checked by nodes, put in a block, and confirmed when the block joins the chain.
  • Consensus (Proof of Work or Proof of Stake) makes cheating more expensive than playing fair.
  • Blockchains are hard to alter, but the real risks are usually around them: exchanges, wallets and scams. Blockchain is not the same as Bitcoin and is not anonymous.

Next lesson: What Is Bitcoin? Why Does It Have Value? You will see how the first blockchain works as money.

This article is for education only and is not financial advice. Crypto is volatile, and you can lose all the money you put in.