Skip to content

Thought Behind Things · Jun 25, 2021

How Bitcoin actually works, explained from scratch

Haroon Baig walks through the full architecture of Bitcoin — from mempool to mining, Lightning Network to proof-of-work — in one of the most technically grounded conversations on the show.

with Haroon Baig

8 min read

How Haroon Baig stumbled into crypto

The episode opens with Haroon Baig tracing his path into the space. He describes a background rooted in computers from college, a systems engineering degree, and early part-time work that eventually led him to Microsoft Azure in a consulting capacity. It was during that period, he explains, that he first encountered Bitcoin — not as an investment, but as a technology problem worth understanding.

What caught his attention was the payment layer. He describes the moment of realising that a transaction could be sent peer-to-peer, with no documents required, no intermediary, and no approval process. “You are not required to give any documents, you are not required to sign any documents — the payment reaches you directly,” he says. That framing — Bitcoin as infrastructure for financial inclusion rather than speculation — sets the tone for everything that follows.

The double-spend problem and why it took until 2008 to solve

Muzamil asks Haroon to go back to first principles: what was Bitcoin actually solving? Haroon explains that work on digital cash had been ongoing since the 1980s, but every attempt ran into the same wall — the double-spend problem. A digital file, unlike a physical note, can be copied. You can send the same song to a million people. Money cannot work that way; ownership must transfer, not duplicate.

The solution until Bitcoin was always a centralised entity — a bank, a server, a trusted third party — that kept the ledger and prevented the same unit of value from being spent twice. Satoshi Nakamoto’s contribution, Haroon argues, was not inventing new cryptography but combining existing technologies — peer-to-peer networking similar to BitTorrent, public-key cryptography, and proof-of-work — in a way that removed the need for that central entity entirely.

“Satoshi did not invent anything new,” Haroon says. “All the technology inside Bitcoin is open source. He took proof-of-work, the mining element, and combined it so that Bitcoin could be decentralised — so that the double-spend problem could be solved without any central authority.”

How a transaction actually moves through the network

Later in the discussion, Haroon walks through the mechanics of a single transaction in granular detail. Muzamil uses himself and Haroon as the example — Haroon sends Muzamil one bitcoin. The transaction does not go directly to Muzamil. It enters the mempool: a global pool of pending transactions waiting to be picked up.

Miners, Haroon explains, are not neutral processors. They are economically rational actors. They sort the mempool by fee size and prioritise the highest-fee transactions. Low-fee transactions can sit unconfirmed for up to two weeks before the protocol forces miners to include them. Once a miner selects a set of transactions, they bundle them into a block and race to solve a complex mathematical equation — a one-way function based on SHA-256. The first miner to solve it broadcasts the answer, the network validates it, and the block is added to the chain. That miner receives 6.25 bitcoin as a block reward, a figure that halves approximately every four years.

“The miners take the transactions with the highest fees and pack them in,” Haroon explains. “The ones with lower fees just sit there — they may not get confirmed for a long time.”

The scalability problem and the Lightning Network

Bitcoin processes roughly seven transactions per second. Visa processes thousands. Haroon does not treat this as a fatal flaw but as a known constraint with known solutions. He points to a 2017 incident — a viral game that congested the entire Ethereum network for days — as evidence of how badly scalability problems manifest in practice.

The Lightning Network is his primary example of a layer-two solution for Bitcoin. The mechanism relies on payment channels and multi-signature wallets. Two parties open a channel by locking bitcoin into a joint account on-chain. They can then transact with each other thousands of times off-chain, with each party holding a signed but unsettled transaction. Only when the channel closes does a single transaction settle on the main blockchain.

Muzamil asks about validation — if the transaction never hits the chain, how is it verified? Haroon explains the time-lock mechanism: each off-chain transaction is cryptographically signed by both parties, and the time-lock means neither party can unilaterally close the channel dishonestly without the other having a window to contest it. “The Lightning Network uses multi-signature,” he says. “One signature goes to the other party, one stays with you — but there is a time-lock feature, so the transaction can be suspended if something goes wrong.”

