Inside Bitcoin - The Block Chain
Written by Mike James   
Thursday, 30 December 2021
Article Index
Inside Bitcoin - The Block Chain
Proof of work algorithm

Bitcoin is a currency that exists entirely in software and is under the control of no central authority. What is really important about Bitcoin, however, are the algorithms that make it all work. We explain the way the Block Chain works. 



Money is going out of fashion. Well coins, notes and cheques most certainly are and are being replaced by electronic transactions of all kinds. It has been a very long time since the numbers in your bank account had anything to do with real money.

Yes, once upon a time currency was something that stood in as a token for something valuable - like gold - but modern currencies are more a mass delusion that we all agree to. As long as we all agree that a currency has value, and preferably the same value, then it all works.

At the moment the only agencies capable of pulling this trick off are national governments - or this was the case until Bitcoin came along.

To find out what Bitcoin is and the problem it is intended to solve watch the following video: 


It has to be admitted that some of the ideas in the video are a little dated and things have moved on a little. In particular the role of Bitcoin as a micro-payment currency has turned out to be more difficult than expected and we are still some way off being able to process the volume of transactions that would be needed to allow everyone to buy a coffee in any coffee shop. As things have turned out Bitcoin is more useful as a "special" way of paying for things not an everyday currency - but with small tweeks in the algorithm this could change.

There are other crypto currencies that are much more suitable as payment systems - Bitcoin is an investment, a way of laundering money and a way of conducting secret funds transfer.

A distributed monetary system

Bitcoin is an attempt to set up a distributed monetary system, i.e. one that has no central administration or control and at the moment it seems to be working.

As of the start of 2022 there are just over 18 million Bitcoins in circulation and the value has rocketed from approximately nothing to around $45,000 per Bitcoin, making the total Bitcoin economy worth over $800 billion. Not bad for software!

So how does it all work?

First we take a look at the general principles of operation and then we will look a little deeper in the strange algorithms used to keep Bitcoin secure and fair while allowing for a distributed architecture.




Bitcoin Basics

Bitcoin works by using a freely available database supported by a peer-to-peer network. It was created in 2009 by Satoshi Nakamoto, who has since vanished and exactly who is or was is a source of much interest, and even though it is still in "beta" and probably always will be, it has been steadily creating digital money in the form of Bitcoins since then.

Digital signatures are used to track the exchange of the tokens.The signatures are unique but in principle they cannot be tracked back to individual identities.

This means that you can know that user 123456 transferred so many Bitcoins to user 78901 but not who the numbers correspond to. This makes Bitcoin transactions inherently anonymous.

User 78901 can make a transfer of the Bitcoin they own because they and only they have the private key corresponding to the public key used to create the signature associated with the Bitcoin. 

This makes it possible to own a Bitcoin and control what happens to it without anyone needing to know who exactly you are and thus providing anonymity. 

This also makes the Bitcoin system very attractive to anyone wanting to engage in dishonest activities such as money laundering or avoiding taxes. There is no evidence that the bulk of the Bitcoin economy is in any way illegal, but this is probably a worry - or a justification for many governments to view it with suspicion. In recent times it certainly has made ransomware possible. 

The use of public key encryption and signatures renders the Bitcoin secure and anonymous but there is another problem.

All Bitcoin transactions are stored in a freely accessible database, the block chain, and making sure that updates to this database remain coherent is very difficult. For example, one copy of the database might record that a Bitcoin has been transferred to owner A and another copy of the database might show it as transferred to owner B. Worse a failure to record the time of a transaction correctly could allow a Bitcoin to be spent more than once.

Such problems are easy enough to overcome in a single copy of a central database that is administered by a single appointed authority but the Bitcoin database is stored on many machines and there is no single authority to update it. 

Now we come to the complicated but very interesting part.

We need to validate each transaction. This is fairly easy all that has to be done is to confirm that the coins being transferred are correctly signed and the date and time stamps are ok. Any server on the Bitcoin P2P network could do this - the question is who should do it? The transaction only becomes valid once it is added to the block chain but which servers validation do you accept as being correct. 

You have to keep in mind that there are multiple copies of the database and each server is attempting to update it with new transactions. The problem you have to solve is which update to accept as the one true new version of the database.

You need to pick a server more or less at random to ensure that there can be no organized dishonest validations. If servers were selected in any regular predictable way then it would be possible to organize a dishonest syndicate that would make the currency completely untrust worthy. One of the big innovations in the Bitcoin algorithm is the use of a proof of work to essentially randomize the choice of server that is allowed to update the database - more of this later. 

The next question to answer is why would anyone set up a server to validate Bitcoin transactions?

