Bitcoin Whitepaper, Elaborated: A Peer-to-Peer Electronic Cash System, Part 1

In the theme of recent Blockchain projects, today I’ll walk you through the famous Satoshi Nakamoto Bitcoin white paper.  This is the grand poo-bah paper that kicked off the blockchain hype cycle. I’ll highlight key concepts, and aim to make the concepts accessible at to any level of reader. Since there’s a lot to cover, I plan to break this into two posts. For a step-by-step implementation of a blockchain, see my series of posts on implementing one in Python.

There are several ways you might choose to use my commentary: You could read it as a stand-alone, read it alongside the original paper as an understanding aid, or for a time-crunched reader, just read the Abstract to have a sense of what Satoshi Nakamoto sought to accomplish with inventing Bitcoin.

A bit of background, this paper was published in 2008, after a financial debacle caused by banks, that the government claimed to have been regulating. The result of that crash was a bolstered wave of distrust towards central banking, and government backed currency.  Satoshi Nakamoto looked to solve that problem by removing the necessity for banks as an intermediary for electronic transactions. A bit of legend behind Bitcoin is the mystery of Nakamoto’s identity; Nakamoto was a pseudonym, and the original author or authors have never been identified.

Abstract

Key Terms: Peer-to-peer, digital signatures, double-spend problem, proof-of-work, node computers, hashing, attackers

Satoshi Nakamoto begins by proposing the possibility of a way for two parties to perform transactions, without the existence of a third party, a peer-to-peer system.  Nakomoto explains the main challenge, the double-spend problem: in traditional transactions, a third party is required to ensure that one party has given electronic money to the other party, and can’t spoof that electronic money  to spend it again elsewhere. An existing cryptographic process called a digital signature, where the spending party “signs” their transaction in a way that would be difficult for others to imitate, prevents others from pretending to be the spending party, but would not prevent the spender to re-spend their electronic money.

As a solution to these problems Nakamoto proposes an algorithm that would solve the double-spend problem by a chain of “hash-based proof-of-work” records.  A hash is a cryptographic method for transforming data, such that it is difficult (near impossible) to guess the original data. The key hash elements in this case would be: a timestamp, the transaction, and a proof-of-work record. Proof-of-work is a string of data originating from a network of computers attempting to solve a particular algorithm, that together with some set of transactions, forms a block in an ever-lengthening chain. Each computer in the network is a node, and stores a full copy of the chain.

The main obstacle in any information system is how it may be attacked. In this case, attackers would like to spoof the blockchain and convince other nodes in the network that their version of the chain is the legitimate version.  In this scenario, they would be able to steal bitcoin, by faking transactions sending bitcoin to their address.  However, each node in the network stores the longest chain of blocks, and each node is constantly comparing its chain with its neighbors. To fake a new chain, attackers would need to control half of the CPU power in the network, to convince the other half of the new chain’s legitimacy. That’s the key advantage of the blockchain: it becomes very difficult to attack, as it would be near impossible to control over half of all available processing power on the network, and increasingly so as the network grows.

Introduction

Key Terms: trust-based-model, non-reversible transactions, cryptographic proof, cryptographically hard

In the introduction, Nakamoto outlines the weaknesses of relying on third parties for electronic transactions, the trust-based-model:

  • Non-reversible transactions for non-reversible services are impossible for financial institutions
    • Example: if I hire a landscaper, then dispute his invoice to my bank, he may lower his fee if I drop my dispute, or sacrifice time and possibly money to fight my dispute, a lose-lose for any non-reversible service provider. This means service providers need to trust both me, as the purchaser and the bank as the middle man, while providing a service.
  • Financial institutions exact invisible transaction costs for mediating disputes between parties, even on transactions that are undisputed
  • Financial institutions are frauded some percentage of transactions, which can be avoided in systems without a trusted party

In a system with cryptographic-proof of transaction, these problems are avoidable. Cryptographic-proof based exchange eliminates the need for trust in an exchange of currency for services. What is meant by cryptographic proof: a record of a transaction that is cryptographically hard (math-speak for impossible) to fake or reverse. The exchange system of cryptographic-proof, as mentioned in the abstract, is impossible to fool, without a majority of the computing power in the network.

Transactions

Key Terms: electric coin, public key, wallet address, private key

An electric coin (eg. a bitcoin) owned by one party (the sender) is sent to another party (the payee) by digitally signing both: a hash of the previous transaction, and the public key of of the receiving party.  Digital signing requires a private key (secret), from which the public key is calculated from.  The payee can verify the source of the coin by checking the signature with the sender’s public key.

The sender can always find the public key if they have the payee’s wallet address. The sender can send fractions of a bitcoin as well, down to .00000001 (10E-8) Bitcoin (nicknamed a Satoshi).

Screen Shot 2018-09-19 at 6.17.18 PMUsing Public Key Cryptography to sign and verify transactions

Each transaction is stored in the blockchain. In the double spend problem the signer of a transaction attempt to sign several transactions using the same electronic cash. This is impossible on a blockchain, as the blockchain indicates the owner (or rather, address) of each unit of electronic cash for everyone to see.

Timestamp Server

Each block of transactions is timestamped, and published to the blockchain. Each additional block added to the blockchain uses the hash of the previous block, including the time stamp. Each additional block in the chain then reinforces the security of blocks before it; it’s more difficult to fake 2 blocks than 1 block.

Screen Shot 2018-09-19 at 6.17.25 PMHashes of future blocks rely on hashes of previous blocks, setting transaction history in stone, making it harder to attack

Proof-of-Work

Key Terms: proof-of-work, SHA-256, nonce

The Proof-of-Work algorithm is actually very simple. The algorithm is a competition between all participating nodes to hash values with SHA-256, the current standard hashing algorithm produced and approved by the NSA (there’s a conspiracy as to whether they know how to break it). The first node to find a value that hashes to a number that starts with some pre-specified number of zeroes (a number starting with that many zeroes is a nonce) wins the competition, and puts the block of transactions on the chain with their nonce hash.  That node shares it’s new chain with other nodes in the network, and all nodes begin again finding a new nonce for the next block.  This step will be explored in more depth in the next section. As a reward, that node gets a new bitcoin, and a small percentage of all the transactions in the block.

Screen Shot 2018-09-19 at 6.17.48 PMBlocks of several transactions, a hash, and a nonce layered one after another

Attacking the chain would require repeating the computation each block deep that the attacker desired to change, and outweighing the existing network’s computing power, to recompute each step faster than the existing network.

Since hardware increases speed over time, and the network of competing nodes is likely to grow, the difficulty of each new nonce increases to compensate.

Network

Key terms: longest chain, tie break 

Directly from the original paper, the steps of sharing with the network are:

New transactions are broadcast to all nodes.

Each node collects new transactions into a block.

Each node works on finding a difficult proof-of-work for its block.

When a node finds a proof-of-work, it broadcasts the block to all nodes.

Nodes accept the block only if all transactions in it are valid and not already spent.

Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.

Nodes default to preferring the longest chain from their neighbors, as longest equates to most recent.

When two nodes simultaneously solve the next block, if one solved the block first, it wins. If it’s truly simultaneous, a tie break is dependent on where the next proof-of-work is found, and all nodes accept the new longest chain as legitimate.


Wrapping up here. Join me again next week for Part 2.

One thought on “Bitcoin Whitepaper, Elaborated: A Peer-to-Peer Electronic Cash System, Part 1”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s