In the last post, we uncovered exactly what a Bitcoin address is and how one can be secured using modern cryptography.
In this post we are going to delve into the database underpinning bitcoin and learn how it is structured. That database is known as a blockchain:
A blockchain is simply a distributed database
For many years, it was thought that fully decentralised digital currencies were impossible. The reason being the problem of double spending. How do you ensure that a digital coin has not been copied electronically and therefore spent repeatedly without the use of a central authority for verification?
A blockchain is a digital distributed ledger, shared via peer to peer networking. It records transactions in a series of blocks.
A block contains a batch of valid transactions, a timestamp and a reference to the previous block in the chain
The effect is that the blocks are linked together in a long chain, hence the name, blockchain.
The link to the previous block acts to secure the entire chain as it means that it is not possible to change a given block without computers on the network colluding to change all subsequent blocks. As a result, the older a block, the more computationally expensive it becomes to alter. Participants of the network can quickly audit the chain of blocks and determine it's collective authenticity.
A new block is issued by the Bitcoin network through a process called mining which will be the subject of it's own entire post in the near future. For now, all you need to know is that a new block is issued approximately every 10 minutes and added to the blockchain by the networks participating computers.
Occasionally, it is possible for concurrent competing blocks to be issued at the same time by the network with different computers including a different block as the next block in the chain. So how does each computer determine which blockchain history is the one to trust?
Each computer in the network uses an algorithm for scoring a blockchain. Whenever it receives notice of a new blockchain which contains more blocks that it does (known as block height), it discards its own chain, incorporates the new chain and broadcasts the new chain to the rest of the network. This results in the longest chain generally becoming the dominant chain on the network. Any blocks discarded in the process are known as orphan blocks.
If two competing chains containing different blocks continue for more than a few blocks, the network is said to have forked. At this point there are actually two versions of the network with the same shared history but differing futures. Ultimately market economics will determine their fate and one is likely to emerge as the dominant version with the other gradually dying away.
Identical copies of the blockchain are maintained by all computers in the network. So to alter a transaction, you need to convince more than half of the computers in the network (hence the name, 51% attack) that your new version of events is correct and theirs is not. Given the incredible computational power dedicated to the Bitcoin network, to do this would be prohibitively expensive and therein lies its security.
All full participants in the network (known as nodes) have a copy of the entire blockchain and as a result every transaction ever made on the network is publicly available along with the balance of any given address at any time. As a result, contrary to popular opinion the Bitcoin network is actually not anonymous and in fact is far more transparent than traditional banking. Bitcoin is said to be pseudo anonymous as whilst transactions and addresses are fully transparent, the identify of the owners of those addresses are by default anonymous.
Join me next time as we take a look at Bitcoin mining.