J.P. Morgan announced recently that they have developed their own Ethereum derivative called Quorum. It is designed to be a platform for smart contracts and a distributed ledger based on Blockchain technology.
HSBC, Bank of America, and Merrill Lynch, have also announced they are setting up a Blockchain ledgers system for clearing inter-bank transactions:
And Microsoft and IBM are setting up Blockchain platforms that they can sell to other business, dubbed Blockchain-as-a-service (Baas)
The info that's been released by these companies about how the technologies will actually work is rather sparse though. There seems to be a lot of buzz, but still no clear consensus on exactly how these technologies will work in practice.
In order to try to understand how Blockchains might be important I did some more reading on how they work as part of the Bitcoin protocol, but I actually found myself getting really interested in some of the details of Bitcoin Mining. One of the books I read was the excellent 'Mastering Bitcoins' by Andreas Antonopoulos. It works through all the nitty gritty technical details of the Bitcoins protocol and it really helped crystallise my understanding of some of the technical details. Metaphors about signatures, ledgers, or Alice sending Bob a box with two padlocks on it will only get you so far, at a certain point you need to read through the actual algorithms that are used, and review some source code.
So what is Bitcoin Mining and why is it so interesting?
What is Bitcoin Mining?
Mining is the process by which new transactions are sent over the Bitcoin network and also the process by which new Bitcoins are created. The term Bitcoin Mining is actually a bit of a misnomer, as the creation of the new Bitcoins is not a necessary part of Mining. Even if no new Bitcoins were created, the process of Mining would be the same, and just as important, as it is the mechanism by which transactions are processed within the Bitcoin network.
The network is configured so that approximately every ten minutes one of the miners currently attempting to mine the Bitcoin network will find a solution to the hashing problem which will have the following effects:
In essence, assuming the network is not overloaded by transactions (which at the moment it is due to something called the block size limit controversy, which I might blog about another time) every ten minutes all the new transactions which have been created in the last ten minutes will be processed and sent across the Bitcoin network. All these transactions will be included in the latest block which will be added to the end of the Bitcoin Blockchain. The person who mined this latest block will receive a reward of 12.5 new Bitcoins, and all the transaction fees from the last ten minutes. One thing that I didn't understand when first reading about Bitcoins, is that there is only one Blockchain at any one point (barring something going wrong), and that all transactions across the entire Bitcoin network are processed by a single miner in a single Block which is added to the end of the Blockchain.
The problem which miners need to solve in order to create a new block in the Blockchain is to find a hash generated by running the the SHA256 algorithm twice on the new block so that the number of leading zeros of the hash is less than the current difficulty specified by the bitcoin network. SHA256 is basically just a complicated algorithm that produces outputs that are effectively random. They are random in the sense that it is impossible to predict what output you will get for a given input, but if you use precisely the same input you will get the sense answer every time.
If this sounds a bit complicated, don't worry, it took me ages to get my head around how it all works. Effectively, there is no way to shortcut the above process, SHA256 was designed so that there is no way to predict an input which will generate a given output. If I change the input by a tiny amount, the output will change completely, and there is no pattern to how the output is effected by a chance in the input. The only way to find a valid output is to brute force the problem.
So essentially, the only way to mine a new block is to repeatedly attempt to create a new block using all the information about the transactions you would like to include and adding an arbitrary string to the end of the transactions, which you vary every time you calculate the hash of this input, until you find a value that satisfies the conditions set by the Bitcoin network. If someone else finds a solution before you, then everyone starts again with the new set of transactions.
Total Hashing Power
On average, every ten minutes somewhere in the world a miner will find a valid solution and mine a new block. Whenever the average time to find a solution gets too high or too low, the difficulty of the problem is decreased or increased automatically so as to bring the average time closer to ten minutes. The problem that needs to be solved by the Miners was designed in a clever way so that it could be made arbitrarily hard or easy depending on how many miners are attempting to Mine the network.
What is the monetary value of successfully mining a Bitcoin block? We can easily check this by looking at the average transaction fees from the last few blocks that have been mined. For example in the latest block :
The miner received a reward of 12.5 Bitcoins, and also received 1.5 Bitcoins in transaction fees. At today's exchange rate, a Bitcoin is worth around 3,000 USD, which means each block is worth 42,000 USD to the miner at today's exchange rate. Given six blocks are mined per hour, 24 hours per day. The total value of mining the Bitcoin network is approximately 6 million USD per day, or 2 billion USD per year!
Given these massive sums up for grabs, there has naturally been a huge arms race in miners attempting to capture this value. Given the design of the SHA256 algorithm and the fact that the only way to mine Bitcoins is to brute force the problem, the only way to increase your share of the 2 billion USD pa is to increase the number of hashes you are checking per second.
In fact we can track the total hashing power of the Bitcoin network and see how this has increased over the last 10 years, I took the following graph from Blockchain.info.
We can see that the total hashing power has been increasing exponentially year on year. The total Bitcoin network is currently estimated as running at around 5,000 PetaHashes per second. Which in long form is 5,000,000,000,000,000 hashes per second.
Bitcoin mining was originally carried out by miners using the CPU in a normal desktop computer, but as the number of miners increased, miners started to adapt by using GPU in their computer instead which is much more efficient. Once everyone started to use GPUs though, the next step was for miners to start using something called Field Programmable gate arrays. These are circuits which can be optimised to carry out specific operations very efficiently, so we can set one up that is optimised to carry out the operations that are used in the SHA256 algorithm very efficiently. The latest step in the arms race is the use of circuits called Application Specific Integrated Circuits (ASIC), these are circuits which are designed to do nothing but carry out the specific operations of the SHA256 algorithm extremely efficiently. While the Field Programmable Gate Arrays had been optimised by the people who had bought them to carry out the SHA256 algorithm, the ASICs can do nothing but carry out the algorithm.
So due to the fact that the Bitcoin network uses the SHA256 algorithm to validate blocks, we have the weird situation that manufacturers have mass produced ASIC which have the sole function of carrying out the SHA256 algorithm millions of times a second. Who would have guessed that that would have happened ten years ago?
The Mining Arms Race
The point to remember when thinking about mining is that once the processing power of miners gets above a very small initial threshold, there is no benefit to the network as a whole in increasing the amount of total processing power. The Bitcoin network naturally increases the complexity of the problem that miners need to solve if the total level of hashing increases, so that it always takes approximately ten minutes to mine a block. Bitcoin mining really is an arms race in that if all miners agreed tomorrow to reduce their mining output by 90% there would be no negative effect on the network as a whole, and everyone would still receive the same share of the mining reward. Yet, as soon as one miner starts mining in a much more efficient way, all other miners need to do the same or risk losing out.
What does it matter if all this effort is going into mining Bitcoins?
The issues is that due to the sums involved, we are now globally spending a huge amount of money and computation power on carrying out what effectively counts as pointless calculations. If aliens visited us tomorrow they'd probably ask why we have a network of computers set up which are carrying out quadrillions of calculations per second of the same fairly uninteresting algorithm.
Let's try to put the Bitcoin network into some context. For comparison, the largest Supercomputer in the world is currently the Sunway TaihuLight system at the National Supercomputing centre in Wuxi, China. It has over 10 million cores, and a max speed of 93 PetaFlops per second. Which means it can perform approximately 93,000,000,000,000,000 floating point operations per second.
How does this compare to the total bitcoin network?
It's impossible to compare the network directly given the fact that so much of the current hashing power is dominated by ASICs which are unable to do anything other than calculate the hash function.
We can however attempt to make some comparisons by using other metrics as proxies. When I looked at the most common ASIC used by miners, the Antminer S7 looks to be one of the most widely used circuits by amatuer Miners. It has a hashpower of 4.73 TH/s and comes at a cost of 500 USD. If we divide the total hashing power of the network by the hashpower of the S7, we can derive a (very) rough estimate of the total cost of the hardware currently used in the bitcoin network. This comes out as 500 USD * 5,000 Quadrillion / 4.73 Trillion = 528m USD. We'll use this number later on to estimate the size of the supercomputer we could have brought instead.
Since the above estimate is so rough, let's think another way to estimate the total cost of the computing power making up the Bitcoin Network to give ourselves a range of values. If we think instead about the average annualised mining reward from the Bitcoin Network over the last year, and then think about the kind of investment returns Miners would be expecting from the investment in hardware, this will give us another estimate of the total amount spent on Mining equipment across the Bitcoin network.
The average Bitcoin price over the last year, according to CoinDesk was 971 USD. I've put an image of the graph of the price over the last year below, but for the calculation I downloaded the Daily mid-price and then averaged accross the year. Assuming 14 Bitcoins received per block mined as per our analysis above, and 6 blocks mined per hour over the year we get a value of around 700 million USD as the average amount that the network as a whole received for mining bitcoins in the last year.
Assuming a rate of return commensurate with the risk (let's say a range of 50% to 100%) and assuming this rate of return includes the cost of electricity. We are looking at a capital value of between 700 million/1 and 700 million/0.5 currently invested in mining the Bitcoin network. This alternative estimate gives us a range between 700 million USD and 1.4 billion USD spent on the hardware currently being used to mine Bitcoins.
If we take this dollar value of the computing power being used to mine the Bitcoin network and compare it to the FLOPs per Second per dollar of the largest supercomputers in the world we can estimate the speed of the supercomputer we could have purchased instead.
The Sunway TaihuLight system, which is currently the most powerful in the world, is estimated to cost around 273 million USD. So by this metric, the Bitcoin network could be said to be twice as powerful, 3 times as powerful, or even 5 times as powerful as the world's largest supercomputer depending on which estimate of the cost of the Bitcoin hardware currently being used.
The frustrating conclusion is that we have collectively gathered a network with a total computing power multiple times that of the largest supercomputer in the word and yet all the computation we are carrying out is effectively useless. The proof-of-work underlying Bitcoin is essentially an arbitrarily hard piece of computing who's only utility is to secure the Bitcoin network. Of course this in itself is a valid purpose, but it definitely does not warrant more computing power than the top 5 super computers in the world combined!
I'm not the first person to notice this problem and there have been attempts to develop alt-coins which harness this computing power to attempt to solve useful problems. One such alt-coin is Gridcoin, which randomly assigns a reward to a miner who is mining Gridcoin in proportion to the amount of useful computation they have contributed in the last ten minutes. Users of Gridcoin can select which project they contribute computing power to from a centrally maintained whitelist. The whitelist includes projects such as simulating Protein Folding (used in medical research), searching for Prime Numbers, running climate models, and analysing data from particle physic experiments.
The current issue with Gridcoin though is that it relies on a centralised system to allocate the mining rewards. This undermines many of the benefits of the Bitcoin system which was designed to be a decentralised, non-trust based system. What we ultimately need is a system which combines the decentralised Bitcoin protocol, with a system that rewards some sort of useful proof-of-work algorithm.
I work as an actuary and underwriter at a global reinsurer in London.