Digging deeper ... what's mining got to do with cryptocurrencies?

Even if you're new to the world of cryptocurrencies, you've no doubt come across the term 'mining'.

But what could such backbreaking work possibly have to do with cryptocurrencies?

Cast visions of head torches and dark underground tunnels aside. Crypto mining is one mathematically complex and high tech venture working around the clock to provide security for cryptocurrency transactions.

Beginning with blockchain technology

All transactions hinge on trust. In the decentralised environment of cryptocurrencies, without a trusted third party like a bank to rely on, people have to trust in blockchain technology instead.

Blockchain technology is a completely decentralised and distributed online ledger system. It masterfully checks and records cryptocurrency transactions to ensure their integrity and security -- all without a third party in sight.

But, in a decentralised system, who maintains this online ledger? And why would they want to maintain it?

Mining and its merits

Mining is the process of keeping a blockchain ledger up-to-date. The people who -- or more correctly, whose computers -- do this work are called miners.

Like its namesake, mining a blockchain is hard work. Nodes (computers) expend significant energy in a competition of sorts to be the first to validate transactions and group them into blocks.

For their efforts, the first miner to successfully find a hash for a successfully validated block of transactions is credited with an amount of cryptocurrency. This arrangement provides incentive for checking cryptocurrency transactions and maintaining their ledger -- entirely independent of third parties.

There's safety in numbers

The complex maths behind blockchain technology and the mining process provides the ultimate in transaction security. Quite simply, fraudulent activity is ruled out by the maths involved, providing confidence for transactions in a decentralised system.

Mining ensures transaction security in the following ways:

1. Mining validates transactions

Miners first check that a transaction is valid; that a payee has cryptocurrency to spend in the first place.

Much like the way that a PIN proves that a cardholder has authority to transact, if a payee's public key can successfully decrypt their digital transaction signature, then the transaction is considered valid. The maths involved here guarantees it. Miners check that a public key and digital signature match.

2. Mining securely records transactions

Once a transaction has been validated, miners group it with other valid transactions into a transaction block.

Miners then run this new block's data through a complex algorithm until they find a 'hash' (short version of the data) that meets certain criteria.

The hash of the previous transaction block is also included in this process. This means that each block references the one before it, linking blocks together in a chain-like way.

Now, each block's hash is entirely unique to its data. Changing any one transaction in a block changes its hash completely. If a hacker wanted to alter a transaction record, they would have to find a new hash for the altered block -- and then do the same for all the blocks that follow because each hash is dependent on that of the previous block.

But the only way for a miner to find a block's 'hash' is to guess ... and keep guessing. Because this guessing game is so difficult, it requires a whole lot of computing power (and therefore financial expense).

What's more, a network automatically accepts the longest version of the transaction chain as valid. This means that if a hacker were to successfully trick a network into accepting a new longest version of a transaction chain, they would have to recalculate hashes at faster pace than the rest of a network was working to creating new blocks.

So, in order to even stand a chance at breaching the network's security, a rogue node would need to have at least 51 percent of the computing power in an entire network. The immense cost of operating such vast computing power serves as a strong financial disincentive to hacking transactions in a blockchain ledger.

Mining: maintaining security for cryptocurrencies

So, a far cry from picks and hard hats, mining uses the maths-based tools of cryptography to provide security for cryptocurrency transactions.

Checking that transactions are valid and then etching them securely into a blockchain ledger, cryptocurrency mining is worth its weight in gold.

Keen to find out more? Delve deeper into cryptography and blockchain technology at the Cointree Learning Hub.

Credit: Laura Hawting on behalf of Cointree and reviewed by Anouk Pinchetti education consultant Blockchain Centre.