Blockchain, Cryptocurrency, Mining, Hash Rate! How Does it All Fit Together?

As the co-founder of a small cryptocurrency mining operation I am often asked by people from outside the industry questions regarding the nature of blockchain, mining, and how cryptocurrency really works! While my verbal answers are usually fairly brief, I think these questions warrant a more encompassing explanation that can be understood by those, like me, who do not have a background in computer science. Outlined below are explanations of what I believe to be the key concepts behind how cryptocurrency and public blockchain technology work.

Cryptographic Hash Functions

First let me define a general hash function as a mathematical algorithm used to map data of any size to data of a fixed size. For example:

School history essay (1000 words) => Hash Function => cf23df2207d99a74fbe169e3eba035e633b65d94 (40 character data string)

The word “Cat” => Hash Function => rx0bb5654a6F5e05932f73f102CfC570585c3B4f (40 character data string)

The returned data string is known as a hash value, digest, or hash. As the output hash is generally much smaller than the input data, it’s easiest to think of a hash function as compressing the original data much like a zip file on your PC. Hash functions are often used within computer software for data indexing and swift data lookup.

Public blockchain technology uses a specific type of hash function known as a cryptographic hash function. As with the general algorithm, the cryptographic hash functions maps data of any size to data of a fixed size and it also makes this process infeasible to invert.

For example, it is not possible to look at cf23df2207d99a74fbe169e3eba035e633b65d94 and recreate your old 1000 word history essay. In fact, reconstruction of the original input data from the cryptographic hash is only possible via what is known as a brute-force search through all the possible input combinations until a matching hash is outputted.

A cryptographic hash function has several key characteristics:

· The same input data always produces the same output hash

· A small change to the input data alters the output hash comprehensively

· Hashes are “collision-free” (i.e. it is not feasible for two different data inputs to have the same output hash)

· Given any input data string the hash function computation is relatively fast

· It is not feasible to recreate the input data from its output hash except by a brute-force search through all the possible data inputs

It is important to understand that public blockchain networks are literally built on cryptographic hash algorithms. They are used to increase efficiency and security in almost all basic network processes. But what are the basic network steps when dealing with public blockchain technology?

Blockchain Network Basics

To understand how public blockchain technology accomplishes this it is best to look at how transactions occur and are recorded via a public blockchain. The key steps in this process can be seen here and I will elaborate below:

1. Transactions are initiated on the public blockchain network

2. The transaction details are verified by public blockchain node software

3. These verified transactions are bundled into a block of data

4. Information from the preceding block is entered into the new block

5. The PoW protocol is successfully completed

6. The new approved block is added to the blockchain and broadcast to other network nodes

Cryptocurrency Transactions

Coin holders transact coins with others by digitally signing a hash of the preceding transaction information and the public key of the new owner, and adding this to the “coin’s file”. The person receiving the coin can therefore verify the preceding signatures to confirm that a change in ownership did take place. This record of ownership is traditionally done by a bank and held on their centralized internal ledger.

In order to maintain trust in this process via a decentralized computer network certain precautions must be taken. For example, what stops a bad actor from duplicating a previously transacted coin and using it again? This is known as a double-spend attack. To safe guard against such an attack transactions must be timestamped (i.e. recorded sequentially), publicly broadcast to the network, and the network must agree on a single history of transaction order. Rather than do this process on individual transactions, the network nodes (i.e. computers) group transactions into data blocks to increase network efficiency.

Blockchain Blocks

These last two items are what provide most public blockchain networks with security. As each block contains a hash reference to the previous, if a bad actor wanted to change a previously added block they would also need to alter every single block in the chain after that so that the hash references would match. The key process used by the majority of public blockchain networks to make this infeasible is the third item which is known as a Proof-of-Work (PoW) protocol.

Proof-of-Work Protocols

The PoW protocol is where cryptocurrency miners come into the picture and it relates to the public blockchain in the following way. For a new block of transactions to be added to the blockchain, miners (i.e. network requesters) must expend large amounts of costly computing power to solve for the random target hash set by the blockchain network nodes (i.e. network providers). This process involves the brute-force search mentioned before through all possible input data until a matching hash is found.

This difficult and costly process is a competition between miners, with the first to solve the puzzle receiving a reward. Once completed, the PoW solution is easily verified by the public blockchain nodes. The block is then added to the blockchain and this fact is broadcast to other network nodes. The individual blockchain with the greatest number of miners participating (i.e. forming consensus) is taken as the official record of all previous transactions.

The PoW protocol makes it extremely expensive for a bad actor to try and alter previous blocks as they would then need to “re-mine” all subsequent blocks and do so while controlling over half of the total network “mining power”. This is because they would need to outpace all the honest network miners working to authenticate the original blockchain. Due to the expensive nature of mining (i.e. equipment and electrical costs) this is infeasible!

Mining Rewards

But hold on! Surely as more miners join the network, and the networks total processing power increases, this process will take less time increasing the rate of new coin dissemination? Therefore, in order to keep the rate of new block creation consistent with a predetermined timeline, the speed at which the PoW protocol can be solved adjusts in relation to the total number of network miners working. This feature is known as network difficulty and the network nodes control this by varying the length (i.e. number of characters) of the required PoW target hash value (a.k.a. the nonce).

For example, it is much harder to find a specific hash via a brute-force search if the target hash is 60 characters vs. only 40. Unfortunately, network difficulty and miner profitability have a negative relationship. To put it simply, the more network miners there are, the more network difficulty increases, and the less likely an individual miner is to achieve a mining reward.

Hash Rate

For an individual cryptocurrency mining farm, the higher the hash rate of the mining equipment in operation the higher the chance of solving the PoW hash algorithm first and the more profitable it will be. For a cryptocurrency mining farm to achieve a higher hash rate it must invest in, and operate, the most advanced mining Application Specific Integrated Circuits (ASICs) and Graphics Processing Units (GPUs) available.

Final Words

Data Analytics, Blockchain, & Education!