The short version, for everyone: This is part 1 of a series that takes you from knowing nothing about Bitcoin to running your own Bitcoin node. No prior knowledge needed, only a computer and curiosity. In this part: what problem Bitcoin actually solves, two small experiments you can run in a terminal that show the two ideas everything else is built on, and then your first private Bitcoin network, on your own laptop, where you mine coins and send a payment. Every output shown is real.

I live in Kisumu, Kenya, and most people around me have heard of Bitcoin as a scam or a gamble. I build a Bitcoin wallet and help local shops accept Bitcoin, and the most common question I get isn't "how do I buy it?" but "what is it, actually?". This series is my answer, written for someone starting from zero, and ending somewhere specific: your own Bitcoin node, a computer that checks every rule for itself and trusts nobody.

The series

Part Topic What you'll do
1 The problem, and your first private network Hash things, mine a toy block, run regtest
2 Keys, addresses and signatures Make keys, sign a message, prove ownership
3 One transaction, byte by byte Build and decode a transaction by hand
4 Blocks and mining, as questions and answers Mine, inspect blocks, meet the 100-block rule
5 Fees and the mempool: the story of a stuck payment Get a payment stuck, then unstick it
6 Wallets and backups: a checklist Back up, destroy, restore, verify
7 Lightning, explained with a café tab See why instant payments need a second layer
8 Destination: your own node Signet first, then the real network

Each part uses a different format (an explainer, a lab, a Q&A, a story, a checklist, a field guide), because people learn differently and because nobody should be bored on the way to their own node.

Contents

  1. The problem: who keeps the ledger?
  2. Idea 1: a fingerprint for any data
  3. Idea 2: making it expensive to rewrite history
  4. Putting the ideas together
  5. Your first private Bitcoin network
  6. Checkpoint 1: an empty chain
  7. Checkpoint 2: mine, and wait 100 blocks
  8. Checkpoint 3: send a payment
  9. What you just did
  10. Common beginner questions
  11. Before part 2

The problem: who keeps the ledger?

Money is a ledger: a record of who owns what. When you send 500 shillings by M-Pesa, nothing physical moves. Safaricom changes two numbers in its database: yours goes down, the shop's goes up. That works because everyone trusts Safaricom to keep the record honestly, to keep it available, and to follow the rules.

That trust is usually fine. But it means one organisation can:

  • freeze an account,
  • reverse or block a payment,
  • go offline, and stop everyone's payments at once,
  • change the rules, including fees, whenever it decides to.

Bitcoin asks a different question: can thousands of strangers keep one shared ledger that nobody controls, where nobody can cheat, without trusting each other?

That's harder than it sounds. If everyone keeps a copy of the ledger, two problems appear immediately:

  1. Copies disagree. Messages arrive in different orders. Whose copy is right?
  2. Cheaters lie. Someone can claim they never spent their money, and try to spend it twice.

Bitcoin's answer combines two ideas you can see working in a terminal in a few minutes. You don't need to understand any maths. You need to have seen them once.

Idea 1: a fingerprint for any data

A hash function takes any data (a word, a file, a whole book) and produces a short, fixed-size "fingerprint". Bitcoin uses one called SHA-256. Try it in a terminal (on macOS or Linux; on Windows, use WSL):

echo -n "Pay Amina 500 shillings" | shasum -a 256 echo -n "Pay Amina 900 shillings" | shasum -a 256 echo -n "Pay Amina 500 shillings." | shasum -a 256 

My output:

79e564922c816f6dd0e4fce665d6243b17401088b46eee223c0b2a0930cf4902 - 371abff2574459cfcd73cea62dfc0313d2a84a815ff09c4d6f1ae4206144bb2e - 41ff9a2e9999935a49e68a0bce2a2bca6c33b42044f3523ff8e39ada04d58b41 - 

Look closely:

  • Same input, same fingerprint, always. Run the first line again, on any computer in the world, and you'll get 79e564….
  • A tiny change scrambles everything. Changing 500 to 900, or adding one full stop, gives a completely different fingerprint. There's no "slightly different" fingerprint for a slightly different message.
  • You can't go backwards. From 79e564… there's no way to work out the message, except guessing messages and hashing each one until one matches.

Why this matters: if you write down a fingerprint of the ledger, anyone can later check that nobody changed a single character. Change one payment, and the fingerprint no longer matches.

Idea 2: making it expensive to rewrite history

Fingerprints detect changes, but a cheater could just change the ledger and recompute the fingerprint. Bitcoin's second idea is to make producing an acceptable fingerprint expensive, on purpose.

The rule: a block of transactions is only accepted if its fingerprint starts with a certain number of zeros. Since you can't predict a fingerprint, the only way to find one is to add a number (called a nonce) to the block and keep changing it, hashing again and again, until you get lucky.

