Blockchain Mining
By: Bitcoin Compass
Tags: Cryptocurrency Investment, Cryptocurrency Mining, Cryptocurrency, Crypto, Bitcoin

What the ‘blocks’ are made of and how to mine them

What is mining?

Blockchain is a breakthrough comparable in its significance the Internet.

Arguably, blockchain has already revolutionised the way data is shared, exchanged and protected; and yet the technology’s potential is far greater that may presently appear. With applications far beyond just currency, it can truly challenge the way the world operates.

And at the core of it is the premise of decentralisation. In the absence of central authority, the participants in the network can freely transact with each other incurring minimal costs. This also enhances the overall security, as the attack on the central hub (e.g. server) would potentially disable the entire network.

This, however, presents a challenge. Transactions need to be verified and confirmed, a function that previously belonged to the central authority. The nature of digital assets is such that they can be duplicated. If the asset in question is a unity of currency, this presents a problem. Once the data — in this example, money — is transferred from one user to another, it’s important to ensure that the first party won’t be able to use the asset again. This is known as the double-spending problem.

With no central authority to coordinate transactions, this responsibility falls on the users known as ‘miners’.

Mining in blockchain is a process of validating and recording transactions by the means of solving complex mathematical problems. In other words, mining is adding new blocks to the chain.

Once a transaction is confirmed, it is time stamped and added to the chain, thus effectively becoming irreversible. This immutability , or permanency, of the transaction records helps minimise the risk of double spending, and protect data from external manipulation and attacks.

Who are miners?

Since there is no central server on which data is stored, blockchain networks are comprised of devices of individual users, called ‘nodes’. This interconnected web of nodes is the core infrastructure of blockchain.

Some nodes may just store a part of the chain, while others, also known as ‘full nodes’ or miners, store the full record of transactions, and verify and add new blocks.

A node is a computer or other device connected to the network. Even a consumer-grade machine can be used as a standard node. Mining, however, is a much more demanding process, which requires a lot of computational power and incurs substantial energy costs. This is due to the fact that the process of validating and recording blockchain transactions involves solving complicated puzzles, which are beyond capabilities of most standard electronic equipment.

How are blocks mined?

Generally speaking, miners compete with each other to solve complex mathematical problems to produce the so-called ‘proof-of-work’ for a given block. As the name implies, this method ensures that a new block was expensive (i.e. computational power, energy consumption) to add to the chain.

Although it is (purposefully) hard to find a solution, it is easily verifiable by other participants in the network. The computational complexity minimises the risk of a successful attack and the transparency ensures that any unsanctioned changes would be easily discovered by other nodes. It is one of the core principles of blockchain, enabling a lot of its security potential.

So, miners verify previously pending transactions and add them to the chain. In order to grasp the process, however, it’s important to understand what elements blocks consist of. They are Current Hash, Previous Hash, Data, Nonce, Timestamp and Block Number .

Before discussing each of them individually, it’s important to introduce the crucial concept of cryptography . Blockchain is based on what is called a ‘cryptographic hash function’. It is a medium in which miners need to solve the puzzles.

Hash function is a mathematical function that encodes data into an output, such as a sequence of letters and digits, of standard size. Bitcoin, for example, uses the NSA-developed SHA-256 algorithm. There, the output of the cryptographic function, or hash, is a 64-character combination of letters and digits.

Hash is a value that represents the entirety of data that a block contains in a highly condensed form. Although this may seem too conceptual at the moment, the importance of cryptography becomes apparent once individual elements of a block and their interrelationships are discussed.

Current hash

Hash is a critical element of a block, as it is an encoded representation of all the data that it contains. In addition to the data itself, however, the current hash is generated through the input of all other components, such as block number, timestamp and others. This is done by putting all the elements of a block through a cryptographic hash function.

What this means is that if one element of the block is changed, the hash will change too.

The objective of mining is to ‘guess’, given all the inputs, the value of hash that satisfies conditions pre-set by the algorithm. Due to the high number of possible outputs and the complexity of the cryptographic inputs, ‘guessing’ requires a lot of effort and resources.

As a result, a hash is considered a proof-of-work and, thus, validates a transaction.

Previous hash

One of the inputs that affect the value of the current hash is the hash of the previous block. This is how all the blocks in the chain are interlinked. If, for example, someone were to artificially change one block (thus changing its hash), they would need to change the hash of the block that follows because the two are intrinsically connected.

If the next block is changed, then the one after it needs to be changed too and so on. That is why the bigger the network grows, the more secure it becomes, as it would require extraordinary amount of CPU to re-do proof-of-work for multiple blocks.

