The Engineering of Bitcoin

Share:

In the early 2000’s central banks mismanaged interest rates contributing to the formation of a massive property bubble around the world. The ensuing financial crisis was followed by bailouts for the so called “too big to fail” institutions that had caused the aforementioned bubble workers were left to suffer the most dire consequences of the recession. By the end of 2008, there was a generalized feeling of anger towards the prevalent monetary system, trust had been broken, perhaps irrevocably.

In this climate of mistrust and discontent, a pseudonymous programmer known as Satoshi Nakamoto brought to the world Bitcoin, a new digital monetary system which doesn’t require trust in any central authority. Before Bitcoin’s creation, there had been numerous attempts to create decentralized digital currencies which had invariably failed due to weaknesses and vulnerabilities in their design.

Nakamoto learnt from his predecessors shortcomings and masterfully combined pre-existing technologies in order to engineer a robust and secure monetary system. However, explaining the design principles of Bitcoin is not an easy task, in the words of Satoshi: “Writing a description for this thing for general audiences is bloody hard. There’s nothing to relate it to.”

In this article we will attempt to understand the design principles of Nakamoto’s revolutionary invention in a clear and accessible manner.

1- Prevent Copying of Coins

The first and most obvious problem of creating a digital monetary system is ensuring that the coins can´t be copied freely. The digital realm allows for the the creation of perfect copies of almost anything, and any currency that can be copied infinitely would be worthless.

In Satoshi’s system bitcoins don´t exist as separate entities, instead, there is a common ledger which keeps a record of the ownership of coins by each user. Transactions are added to the ledger in sequences of blocks which are bonded or “chained” together, hence why we often refer to Bitcoin’s data structure as a blockchain. The Bitcoin blockchain contains all transactions performed within the systems since its inception in January 2009.

Blockchain technology existed prior to Satoshi’s invention, the first blockhain was invented in the 1990’s by Stuart Haber and W Scott Stornetta, who were seeking a mechanism to prevent the tampering of digital records. Their solution was to append new information to the database in a sequence of blocks that were cryptographically sealed using hash functions.

This mechanism made it easy to append new information to the ledger but very hard to tamper old information. This is a big difference with traditional databases which allow users to constantly change and even delete data that have been stored in the past.

Traditional vs cryptographically secured database

Satoshi used the mechanism developed by Harber and Stornetta to partially prevent the infinite copying of currency in the Bitcoin system. Since Bitcoins exist only as references on a cryptographically sealed ledger, it´s not possible for a single user to make infinite copies of their coins.

Antique Accounting Ledger

2- Resist Censorship

The second challenge Satoshi faced in the engineering of Bitcoin was ensuring that his creation could´t be shut down by an attacker such as a state actor. In order to do so, it is likely that Nakamoto drew inspiration from events in the music and file sharing industry.

Some years prior to the advent of Bitcoin, file sharing software such as Napster and LimeWire had gained tremendous popularity since they allowed users to seamlessly and freely share their audio and video files. Eventually, these systems ended up being shut down by governments for copyright infringement.

However, there was a file sharing software known as Bittorrent which managed to run incorruptibly, proving its resilience to state censorship. What separated Bittorrent from other softwares was that it wasn´t hosted in a central server, instead the files were split and distributed among a network of computers scattered throughout the world.

Satoshi applied the same logic to Bitcoin, the bitcoin ledger and the other parts of it’s software would be copied in a network of computers. By not having a single location with a central server, it would be impossible for a government to locate and close down the system.

Distributed Software

3- Issue Accounts and Sign Transactions Without a Central Authority

In a centralized system, central authority such as a bank is in charge of creating accounts and approving the movements of funds between users. In order for the software to create accounts and approve transactions autonomously, Satoshi made use of a pre-existing technology known as Public-key cryptography, or asymmetric cryptography.

Cryptography is the study of secure communications techniques that allow only the sender and intended recipient of a message to view its contents. The term is derived from the Greek word kryptos, which means hidden.

The Bitcoin software uses asymetric cryptography to create both a public and a private key for each new entry in the Bitcoin ledger. The public key acts as an address enabling the user to receive funds and the private key acts as a password. Funds can only be moved from a public address by entering the private key, in other words, anybody with access to a private key can take the funds associated with a particular address. Thus, much emphasis in the Bitcoin world is given to the security and custody of private keys.

Asymmetric cryptography can be trusted for two reasons:

  • It is possible to derive a public key from the private key but it is impossible to derive the private key from the public key.
  • It is infeasible to guess someone’s private key. The potential number of private keys is so large that the probability of someone guessing it is equal to the probability of guessing the position of a single atom in the observable universe.

Thus, asymetric cryptography allows the Bitcoin software to autonomously hand out accounts and verify the signature behind a transactions without the need for a central authority.

4- Update the Blockchain Without a Central Authority

In the traditional financial system, central authorities such as banks are in charge of editing the ledger of showing the balance of each account. So far, we have seen how the Bitcoin software validates the ownership of funds by using asymmetric cryptography and prevents censorship by having a distributed ledger formed by blocks of transactions linked cryptographically to make any tampering of past data evident.

However, if Satoshi wanted to create a trully decentralized system, he needed to solve two key challenges:

1- Devise a trustless incentive mechanism do deter spam attacks and ensure only valid transactions are added to the ledger (Sybil Resistance Mechanism).

2- Engineer a trutless mechanism to esnure that all network participants agree upon the same history of transactions without central coordination.