This little Python script plays that game. It hashes the text "Kisumu block, nonce=" plus a counting number, the way Bitcoin does (SHA-256 twice), until the fingerprint starts with enough zeros:

import hashlib, time msg = b"Kisumu block, nonce=" for zeros in ("0000", "000000"): t, n = time.time(), 0 while True: h = hashlib.sha256(hashlib.sha256(msg + str(n).encode()).digest()).hexdigest() if h.startswith(zeros): print(f"{len(zeros)} zeros: nonce {n} {h[:20]}... {time.time()-t:.2f}s") break n += 1 

On my laptop:

4 zeros: nonce 57447 000060da19b55032671e... 0.05s 6 zeros: nonce 2219051 000000d47f0ca3acbb2d... 2.05s 

Each extra hexadecimal zero multiplies the expected number of guesses by 16, so two more zeros should take about 256 times longer on average. This run needed about 39 times more guesses (2,219,051 against 57,447): luck varies wildly from one search to the next, but on average the cost grows exactly as the rule says. Bitcoin's real target today needs vastly more zeros, so finding one valid block takes the combined computers of the whole network about ten minutes. This is called proof of work: the fingerprint proves that a lot of guessing was done.

And this is what makes the ledger hard to rewrite. Each block includes the fingerprint of the block before it, so the blocks form a chain. To change a payment from last week, a cheater would have to redo the work for that block and every block after it, faster than the whole honest network is adding new ones. In practice, that's out of reach.

Putting the ideas together

Now the two problems from earlier have answers:

Problem Bitcoin's answer
Copies disagree Everyone follows the chain with the most accumulated work. Whoever finds the next block extends it, and everyone else adopts it
Cheaters lie Every computer checks every rule for itself: valid signatures, no money spent twice, no money created out of thin air
Who adds the next page? Whoever finds a valid fingerprint first. They're rewarded with new bitcoin, which is how new coins enter circulation
Who can change history? Nobody without out-working the entire network

The computers that keep a full copy of the ledger and check every rule are called nodes. The ones that also do the guessing work to add blocks are miners. You don't need to be a miner. But being a node, checking the rules yourself instead of trusting someone else, is the whole point of this series.

Your first private Bitcoin network

You don't need to buy bitcoin, or download the real 600+ GB chain, to start learning. Bitcoin Core, the main Bitcoin software, has a mode called regtest ("regression test"): a private Bitcoin network that exists only on your computer. Same software, same rules, but blocks are mined instantly on command and the coins are worthless. It's a lab where you can't lose money.

Install Bitcoin Core from bitcoincore.org/en/download (I used version 29.0). You need two programs from it: bitcoind (the node) and bitcoin-cli (the remote control you type commands into).

Start a private node with its own folder, so it never touches anything else on your machine:

mkdir -p ~/btc-lab bitcoind -regtest -datadir=$HOME/btc-lab -fallbackfee=0.0001 -daemon 

Then make a short alias for the remote control, so commands stay readable:

alias bcli="bitcoin-cli -regtest -datadir=$HOME/btc-lab" 

