There has been a lot of discussion in the media over the last few months on the rise of bitcoins and cryptocurrencies, and what it means for society and the economy. With uncertainty in the world due to Brexit and Trump and countless other political crises, individuals and organizations have been increasingly turning to the decentralized currency that is controlled by the masses, and as a result what was once given away for free a mere decade ago is now selling for tens of thousands of dollars apiece. Stores and businesses are starting to accept bitcoin payments, and a pub near where I grew up now has a bitcoin ATM in its lobby. Personally I knew that something big was happening when elderly relatives started asking me to explain to them what bitcoins are.

However there is a looming threat to the bitcoin boom, and even the best experts cannot say whether it will hit in a month or a year or a century. The threat is quantum computing.

The mathematics of cryptocurrency is a specialized field, and well beyond the scope of this article. However the basic concept is as follows. When you setup an account, there is a seed that is put into the software. Usually this is a pseudo-random number generated by the computer itself, but it is also common to have the user enter a passphrase, or even more secure is to have the user scribble some random lines with a mouse and convert the input to a number to generate a truly random seed for the account.

This seed number is then fed into a complex algorithm that uses elliptic curves or similar methods to convert it into a much larger number called the private key. This number is designed to be so large that even the best supercomputers working on it fulltime will never be able to test every possible key. Once the user has this private key, they must keep it secured and never allow anyone else to access it - the private key is the only way that anyone can access the account and remove money from it. If it gets lost, the money is effectively destroyed and can never be used again.

Once the private key is obtained, the software can use it to generate a set of public keys. The algorithm that does this is a form of one-way encryption, in that the public key can only be generated by that specific private key, and yet there is no way of reversing the process to calculate the private key from knowledge of the public keys. In this way the public keys can be shared publicly, and yet the account is still secure.

Bitcoin transactions are then straightforward from the users perspective. Money is sent through the internet to a specific public key, and while anyone can view the money connected to that key, it is impossible to connect it to any account. The owner of the account however can claim that money, and use their private key to confirm that they are the owner of the public key as well. By using their private key to confirm their ownership of that money, they can then send it to other public keys and transact financial dealings without the need for an intermediary such as a bank or a credit card company to broker the transaction.

However there is a potential problem with this method of securing financial transaction, and given the sudden, rapid growth of cryptocurrencies it is a potential nightmare for the global economy.

The strength of the cryptocurrency is in the size of the numbers used for private keys. It is mathematically impossible to calculate the private key for a specific public key, and so the only way to steal bitcoins is to guess what the private key might be. With a traditional computer, or even a bank of supercomputers, this means trying one private key at a time and seeing if any of them unlock the account. But the number of possible private keys makes this a nearly impossible task. A warehouse full of supercomputers working fulltime for decades or centuries would still only be able to test a tiny fraction of all the possible private keys, and therefore would make stealing bitcoins virtually impossible.

There is however a new technology that is being developed currently, known as the quantum computer. As I have written before in previous articles, a quantum computer uses the laws of quantum mechanics to speed up calculations. One way to think of what a quantum processor does is to imagine the computer splitting itself into thousands or even millions of exact copies of itself, and each virtual copy does one of the calculations. When one of the copies gets the required result, all of the virtual copies disappear leaving only the one that got the necessary result.

In the case of bitcoins, each of the copies could test a single private key. Instead of testing a single key at a time such as a traditional computer does, a quantum computer could test millions at a time. And when one of those virtual copies finds a private key that unlocks a bitcoin account, it returns that key to the user who can then use it to steal the cryptocurrency stored in the corresponding account. Instead of a network of supercomputers taking centuries to unlock an account, a futuristic desktop quantum computer could unlock it in just a few hours.

Of course that is still just a theoretical threat to cryptocurrencies. There are private companies that claim to have manufactured working quantum computers, but in the academic literature the best quantum computers are still only able to factor two digit numbers and are not even as powerful as the cellphone in the researchers pocket. If quantum computers are to be a genuine threat to the security of the bitcoin system, they will have to improve quite dramatically!

But then again, there are people alive today who worked on classical computers that could barely do simple arithmetic, and who are now using complex machines that can simulate the entire Universe. And so it is not unbelievable that within the next few decades the growing quantum computing revolution could entirely cripple the cryptocurrency industry.

Perhaps decentralized currency is not quite as secure as we first thought...