top of page

COURSE 2 - 1.2. How does Bitcoin work?

Let's suppose that Alice owns 0.0001 BTCWhat does this mean, exactly? It means:a) that somewhere there's a ledger (the blockchain) where there's written that someone (say Bob) "sent" Alice 0.0001 BTC (note: if Alice was a Miner, then the Bitcoin protocol itself would have sent her the new bitcoins, not Bob), andb) that this transaction has been independently verified with mathematical certainty; more precisely, by using cryptography (public key digital signatures).

In fact, no bitcoin was "sent" from Bob to Alice: the bitcoins never move from the ledger. What happened is that the power to spend them passed from Bob to Alice.To spend come bitcoins it is necessary to know the private key that controls them. Bob's "sending" 0.0001 BTC to Alice means that the private key necessary to spend them is no more Bob's but Alice's.Every private key generates roughy 4 billions of bitcoin addresses uniquely associeted to it. However, from those addresses it is not possible to determine the private key that generated them.The reason why the addresses are so many is that, for privacy reasons, it is good practice to use a different address for every transaction.

Problem: the ledger is owned and kept updated by whom?The easiest, fastest and cheapest solution would be the centralized one, where one particular person/organization did it.This simple solution, however, would have two important drawbacks:1) it would require trust in that person/organization             2) it would imply a single point of failure.

It would be great if tens of thousands of individuals/organizations could have a copy of the ledger (decentralised solution) and if all these different copies could have the same information at the same time but:without one copy of the ledger being the "central" one (no privileged entities), otherwise there would be a single point of failurewithout the need to trust the owners of the different copiesHow could this be done?This cannot be done. More precisely, it cannot be done via organization/logisticsHowever, it can be done via a structure of free market incentives and cryptography. This is arguably the most important discovery contained in Bitcoin.Let's see how it works...

HOW BITCOIN WORKS

Bob "sends" 0.0001 btc to Alice:1) he authorizes the transaction by signing it with his private key2) he then broadcasts the transaction to one or more nodes (preferably his own node).

The nodes are small computers connected to the Internet: 

  • They keep a full copy of the ledger (blockchain):

    • each block can be seen as a "page" of the ledger;

    • each block has a "cryptographic time stamp";

    • each block is cryptographically linked to the successive blocks.

  • The nodes apply the rules of the network (they are rule enforcers): if a transaction violates the rules, it is automatically rejected by the nodes.

  • In fact, the nodes validate transactions on the grounds of their full copy of the blockchain and of the Bitcoin protocol (the rules governing Bitcoin). In particular, by using cryptography, they automatically make sure:

    • that there's no double spending;

    • that the bitcoins which are being spent in a transaction have not been created out of thin air.

If everything is  OK, the chosen node sends the validated transaction to the other nodes.The validated transaction has not been inserted in the blockchain yet: i.e. it has not been confirmed yet (its status is "pending"). It has only been verified that it is not a fraudolent transaction.In addition to all other necessary info, each transaction includes the bitcoin fee that Bob offers miners to include his transaction in their block and confirm it.

The miners: 

  • select pending transactions on the grounds of the "fee";

  • create a "page" of the ledger (a block) inside which they insert all the pending transactions that they selected;

  • compete in the free market to have the right to attach their own block to the blockchain.

     

The first miner that solves the Proof of Work (PoW) wins: he is adjudicated the block reward (today 6.25, in 2140 zero) and the fees relative to all transactions included in his block (*).

The new block which includes the transaction between Bob and Alice) is "attached" at the blockchain. However, its validity has not yet been confirmed by the nodes (the miner might have committed fraud).

The miner that wins the PoW sends his block to the network of nodes.

Again the nodes: 

  • when they receive the new block from the winning miner, the nodes verify that everything is OK;

  • if it is, they confirm the validity of the block and transmit this confirmation to the network of nodes: this is when Alice and Bob start seeing "confirmations" of the transaction in their wallets.

  • the transaction status changes from "pending" to "confirmed": from now on, the 0.0001 BTC are controlled by Alice's private key: she became the owner.

(*) PROOF OF WORK (PoW):

Intuitively, PoW can be seen as the miner repeatedly throwing a dice with  1,000 numbered faces until the face that comes up shows a number that is equal to or less than the number automatically fixed by the Bitcoin protocol (called "difficulty level"), say 10.The lower this number, the lower is the probability that it comes up with a single roll of the dice. Therefore, the higher the level of difficulty: i.e. the number of times that a miner has to roll the dice.The first miner that, by repeatedly rolling the dice, finds a number that is equal to or less than the "difficulty level" fixed by the Bitcoin protocol, wins.If a losing miner tries to attach his own block to the blockchain his block is automatically discarded because the longest chain always wins (the longest chain being the one having the new block attached by the winning miner).This is at an intuitive level.

In reality, instead of a person rolling dice there is dedicated hardware (ASIC) trying to solve a cryptographical problem (hash) which cannot be solved in an analytical way (i.e. via mathematics) but only via trial and error (brute force).The level of difficulty is automatically fixed by the Bitcoin protocol every 2016 blocks (about 2 weeks) on the grounds of the total amount of energy invested by all miners trying to solve the problem of the PoW (hashing power)This aspect is essential for Bitcoin: both for its monetary "policy" and for its antifragility.Importance of difficulty level for monetary policy: until the year 2140, new bitcoins will enter the market (i.e. a new block will be mined: "attached to the blockchain") every 10 minutes (more or less). If the difficulty level was stable, new bitcoins would enter the market sooner and sooner. In fact, in time, additional miners enter the market and more powerful machines are developed: other conditions being equal, this increases the hashing power and therefore the speed at which the PoW is solved. However, if the difficulty level increases with hashing power, then the pace of 1 block every 10 minutes is maintained.Not the difference with gold, where higher prices economically justify the investment in more powerful extracting machines which in turn allows for more gold to be extracted.

Importance of difficulty level for antifragility: The difficulty level works also in the opposite direction: if for some reason many miners are forced out of the market (e.g. see China, 2021), the hashing rate decreases. In this case, the level of difficulty also decreases, making it much easier to mine blocks: the hashing power that was lost is therefore soon compensated by new hashing power and the 10 minutes interval maintained.Pow consumes energy. This is however a feature of Bitcoin, not a bug. It is this energy that makes it economically impossible to alter the blockchain (and more so in time). If someone wanted to modify a transaction he would have to mine (i.e. spend energy to solve the PoW of) not only that specific transaction but also all successive transactions.

bottom of page