He gives a practical illustration: a coffee shop that receives hundreds of small payments a day does not need to settle each one on-chain. It accumulates them all in a Lightning channel and settles the total in a single on-chain transaction at the end of the day.

Why upgrading Bitcoin takes years

One of the more counterintuitive sections of the conversation concerns governance. Muzamil asks how Bitcoin gets updated if no one owns it. Haroon’s answer is detailed and honest about the friction involved.

Updates go through a proposal process — Bitcoin Improvement Proposals, or BIPs. Proposals are debated by a developer community, tested on a separate network, and then require buy-in from miners, node operators, and the broader ecosystem before they can be rolled out. The Taproot upgrade, which Haroon describes as the most significant Bitcoin update in years — improving signature efficiency and laying groundwork for smart contract functionality — was proposed in 2018 and only activated in mid-2021. “It took from 2018 until now, July, for this update to roll out,” he says. “That is how long it takes.”

The reason is structural. A centralised platform like Facebook can push an update to its servers in a month. A decentralised network requires every participant to upgrade voluntarily. If a significant minority refuses, the chain can fork — as happened with Bitcoin Cash, where a group of miners disagreed with the development roadmap, took their hash power, and created a separate chain. Haroon is direct about the outcome: “Bitcoin Cash is a very cheap currency now. It never got the value or the liquidity to be taken seriously.”

Mining, difficulty adjustment, and the China crackdown

Muzamil raises the China mining ban, which had happened shortly before the episode was recorded. Haroon uses it to explain one of Bitcoin’s most elegant features: the difficulty adjustment.

The mathematical equations miners solve are not fixed in complexity. Every two weeks, the protocol looks at how much computing power is on the network and adjusts the difficulty so that a new block is found approximately every ten minutes. When China cracked down and roughly half of global hash power went offline, the network did not collapse. It slowed down briefly, then automatically reduced difficulty within four weeks. “Bitcoin needed only four weeks to de-congest the difficulty,” Haroon says. “Even with a single computer, if all the mining operations in the world shut down, the protocol would adjust the difficulty down.”

He also addresses the energy criticism directly. Most major mining is concentrated where electricity is cheapest — historically China, now increasingly other regions. But he argues that Bitcoin’s demand for cheap energy has become one of the strongest economic incentives for solar innovation. “Solar technology has never innovated as fast as it has because of Bitcoin,” he says. “There is an economic incentive — the demand from miners — that is driving solar companies to build better panels.”

DeFi, proof-of-stake, and what comes next

By the end of the conversation, Haroon moves from Bitcoin’s mechanics to the broader ecosystem being built on top of smart-contract platforms. He describes DeFi — decentralised finance — as the most significant development currently underway: lending, borrowing, synthetic assets, and decentralised exchanges, all running without a bank or broker.

He gives a concrete example of the gap DeFi is trying to close. In Pakistan, getting a loan requires documents, collateral, and approval processes that exclude most people. In DeFi, you can take a loan in seconds by locking collateral in a smart contract. The protocol handles everything. “In Pakistan, getting a loan is a very big deal,” Haroon says. “In DeFi, you can take a loan in ten seconds.”

He distinguishes between custodial solutions — centralised companies that hold your bitcoin and lend it out, keeping the spread — and non-custodial solutions, where the protocol itself manages the collateral and nobody controls your funds. The non-custodial version is harder to use, he acknowledges. The user experience is still broken for most people. But that, he argues, is the direction the space is moving.

Muzamil closes by asking about proof-of-stake as an alternative to proof-of-work. Haroon explains the core difference: instead of spending electricity to prove you did work, you lock capital — stake it — to prove you have skin in the game. If you validate fraudulent transactions, a percentage of your stake is slashed. The security logic is the same as proof-of-work; the resource being committed is financial rather than physical. Whether it is as secure as proof-of-work at scale remains, he says, an open question — but the development activity on proof-of-stake networks is where most of the new application layer is being built right now.