This is the backbone of the blockchain’s security credentials.

The naming of the technology could not be more appropriate. Hashes are links that hold the chain of blocks together.

Data

Data, of course, is the core of a block. All containing information is encoded and feeds into the calculation of a fix-size hash.

In case of Bitcoin, data would be a record of transaction; that Party A transferred X bitcoins to Party B. But applications of blockchain are not limited to currency, of course. Ethereum, a blockchain platform, was created to enable a broad range of applications. Data could be anything, from a complicated legal contract to a message on social media.

What’s particularly important from the security standpoint is that if even something as trivial as a punctuation sign is changed in the data (or any other inputs), the hash value will change drastically. So if an attacker were to change a piece of information in one block, they wouldn’t be able to predict how the hash of this block (and all the following ones) will change without re-doing the proof-of-work.

Nonce

Nonce stands for ‘number used only once’. It is one of the inputs that impact that value of hash and it is the only one that can be freely manipulated by miners. It is, effectively, a random number. By changing the nonce miners arrive at an entirely new hash value.

The ultimate objective of miners is to guess the hash. But they do so by guessing the value of nonce, which, if put through the algorithm with other variables, produces a result that satisfies a predefined condition.

Timestamp

Timestamp is an important aspect of blockchain. Satoshi Nakamoto, inventor of Bitcoin , in their famous white paper, suggests that appending a time value to each block, thus placing them in a chain, where one block can’t be changed without changing others, can be a solution to the double-spending problem.

A peculiar feature of a timestamp, as an input into the hash function, is that it changes every second. If changed, the timestamp, as all other components of a block, would entirely change the hash value. What this effectively means is that the range of acceptable nonce values that produce a valid result changes every second. This to the large extent explains the difficulty of the mining process.

Block number

Finally, each block is assigned a number. It is an identification number of a particular block in the confines of a chain. Similarly to other component, it is put through the cryptographic function to produce the proof-of-work.

What is required for successful mining?

Miners compete with each other to mine blocks. And as any competition, this one implies reward. It comes in the form of tokens of this specific network. Naturally, rewards vary on different platforms, but they also fluctuate with time.

With the release of the latest update, mining reward in Ethereum, for example, had been reduced to 0.6 eth and is expected to fall to 0.22 eth once the upgrade is fully implemented. Current reward in Bitcoin is 12.5 btc but it halves every four years to keep the number of token in circulation under control.

The objective of miners is to find a value of hash that is lower than the target that is set by the algorithm before the competition. Target is a mechanism by which blockchain networks can manage difficulty of their mining operations.

For instance, the Bitcoin network is designed in such a way that the total number of tokens in existence can’t exceed 21 million. This means that the rate of production of new tokens (i.e. mining) needs to be actively managed. That is why Bitcoin’s algorithm specifies that a new block can be mined every 10 minutes only. The more miners join the network, the higher the chance of them finding the solution quicker, however.

That is why the network needs to make it harder to find a solution, as more nodes join. For that the algorithm reduces the target, meaning that the range of accepted hash values is narrower.

Increased difficulty, of course, requires a proportional increase in effort and resources. The mining process has been becoming rapidly more challenging. If consumer-grade machines could easily be used in the early days of Bitcoin, now, the probability of success with such equipment would be virtually non-existent.

Computational power is a key requirement for successful mining. So much so that the recent boom of blockchain led to the creation of numerous industrial-grade mining facilities and ‘mining farms ’. With networks like Bitcoin promising substantial returns, competition in the space intensifies and the entry barriers are only expected to increase.

What is the mining process, in a nutshell?

Overall, mining is a highly challenging process, yet one that is absolutely essential to the way blockchain networks operate.

Miners are competing with each other to verify transactions by adding blocks to the chain. For that they receive tokens in reward (thus the name ‘mining’ is more than appropriate). In practice, miners are trying to guess the value of nonce, which, when put through the cryptographic function together with other variable, produces a valid hash. The result is accepted if it is below the target, which can be adjusted to regulate difficulty of the mining process.

With more and more nodes joining networks, mining is expected to become more challenging yet it will also open up vast opportunities underpinned by the decentralisation principles of blockchain.

In the constantly and rapidly changing world of blockchain, it can be a struggle to stay ahead of the game. Follow Bitcoin Compass on Telegram (t.me/bitcoincompassofficial) for cryptocurrency trading, investing signals, Bitcoin updates, blockchain content, and more.