The first transaction in any block of transactions is always the payment of a new batch of  Bitcoins to the owner of the machine that successfully validates it. This mean that users participating in the P2P network get paid for the work they they do in maintaining the block chain in newly minted Bitcoins. This is also how the new currency is distributed. Slowly but surely Bitcoins are being handed out for work done helping to run the Bitcoin system. This is called Bitcoin mining and it is a big business. Most Bitcoin mining is done today by specialized data centers built using custom chips that are dedicated to solving the Bitcoin proof of work problem. These data centers consume lots of electricity and cost millions to create but they seem to be profitable. 

The system is designed so that the total number of Bitcoins in circulation tends toward 21 million exponentially - so 90% of this figure will have been generated by the start of 2022. This means that the money supply is subject to a controlled inflation. But printing money doesn't necessarily lead to a fall in its values. When Bitcoin was launched one Bitcoin was worth around $0.05 now they are worth around $45,000 each. In fact as the supply of Bitcoins will eventually dry up it has a built-in deflationary tendency.

What happens once the supply of new Bitcoins dries up or becomes too small to make mining profitable? 

The answer is that there is a mechanism that allows users to pay for their transaction to be processed - a mining fee. Mining fees are slowly being phased in and this is a difficult transition for the Bitcoin infrastructure. Mining fees can also be used to speed up the processing of transactions. Clearly a mining operation is going to try to validate transactions that include bigger mining fees first to maximize their profits.  In the future there will be no Bitcoin mining only Bitcoin processing for a fee.

If one Bitcoin is currently worth $45,000 how can you use it to buy a coffee say?

People who first encounter the Bitcoin idea tend to think that a Bitcoin is a thing. You own it for a while and then you spend it just as if it was a real coin. However this isn't how things work.

A Bitcoin is just an entry in the Bitcoin ledger - the block chain. An entry simply records the number of Bitcoins and the signature of the owner. What this means is that you can spend and receive fractions of a Bitcoin. For example you can receive a single Bitcoin and you would have 1 BTC. You could then spend 0.1 BTC and you would have 0.9 BTC left to spend. In this sense there really isn't a Bitcoin entity that is anything like a real physical coin - its all a matter of book keeping and tracing who owns all the different fractions of the Bitcoins ever minted. 

Currently the smallest fraction of a Bitcoin the block chain can record is 0.00000001 BTC which is called a Satoshi in honor of Bitcoin's creator. Currently one Satoshi is worth

A strange problem is caused by the way Bitcoin is split into small fractions is that the ledger is getting larger and larger due to the need to track ever smaller fragments of Bitcoin. You might receive a single Bitcoin in payment - a single transaction in the ledger that says you own 1 BTC. Then you spend it in ten fragments adding ten transactions to the ledger showing the ten people who own the ten 0.1 BTC.

If the entities who had these Bitcoin fragments sent them back you then you would own one Bitcoin again but this time there would be still be ten ledger transactions recording the fact you now owned ten 0.1BTC i.e. 1 BTC. When you started you had one transaction which showed you owned 1BTC and after spending the money and getting it back you now have ten transactions that show you own a total of 1BTC. 

In principle this shouldn't be a problem but the next time you want to spend that same Bitcoin to a single entity you have to submit ten transactions all transferring ownership of the fragment to the same entity.

This is fine apart from the problem of possibly having to pay a mining fee on ten transactions rather than one. There is no easy way to consolidate lots of Bitcoin fragments you own - often called Bitcoin dust - into one transaction in the ledger because a transaction back to yourself still has mining fees.  The best you can do is to submit the consolidation transaction to a mining pool with a low fee and wait until it has spare capacity to process your request. 

There is finally the deep mystery of how bits generated by an algorithm can acquire a monetary value. People seem to find this a very strange process how can something go from nothing to being worth hundreds of dollars? Where does the value come from?

This isn't really anything to to do with programming or technology. It is a matter of economics and some even go so far to characterize Bitcoin as the biggest economic experiment ever. 

You can buy and sell Bitcoins with other currencies and you can use them to buy (at the moment a limited range of) services and goods. Just by being controlled and reliable the Bitcoin has acquired value.

This is how all currencies work.

Of course the actual situation isn't quite a rosy as the Bitcoin enthusiasts would have you believe. While you can spend Bitcoins in a variety of places they aren't regular currency just yet. You can't for example buy a book from say Amazon or trade on E-bay using Bitcoins. And in most places in the world you can't buy a coffee with a Bitcoin transaction. Some of the reason for this is that any new technology is slow to spread but a more important reason is that the number of Bitcoins transactions that can be processed per second is low compared to other payment methods such as credit card. For Bitcoin to move to a wider audience and use it will probably take some changes in the way it is implemented.








Last Updated ( Thursday, 30 December 2021 )