1- Devise a mechanism for processing the transactions of users and update the ledger without a trusted third party.

In order to ensure that blocks of transactions are added to the ledger and no user cheats the system (for example by giving themselves more coins), Satoshi made use of an existing technology known as proof of work.

Without getting into the technical details, proof of Work works in the following manner:

1- The Proof of Work algorithm automatically generates a mathematical challenge; to find a number smaller than a target number named (nonce). The only way to find the target number is by executing cryptographic sha256 functions repeatedly until the number is found. Anyone can join the ntwork and expended their computational power to find a nonce and add transactions to the ledger.

2- Once the nonce has been identified by a miner, other participants can run SHA256 on this number to instantly confirm the validity of the nonce. Proof of work is hard to produce but very easy to verify.

3- The transactions of users are compressed into a block and added to a chain, effectively updating the ledger.

4- As payment for their services, miners receive a block reward consisting of transaction fees and new bitcoins.

Proof of Work mining illustration

The genius of the Proof of Work mechanism is that it introduces a strong financial disincentive to attack the rules of the system such as mining an invalid block or censoring a particular user.

  • If a miner mines a block that doesn´t follow the rules of the system (for example by spending the same coins more than once), it will be rejected by the rest of the nodes and they won’t receive a reward. Miners are desincentivized from sending invalid blocks since they would be incurring a cost and would gain nothing in return.
  • If a miner tries to censor certain transactions they will receive a lower reward and the transactions will be included by the next miner to identify a valid nonce.

Both the attempt to edit the ledger maliciously and the censoring of transactions results in the attacker self-inflicting a loss with no reward in return. Thus, proof of work incentives honest updating of the ledger with no central authority.

2- Ensure that there are no discrepancies between the versions of the ledger held by each network participant.

Sotrnetta’s blockchain relied on trusted third party (The New York Times) to timestamp transactions but previous digital currencies that relied on a trusted third party such had been shut down. In order to have a truly decentralized and censorship resistance monetary system, Satoshi had to find a decentralized way to timestamp Bitcoin’s blocks of transactions

The above issue had been a massive challenge in the field of decentralized computation known as the byzantine general’s problem. Satoshi had to find a decentralized mechanism to determine the order of transactions to prevent users from defrauding the system (for example by spending their coins more than once. That time stamping was the root problem to be solved is also apparent by examining the refer­ence at the end of the Bitcoin whitepaper — out of the eight references in total, three are about time-stamping.

In order to order transactions chronologically and have all network participants agree on the correct version of the ledger, Satoshi made use of the aforementioned proof of work mechanism. Proof of work takes time to complete and it isn´t controlled by any one entity, allowing the Bitcoin software to autonomously determine the order of transactions. In case of discrepancies betweek parcitipants, the system achieves consensus by using the “longest chain rule”: the longest version of the ledger with the most proof of work is always the correct version of the blockchain.

The chain with the most Proof of Work is always the valid chain

In this way, instead of relying on a single source to determine the chronological order of transactions, the system trusts in the laws of thermodynamics— which cannot be altered by any individual.

The combination of Proof of Work mining and the longest chain rule is known as Nakamoto Consensus, which solves the two key challenges surrounding the honest updating of the ledger:

  1. Proof of Work disincentives malicious behavior, since attempts to attack the network are costly and yield no reward.
  2. Timestamp transactions without an external
  3. The longest chain rule allows all network participants to agree on the true version of the ledger trusting physics instead of a third party.

For the above reasons, most Bitcoiners consider Proof of Work to be absolutely essential to have a a truly decentralized monetary system.

5- Decentralized Money Supply Management

We have seen how Proof of Work desincentivizes miners from spaming the system, but how could Satoshi incentivize it? In comes the creation of coins, which are handed out during the mining process.

It wasn´t enough to just give a digital coin, the coin needed to have value to pay for the system’s security. If the coins had no value, nobody would be expected to spend their electricity mining them. Hence, Satoshi created Bitcoin with a Limit of 21 Million coins.

By creating a purely scarce asset, he expected individuals might start to value value it:

In Bitcoin there is no central authority in charge of controlling the money supply. However Satoshi needed the coins to be issued in a limited, predetermined amount respecting the 21 Million limit. In order to achieve this every 4 years, the block reward is cut in half and so does Bitoin’s inflation rate:

But how could satoshi keep the inflation rate stable? f miners are rewarded with new coins with every block they mine, what if new miners enter the system, wouldn´t the supply accelerate? How to keep a predictable supply schedule without a central authority?

Roughly every 2 weeks the software automatically adjusts difficulty of the mathematical challenge is increased or decreased depending on how long it took for the previous challenge to get solved. In this way, the block time and hence supply of new coins is kept constant regardless of how many miners join or leave the mining process.

In this way, Bitcoin becomes the only asset with a 100% inelastic money supply which is predetermined by the code. The singularity of Bitcoin’s monetary supply explains the abrupt changes in its price as supply doesn’t respond to changes in price.

Conclusions

Satoshi Nakamoto wasn´t a random programmer who woke up one morning and had the idea to invent a decentralized monetary system. His work stood on the shoulders of giants, he built Bitcoin by combining a series of pre-existing technologies with the right balance of incentives that lead to a robust and game theoretically sound system:

Engineering of Bitcoin: Main Challenges and Solutions

The advent of Bitcoin was a huge impulse for the science of distributed computing. The next article explores how others would expand Blockchain technology to try and provide other non monetary services that could also benefit from decentralization.