(-fallbackfee lets the wallet pay a fee on a network with no fee history. You'll learn what that means in part 5.)

Checkpoint 1: an empty chain

Ask your node about its chain:

bcli getblockchaininfo 

The interesting fields from mine:

'chain': 'regtest', 'blocks': 0, 'bestblockhash': '0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206', 'difficulty': 4.656542373906925e-10, 'size_on_disk': 293 
  • blocks: 0: only the "genesis" block exists, the hard-coded first block every regtest chain starts from. Its fingerprint, 0f9188f1…, will be identical on your machine: everyone's regtest starts from the same genesis block.
  • difficulty is tiny: regtest is designed so mining takes no real work.
  • size_on_disk: 293: the whole chain is 293 bytes. You'll watch it grow.

Checkpoint 2: mine, and wait 100 blocks

Create two wallets, for two people, Amina and Baraka:

bcli createwallet amina bcli createwallet baraka ADDR_A=$(bcli -rpcwallet=amina getnewaddress) echo $ADDR_A 
bcrt1qqkvn8teem5sap89pxarr9z2jtxda5403snkx0g 

That's an address, a destination for payments. bcrt1 marks it as regtest; on the real network addresses start bc1. (Part 2 is all about where addresses come from.)

Now mine one block, paying the reward to Amina, and check her balance:

bcli -rpcwallet=amina generatetoaddress 1 $ADDR_A bcli -rpcwallet=amina getbalances 
after 1 block: balance 0.00000000, immature 50.0 

Amina earned 50 bitcoin for that block, but her spendable balance is zero. The 50 is "immature". This is one of Bitcoin's rules: a block reward can't be spent until 100 more blocks have been built on top of it. Why? If two miners find blocks at almost the same time, one of those blocks gets abandoned. Coins from an abandoned block must not already be spread around the economy. Waiting 100 blocks makes that practically impossible.

Mine 100 more:

bcli -rpcwallet=amina generatetoaddress 100 $ADDR_A bcli -rpcwallet=amina getbalance 
after 101 blocks: balance 50.00000000 

Now 50 is spendable. (The rewards from the other 100 blocks are themselves immature, for the same reason.)

Checkpoint 3: send a payment

Amina sends 1.5 bitcoin to Baraka:

ADDR_B=$(bcli -rpcwallet=baraka getnewaddress) TX=$(bcli -rpcwallet=amina sendtoaddress $ADDR_B 1.5) echo $TX 
7b6487e8f6cf5a7c0a838481d947045ed1f7d64c1931ff9881a8a42e3e516d85 

That long number is the transaction ID, itself a fingerprint of the transaction. Before any new block is mined, look at Baraka's wallet and at the node's waiting room:

bcli -rpcwallet=baraka getbalances bcli getmempoolinfo 
Baraka before a block: trusted 0.0 | untrusted_pending 1.5 mempool: 1 tx, 141 vbytes 

Baraka can see the 1.5 coming, but it's "untrusted pending": it's sitting in the mempool, the waiting room of transactions that are valid but not yet in a block. Until it's in a block, it isn't final. Mine one block and look again:

bcli -rpcwallet=amina generatetoaddress 1 $ADDR_A bcli -rpcwallet=baraka getbalance bcli -rpcwallet=amina gettransaction $TX 
Baraka after 1 block: 1.50000000 | confirmations 1 Amina view: amount -1.5 fee -1.41e-05 

Baraka now has 1.5 with 1 confirmation: the payment is in a block. And Amina paid a fee of 0.0000141 bitcoin, which is 1,410 satoshis (the smallest unit: 1 bitcoin = 100,000,000 sats). The transaction was 141 virtual bytes and paid 10 sats per byte. Fees go to the miner who includes your transaction; part 5 is about why they exist and how they're chosen.

The block that confirmed it:

bcli getblock $(bcli getbestblockhash) 
latest block: height 102 txs 2 size 471 prev 78a5cf979b05f5df... 

Two transactions: the miner's reward, and Amina's payment. And prev, the fingerprint of the block before, is the link in the chain you saw in idea 2. The whole chain on disk is now about 17 MB, mostly empty database files rather than blocks.

When you're done, stop the node cleanly:

bcli stop 

What you just did

In fifteen minutes you ran the same software that secures the real Bitcoin network, and you:

  1. Saw hashing: tiny changes, completely different fingerprints.
  2. Did proof of work by hand: more zeros, much more guessing.
  3. Started a node with its own chain, from the same genesis block as everyone else's regtest.
  4. Mined blocks and met the 100-block maturity rule.
  5. Sent a payment, watched it wait in the mempool, then confirm in a block, with a fee.

Everything that comes later in this series (keys, transactions, fees, wallets, Lightning, your real node) is a closer look at something you just touched.

Common beginner questions

Is regtest bitcoin real? No. It exists only on your machine and is worthless. That's the point: you can experiment without risk.

Do I need to mine to use Bitcoin? No. Mining on the real network needs specialised hardware. You'll use a wallet, and in part 8, your own node to check the rules.

Who controls Bitcoin, then? Nobody controls the ledger. The rules are enforced by every node independently; changing them would require people running nodes to choose to run different software.

What's a node, in one sentence? A computer running Bitcoin software that keeps the full chain and checks every rule itself, instead of trusting someone else's word.

Why does the series end with running a node? Because "don't trust, verify" only means something if you can verify. A node is how you stop trusting a company to tell you what you own.

Do I need to buy bitcoin for this series? No. Everything until part 8 runs on test networks with worthless coins, and even part 8's node only downloads and checks public data. Treat any real money with care.

Before part 2

Keep your ~/btc-lab folder; the next part starts from it. If you want to try something on your own first:

  • Mine 6 more blocks and run bcli -rpcwallet=baraka gettransaction <txid> again. Watch confirmations count up. (On the real network, 6 confirmations is the traditional "final enough" threshold for large payments.)
  • Hash your own name with shasum -a 256, then change one letter.
  • In the proof-of-work script, try "00000" and predict the time before you run it.

Next time: keys, addresses and signatures, where we find out what bcrt1qqkvn8… actually is, and how Bitcoin proves a payment came from the owner without anyone knowing their secret.

I'm building Bitcoin tools in Kisumu and learning to contribute to Bitcoin's open-source software in public. Not sponsored. Questions, corrections and "this confused me" comments are the most useful thing you can leave below.