Last Updated: 1st November 2018
Bitcoin is a peer-to-peer digital currency that was created by an individual or group under the pseudonym Satoshi Nakamoto. Bitcoin allows for individuals to make online payments without the need of a financial intermediary. Thus, the very premise of Bitcoin is to facilitate a trustless and online transaction-based ecosystem. Bitcoin is able to do this by:
- Solving the double-spend problem
- Timestamping transactions
- Timestamping transactions through the use of proof-of-work
The double-spend problem is an issue that is uniquely particular to digital currencies. The problem describes a scenario in which a digital currency can be spent twice. This complication exists because like much of the digital world, digital information contained within it can be reproduced rather easily. One solution to the double-spend problem prior to Bitcoin was to incorporate a trusted central authority that monitored every transaction for double-spending. However, the limitation of this model is that it requires trust. This central authority could just as easily mislead individuals as to if coins were being double-spent. Satoshi effected a model that was trustless (Bitcoin), wherein the operation of the ecosystem was not based on the trustworthiness of individuals subsisting within it. Bitcoin overcomes the double-spend problem by serving as a system that allows for all transactions ever made to be recorded. In other words, by being aware of all transactions that have ever taken place on the network, the system can identify any double-spend attempts. Bitcoin achieves this by requiring all transactions to be publicly broadcasted, and then implementing a system that ensures that network participants agree on a single history of order in which those transactions have been received.
Network participants are induced to agree on a single history through the use of a timestamp server. A timestamp server functions by taking the hash of a block of transactions and publicly broadcasting that hash. This hash serves as proof that a block of transactions existed at a given time, which allows for network participants to verify the order in which blocks of transactions were broadcasted. Each timestamp of a block on the Bitcoin blockchain includes the timestamp of the previous block, thus forming a publicly verifiable chain of transactions. With it now possible to have a permanent history of all transactions that have ever taken place on the blockchain, there now must be a system that is able to check incoming transactions and compare them to previous transactions to ensure that there are no double-spends occurring. Moreover, this system needs to be decentralized, such a system is known as proof-of-work on Bitcoin.
Proof of Work
Proof-of-work, on the Bitcoin network is known as ‘mining’, and the individuals that participate in this activity are known as ‘miners’. Proof-of-work involves hashing the header of blocks on the blockchain (which form the input), using a cryptographic hash function, which for Bitcoin is Secure Hash Algorithm 256 (SHA-256). This procedure requires hashing slight variations of the input by including an arbitrary number (a nonce), each time the input is hashed. Hashing is performed until a hash value is found that gives a block hash beginning with a number of leading zero bits. Once found, miners are given the right to add a block to the blockchain. Miners must make sure to form blocks that follow the network consensus rules, which include:
- Transaction outputs cannot be double-spent
- Transactions and blocks must be in the correct format
- Blocks may only release a certain number of bitcoins as a block reward
(Note: These are just a few consensus rules on the Bitcoin network, there are a lot more)
It is by using proof-of-work, a peer-to-peer implementation of a decentralized timestamp server, that attempts at double-spending can be detected.
Blocks that are added to the blockchain through the proof-of-work process are also designed to be tamper-resistant against bad actors on the network. As successive blocks are added to the chain, going back to alter data within a previous block becomes extremely difficult. This is because, to alter a previous block, a bad actor would have to redo the proof of work (recompute the hash) of that block and all blocks after it. Such an attack would come with a very high financial cost, which has proved sufficient to prevent any attacks from occurring on the Bitcoin network thus far.
A simple overview of the Bitcoin network is as follows:
1. New transactions are broadcast to all nodes
2. Mining nodes collect these transactions to form a block compliant with network consensus rules
3. Each mining node works on finding a valid proof-of-work hash for its block
4. When a mining node finds a valid proof-of-work hash, it broadcasts the block to other nodes on the network
5. Nodes accept the block only if it complies with the consensus rules e.g. transactions not double-spent
6. Mining 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
Miners that participate in the mining process are rewarded in bitcoins in exchange for expending computing resources, which is known as a block reward. This reward mechanism also serves as a way to distribute bitcoins into circulation, as there is no central authority to issue them. The total number of bitcoins that will enter into circulation is capped at 21 million. After this number has been reached, miners can take transaction fees as a reward for partaking in the mining process. Thus, the incentive mechanism on the Bitcoin network can transition from being based on block rewards to an entirely inflation free and transaction orientated ecosystem.