Share Facebook

Twitter

Whatsapp

Mail

Whatsapp Software engineer Mike Caldwell applies a sample key as he mints physical Bitcoins in his shop on April 26, 2013 in Sandy, Utah.

The way we spend money is changing with electronic transactions and new alternative currencies like bitcoin, but security is important—and mathematics and massive amounts of computing power are central to that, as Dr Karl Kruszelnicki explains.

The world is changing, and the way we do business is on the move. Last time, I spoke about how a strange one-way mathematics is essential to the virtual currency called bitcoin. It's also essential to the 'blockchain'—the open, transparent and unchangeable record (or ledger) of every bitcoin transaction.

The Bitcoin network uses as much electricity as it takes to run two Large Hadron Colliders at full power.

This strange one-way mathematics is essential to the 'hash function'—which in turn is essential to the blockchain. The 'hash function' has nothing to do with hashtag (as on Twitter), or hashish (the drug). It gets its name from cooking, as 'hash' meaning to 'chop and mix'. A hash function will chop the input, and then mix it up, following a whole bunch of crazy mathematical rules, to give an output. The hash function that the bitcoin network currently uses is called SHA-256. The output, a unique chain of letters and numbers is called a hash value, or a hash code, or a hash sum, or simply, 'hash'.

Now here's some strange properties of the hash function.

First, the same input always gives the same output (or hash). Second, two different inputs can't generate the same hash.

Third, you can feed into a hash function any number of characters—either a single letter or number, or the 44 million words in the Encyclopaedia Britannica. Regardless, you will always get a hash with the same amount of letters and numbers—64 of them.

(Try it out here. The letter 'c' turns into the hash of '2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1 a25aefc6'.)

Each time you apply SHA-256 to the Encyclopaedia Britannica, you will get exactly the same hash. But change one single letter in just one of those 44 million words, and the resulting hash is completely different.

Now remember our one-way mathematics, and our 1,000-digit number with only two factors? You cannot go backwards. When you look at a hash, you have no idea if the input was a single letter, or the entire Encyclopaedia Britannica.

The only way to solve a hash function is the brute force method. Guess some characters, see if they give you the right answer, and if they don't—repeat, millions, billions and trillions of guesses.

This happens around the world in the 10-minute refresh cycle of the bitcoin ledger/blockchain.

So hopefully, you have enough background information to understand bitcoin, and the blockchain.

Related: Let's not get too excited about Blockchain

First, thanks to public key infrastructure, you proclaim that you intend to spend some bitcoins—and, also, where the bitcoins came from. Your transaction is added to other transactions, in the 10-minute cycle. You make a hash of that 10-minute block of transactions—and send it out on the bitcoin network.

Second, everybody on the bitcoin network receives your block, and makes a hash of it. Separately, they retrieve the last block on the blockchain—and make a hash of that as well. (Now that last block on the blockchain contains all the information of the block before it—and so on, all the way back to the very first block generated back in 2009. That why it's called a blockchain.) They get that last block on the blockchain, and make a 64-character hash of it.

Third, they combine the two hashes together—that is, the hash of your transaction block and the hash of the last block on the blockchain. They make another hash of those two hashes.

And here's the hard, and last, part. They have to guess a special number called a 'nonce'. A nonce is a bunch of letters and numbers. They combine their previous hash with the nonce, and generate their last hash.

Did you know Great Moments In Science is a podcast? You can subscribe on iTunes, ABC Radio or your favourite podcasting app.

To make the blockchain network more difficult to crack, the rule is that his hash has to have a certain number of zeros at the front. Somewhere inside the bitcoin network, a computer has to find the correct nonce within 10 minutes—because there's another block of transactions coming down in the next 10 minutes. The person who guesses the nonce get paid in bitcoins.

They need a huge amount of computing power to do this. In fact, the total computing power of the bitcoin network is at least several hundred times greater than all the top 500 supercomputers on Earth put together.

The bitcoin network uses as much electricity as it takes to run two Large Hadron Colliders at full power. Unless somebody can grab that much computing and electrical power, the bitcoin network and the blockchain are safe from being cracked.

On one hand, bitcoin is at most a very marginal aspect of the world's financial system.

On the other hand, financial institutions around the world are looking at using less energy-hungry versions of the blockchain to run transactions between small groups of merchants. In January 2016, the global financial elite at the annual World Economic Forum in Davos in Switzerland waxed enthusiastically and optimistically about future applications of blockchain.

The chief scientific adviser to the UK government wrote that 'distributed ledger technologies have the potential to help governments to collect taxes, deliver benefits, issue passports, record land registries, assure the supply chain of goods and generally ensure the integrity of government records and services'.

The blockchain could also be used to set up tamper-proof voting.

There's a lot here to get your head around. Blockchain technology is not for blockheads—but is a bitcoin ample reward for your efforts? I like my coins whole.