← oliprok.sk

How Bitcoin works

An interactive visualisation of the whole system with live data: from a private key through transactions, the mempool and mining, all the way to an immutable chain of blocks.

BTC price
…
loading
Block height
…
…
In circulation
…
of 21,000,000 BTC
Block reward
…
…
Network hashrate
…
exahashes per second
Mempool
…
pending transactions
loading
Chapter 01

Map of the whole system

Bitcoin is a closed loop. Click any step to see what happens inside it. The arrows trace the path of money from signing a transaction to its final settlement in the blockchain.

1 Wallet keys and addresses 2 Transaction inputs and outputs 3 Nodes, mempool transaction waiting room 4 Miners proof of work 5 New block ~ every 10 minutes 6 Blockchain chain of blocks 7 Confirmations payment finality new UTXOs back into wallets

    Chapter 02

    Keys and addresses

    Owning bitcoin is pure mathematics. From a random number (the private key) a public key is derived one way, and from it an address. The path cannot be walked backwards, and that is the entire point.

    secret, never share

    Private key

    press the button below
    elliptic curve secp256k1

    Public key

     
    public, shared freely

    Address

     

    There are about 2⁲⁵⁶ ≈ 10⁷⁷ possible private keys, more than there are atoms in the visible universe. That is why they can be generated offline and will never collide. The derivation on this page is illustrative (a hash instead of a real elliptic curve).

    Chapter 03

    Seed phrase: the only backup you need

    Nobody memorises a 256-bit number. That is why wallets show twelve or twenty-four words from a standard list (BIP-39). Every key and every address, present and future, is derived deterministically from those words. Whoever has the words has the coins.

    Your example seed phrase

      One phrase grows a whole wallet

      The same phrase always yields the same addresses, in the same order, in any wallet in the world. That is why a wallet can be restored without any server at all.

        Three rules that account for more lost coins than everything else combined
        • Write the words on paper or into metal. Never into a phone, a photo, an email or the cloud.
        • No legitimate party will ever ask you for your seed phrase. Not support, not the wallet maker, and not this page.
        • Verify the backup immediately, while the wallet is still empty. Otherwise you discover the one wrong word only when it is too late.

        The phrase on this page is an example: it uses a shortened word list and runs in your browser purely to explain the principle. Never send real coins to it, and never type a real phrase into any website.

        Chapter 04

        Digital signature, live

        A signature proves the transaction was created by the owner of the private key and at the same time seals its content. Sign a message and then change even a single letter in it: the signature immediately stops being valid.

        not signed yet
        Public key (ECDSA)
        …
        Message signature
         

        This is real cryptography running in your browser (curve P-256; Bitcoin uses secp256k1 and Schnorr, the principle is the same). This is exactly what nodes do when verifying a transaction: public key, message, signature. The private key never leaves the wallet.

        Chapter 05

        Anatomy of a transaction: the UTXO model

        Bitcoin has no accounts and no balances. There are only unspent transaction outputs (UTXOs), digital banknotes of varying value. A transaction consumes a UTXO whole and creates new ones: a payment to the recipient and change back to yourself.

        0,35 BTC

        Inputs (your UTXOs)

        0,42 BTC
        from transaction a3f9… #0
        0,18 BTC
        from transaction 71bc… #1
        Transaction
        consumes inputs, creates outputs
        signed with the private key

        Outputs (new UTXOs)

        0,35 BTC
        → Bob address
        0,2498 BTC
        → change back to you
        0,0002 BTC
        miner fee

        Move the slider. A small amount needs one input (the second stays untouched), a larger one stacks them up, exactly like paying with banknotes. The difference between inputs and outputs is taken as a fee by the miner who includes the transaction in a block.

        Where virtual bytes come from: SegWit and Taproot

        A transaction is not priced by amount but by size. The SegWit upgrade (2017) moved signatures into a separate part and gave them a lower weight, so size has since been measured in virtual bytes (vB) rather than plain ones. The same payment became roughly a quarter cheaper, and an old flaw that allowed the transaction identifier to be altered before confirmation disappeared with it. Taproot (2021) added Schnorr signatures, which can be merged into one: a multisignature wallet or a complex contract then looks like a perfectly ordinary payment on-chain, which is both cheaper and more private.

        Chapter 06

        Mempool and latest blockslive

        This is not a simulation. The data below comes from the real Bitcoin network (via mempool.space) and refreshes every minute: how many transactions are waiting, what fees are being paid and who mined the latest blocks.

        Mempool by fee

        next block … sat/vB ~30 min … sat/vB ~1 h … sat/vB
        loading

        Latest mined blocks

        loading

        Miners pick the transactions with the highest fee per byte (sat/vB) out of the mempool. Roughly 2 MB of data fits into a block, so when the mempool is full the price of space rises. One bar is one fee band.

        Chapter 07

        Mining: proof of work, live

        A miner changes the nonce and hashes the block header over and over until the hash starts with enough zeros. Try it: the computation runs in Web Workers, so you can even spin up a small mining pool.

        SHA-256 block hash
        press Mine
        0nonce
        0attempts
        0hashes/s
        0,0 stime

        The real network today requires a hash starting with roughly 19 zeros (in hexadecimal). Difficulty readjusts automatically every 2016 blocks so that a new block arrives every ten minutes on average, however many miners there are.

        Chapter 08

        Difficulty adjustment: the thermostat of the network

        Miners come and go, but a block has to arrive every ten minutes. Bitcoin solves this without any governing body: every 2016 blocks the network measures how fast it went and adjusts difficulty by exactly that ratio. Move the network power and watch the pace return.

        +60 %

        Where the network stands right now

        loading

        The change is clamped to a factor of four in both directions so that a single swing cannot throw the network off. This simple feedback loop is why Bitcoin needs nobody to manage mining.

        Chapter 09

        Blockchain: try to forge it

        Every block contains the hash of the previous one. Change the text in any block and watch the chain break from that point on. To repair it you must re-mine that block, and then every block after it. In the real network you would also have to outrun the mining power of the entire world.

        This is exactly what makes Bitcoin immutable: rewriting history means repeating all the work from the changed block onward and still outrunning the honest chain. The chain with the most proven work is the one that counts.

        Chapter 10

        Merkle tree: a fingerprint of every transaction

        Transactions in a block are hashed in pairs until a single hash remains: the merkle root. It sits in the block header and seals the entire content. Click a transaction to see which hashes suffice to prove it really is in the block.

        Thanks to the merkle tree a light client (a mobile wallet, say) can verify a payment using log₂(n) hashes instead of downloading the whole block. With 3000 transactions that is just 12 hashes. This is called an SPV proof.

        Chapter 11

        Peer-to-peer network

        No server, no headquarters. Thousands of equal nodes pass transactions and blocks around like gossip. Every node verifies everything itself and takes nobody at their word.

        The animation shows a network of twenty connected nodes. A transaction spreads from a random node to all its neighbours as an orange wave, and a moment later a found block spreads the same way as a gold wave. No node is superior, information travels from neighbour to neighbour.

        transaction spreading found block spreading node waiting
        Chapter 12

        51 % attack simulator

        An attacker who wants to reverse an already confirmed payment must secretly mine a longer chain than the rest of the world and catch up on the confirmation lead. Set their share of the power and start the race.

        30 %
        Honest network
        Attacker

        The honest network starts with a lead of 6 confirmations. Below 50 % of the power the attacker almost never closes that gap, and every further block crushes their chance exponentially. Above 50 % they always win, but acquiring half the network power costs billions and the attack would destroy the value of the coins seized. The chart uses the formula from the original whitepaper.

        Chapter 13

        Monetary policy: 21 million

        New bitcoins come into existence only as a reward for a mined block, and that reward halves every 210,000 blocks (about four years). The issuance is therefore known decades in advance and nobody can change it.

        Gold curve: how much BTC is in circulation. Orange steps: the block reward (right axis). Vertical lines mark the halvings. The last satoshi will be mined around 2140, after which miners live on fees alone.

        Chapter 14

        Energy: the most common objection

        Bitcoin uses a lot of electricity and there is no point hiding it. The useful questions are how much exactly, in exchange for what, and compared to what.

        Why can it not be made more efficient?

        Because the consumption is not a by-product, it is the lock itself. The security of Bitcoin equals the price an attacker would have to pay to rewrite history. If mining were cheap, the attack would be cheap. Systems without proof of work replace this property with trust in a specific group of people, which is a different trade-off, not a thriftier version of the same thing.

        Does consumption not grow forever?

        No. Miners spend roughly what they earn, and their income is capped by the block reward plus fees. The reward halves every four years, so the main engine of consumption growth is winding down. Higher consumption is always a consequence of a higher price, never a condition for the network to work.

        What kind of energy is actually used?

        A miner is entirely mobile and its only cost is electricity, so it goes where electricity is cheapest. That usually means places with a surplus that cannot be monetised otherwise: hydro during the rainy season, flared natural gas on oil fields, wind and solar off peak. Estimates of the low-carbon share range roughly from 40 to 60 percent, and the methodologies disagree considerably.

        Can any of it be put to use?

        Mining is the only large consumer that can switch off within seconds. In Texas this is already routine: when the grid is strained, miners power down and free up capacity for households. Waste heat is now used to warm greenhouses, timber kilns and apartment buildings.

        The figures in the chart are order-of-magnitude estimates, not measurements. Bitcoin consumption is tracked by the Cambridge Centre for Alternative Finance, and even its own estimate spans tens of percent, because nobody knows the exact mix of mining hardware in use.

        Chapter 15

        Privacy: Bitcoin is not anonymous

        The entire history is public and permanent. Addresses are not names, but they are lasting pseudonyms: once one of them is tied to your identity, a great deal can be worked out backwards. Flip the switch and see the difference a single habit makes.

        Where does the link to your name appear?

        Most often at an exchange with identity verification. The moment you withdraw coins from it to your address, the exchange (and anyone who reaches its data) knows the address is yours. Everything leaving it can be followed from there. Publishing an address on a profile or an invoice is just as revealing.

        What can be done about it?

        The basics are never reusing an address, which today wallets handle by themselves. Beyond that it helps not to mix coins from different sources in one transaction, to run your own node instead of somebody else server, and to consider coinjoin for larger amounts. It is not perfect privacy, but the gap between no effort and basic hygiene is enormous.

        Chain analysis is an entire industry, and the firms in it are good at clustering addresses by transaction patterns. Assume that anything you write into the chain today will still be readable in twenty years.

        Chapter 16

        Lightning: payments off the main chain

        The main chain handles roughly seven transactions per second and that will not change, because every node in the world has to verify each of them. Lightning goes around it differently: two people open a channel with one on-chain transaction and then send each other as many payments as they like, none of which the blockchain ever sees.

        Alice Bob
        0,050000000,05000000
        0off-chain payments
        1on-chain transactions
        0writes saved

        You do not need a channel with everyone

        Alice has no channel with the cafe, but she has one with Nora, Nora with Dan, and Dan with the cafe. The payment travels this path all at once or not at all, so no intermediary can keep it.

        Lightning is neither free nor without trade-offs: channel capacity is capped by what was put into it, and receiving payments requires being online. In exchange you get payments that settle in milliseconds and cost a fraction of a cent.

        Chapter 17

        Calculator

        One bitcoin divides into 100,000,000 satoshis. The conversion uses the live price from the page header.

        What a transaction costs right now

        loading

        The fee is paid for the size of the transaction, not the amount sent. Sending a thousand euros or a million costs exactly the same, but a payment from ten small inputs is ten times more expensive than one from a single large one.

        Chapter 18

        Glossary

        Eighteen terms that came up on this page. Underlined terms in the text above show their explanation right under the cursor.

        Chapter 19

        Sources and further reading

        This page is an introduction. If a chapter caught your attention, here is where to go deeper.

        The links lead to external sites unaffiliated with oliprok.sk. None of this is investment advice.