What is Mining & How Cryptocurrency Works?

BangBit Technologies
9 min readMay 14, 2018

--

Ever thought how cryptocurrency works or how Bitcoins are actually made? In last few years, cryptocurrencies like Bitcoin are growing fast in popularity. The number of people trading them is increasing at a lightning speed. As now Bitcoin has run the mainstream & became a sensation, more and more people are coming into the game. However, the production of cryptocurrencies is not known to everyone. As we already know there is no central authority that controls cryptocurrencies, (Bitcoins or Alt-coins), a process called ‘Mining’ is behind the creation of these cryptocurrencies.

Over the past few years, mining process has significantly improved with better use of hardware. As there are different types of cryptocurrencies, there are also different types of mining. To understand more what is mining, we can say; it is a decentralized computational process which serves basically 2 purposes. First, confirms transactions in a secure practice in the blocks, and second- creates new cryptocurrencies in each new block.

Cryptocurrency Mining & the Blockchain

To understand mining, you need to first understand the blockchain. It works in a simple process. All cryptocurrencies are recorded in the blockchain, in a series of assembled transactions called blocks. The blockchain is a public ledger which is frequently updated and shared under no central control. Miners are the ones who ensure the blocks are legitimate and check if the same coin is not been used again before the transaction has cleared so that the input & output expenses match. This is how cryptocurrencies are created and new coins are made.

Thus, mining is a key part of the security of the cryptocurrencies system. The idea is that miners group a bunch of transactions into a block, then repeatedly perform a cryptographic operation called hashing zillions of times until someone finds a special extremely rare hash value. At this point, the block has been mined and becomes part of the block chain.

It works like this;

Here, there are two things we need to understand here. Hash rate & Proof-of-Work & Proof-of-Stake.

What is Hash Rate/Hash Power?

If you have interest in Cryptocurrencies, you must have heard the term ‘Cryptographic Hash Function’. But ever wondered what exactly does it mean & how is this related to cryptocurrency? The Hash Rate is the measurement unit of the processing power of the Crypto network, and hashing is the kind of transformation process that turns a string to some fixed alphanumeric sequence. Cryptocurrency network must have mathematical and cryptography related operations for various security purposes.

The hash function generates a fixed-length output from any input. The output string obtained as the result of hashing corresponds to the input data. Many blockchains use the SHA-256 hashing algorithm generating output strings of 256 bits, or 64 characters. Each new block contains the hashed value of the previous block, ensuring the blockchain immutability. As soon as the data of any previous block is changed, the hash no longer matches. While SHA-256 is currently the most popular hashing algorithm in crypto networks, others are also used, such as SHA-2, SHA-512 or Ethash. To provide additional security, Bitcoin applies the SHA-256 function twice, a process known as double-SHA-256.

Crypto network requires a lot of energy in order to solve mathematical computations to find the blocks. These computations for finding blocks are basically mathematical puzzles which a miner can’t guess without doing a lot of computation. A crypto miner needs to hash the block’s header in such a way that it is either less than or equal to the target. A miner can reach this target by changing a small portion of the block’s headers, which is called a ‘nonce’. A nonce starts with “0” and increased each time to achieve the required target. Since the changing of the nonce is not fixed, the chances of getting this target are very low. You need a lot of attempts to change the nonce. The number of attempts made per second is called hash rate and the entire process is called Cryptocurrency Mining. Since the network is decentralized, it should arrive at the consensus on which block to add. While many nodes can calculate the correct hash, only first one is chosen. This block is added to the blockchain and the node that found it gets the reward.

Hash rate denominations

a) 1 KH/s is 1,000 (one thousand) hashes per second

b) 1 MH/s is 1,000,000 (one million) hashes per second.

c) 1 GH/s is 1,000,000,000 (one billion) hashes per second.

d) 1 TH/s is 1,000,000,000,000 (one trillion) hashes per second.

e) 1 PH/s is 1,000,000,000,000,000 (one quadrillion) hashes per second.

f) 1 EH/s is 1,000,000,000,000,000,000 (one quintillion) hashes per second.

Common Hash rate Conversions

a) 1 MH/s = 1,000 kH/s

b) 1 GH/s = 1,000 MH/s = 1,000,000 kH/s

c) 1 TH/s = 1,000 GH/s = 1,000,000 MH/s = 1,000,000,000 kH/s

Currently in Bitcoin, a successful hash must start with approximately 17 zeros, so only one out of 1.4x10²⁰ hashes will be successful. In other words, finding a successful hash is harder than finding a particular grain of sand out of all the grains of sand on Earth.

The Threat of Double Spending & How PoW resolve it?

Even before the invention of Bitcoin or any other Altcoins, there were sustainable attempts made towards creating digital currencies. But all those attempts failed because of the threat of using a currency value twice to perform different transactions. Bitcoin has been able to sustain and grow because it solves the “double spending” dilemma.

Bitcoin used a confirmation mechanism and maintain the universal ledger “blockchain” which is similar to traditional cash monetary system. From its very beginning blockchain maintains a chronologically-ordered, time-stamped transaction ledger. A block is added to the ledger in a certain period of time and all the connected nodes on the network keep a copy of this global ledger. Anyone can alter the ledger, but they have to solve a puzzle or task first and then they add a block of transactions to a chain of previous transactions. In order to do a double spend, a bad actor must not only solve the puzzle first to add his bad block — he has to get others to extend the chain that he made. But legitimate players will not do this — they will only extend a chain made of legitimate blocks. If most miners are honest, and everyone agrees that the longest chain is authoritative, then the longest chain will be made of blocks contributed by honest players. The transactions in these blocks will therefore be legitimate, and not contain double spends.

Let’s take an example. If you buy something from one merchant for $1, you can’t buy anything from another merchant using the same $1. If you could, then there is no value of money as everyone would have unlimited money and the scarcity, which gives currency value, would vanish. Blockchain core network protects against double-spending by the verification of each transaction with the use of Proof-of-Work (PoW) mechanism. Transactions are finalized and approved by the miners after verification. If anyone tries to duplicate a transaction, it will show in the network that it is counterfeit and would not be accepted. You can’t double spend, once a transaction is approved. Digital currency has become viable by solving this double spending problem.

The Concept of Proof of Work (PoW)

There are two main Blockchain systems that most of the crypto networks are using & both of these systems oversee how transactions are verified on the decentralized network.

A Proof-of-Work system directs its users to perform certain tasks to participate in the block. The tasks are usually tough for the participants, but relatively easy for the server to evaluate. In case of Bitcoin & Ethereum, PoW exists in the form of miner nodes striving to resolve a block or group transactions together in a sequential order and have that block accepted onto the global blockchain of that system. The only way to have its block accepted is to accurately guess the nonce, or by a random number generated by the network. If a miner couldn’t guess the nonce before another appears, must start again to guess the new nonce.

On the other hand, Proof-of-Stake is a different way to validate transactions. Though this is also an algorithm, and the purpose is same as PoW, the process is quite different here. As in case of PoW, a miner is rewarded by resolving mathematical problems and creating new blocks, in Proof-of-Stake, the creator of a new block is chosen in a deterministic way, depending on its wealth, also defined as stake. This means that in the PoS system there is no block reward, so, the miners take the transaction fees.

Types of Crypto Mining: An Overview

Initially, mining could be done via any computer component that has processing power and memory (ex: CPU). But with changing time, miners needed high speed and efficiency. Old methods of mining resulted in high consumption of electricity and a lot of effort. Then came GPU. GPUs generated more hash rate. Now miners have specially designed hardware for mining called ASIC. There are several coins which are ASIC resistant and can be mined using GPUs only. The basic crypto mining techniques are;

GPU & ASIC are two of the most prolific crypto mining techniques which are widely used. These both are profitable.

ASIC Mining

ASIC means Application-Specific Integrated Circuit. This is basically a machine used for mining certain crypto coins. Let’s take the example of Bitcoins. A Bitcoin ASIC machine processes complex algorithms and receives a small amount of Bitcoin. ASICs can mine more than one algorithms, but mostly they are specific to one coin. Coins like Bitcoin, Litecoin, Dash, DGB-Qubit, Quark can be mined through ASIC.

Benefits

· Easy to use

· Comparatively less priced

· High ROI

· Compact

Example of few popular ASCIs

· ANTMINER L3+ (LITECOIN)

· ANTMINER S0 (BITCOIN)

GPU Mining

GPU stands for Graphics Processing Unit. In GPU a complex Proof of Work is solved to legitimate a transaction to add a new block in the blockchain. Like ASCI, a miner will get a reward in the form of crypto coin. A GPU mining rig consists of a set of GPUs working in a computer set-up. More the GPUs, more the hash power. There are many GPU mining currencies like Ethereum, Bitcoin, Monero, Monacoin, LBRY Credits etc.

Benefits

· Flexible coin options

· Easy to purchase

· High resale value

· Less power consumption

· Good warranty

· Quieter operating environment

Example of few popular GPUs

· NVIDIA GEFORCE GTX 1080 Ti

· RADEON RX VEGA 64 LIQUID

You have to keep various factors before going for any of the above mining processes. Electric consumption is the foremost factor you need to keep in mind. You can start with GPU mining & when you got sufficient ROI, you can switch to ASCI.

A Summary: How Cryptocurrencies Work?

As we already know, a cryptocurrency runs on a blockchain, which is a shared ledger across a network of computers. The updated transaction is distributed and made available to all coin holders of the chain. Every single transaction made is recorded in the blockchain. The blockchain is run by miners, who use powerful computers to record the transactions. Their core work is to update each time a transaction is made and also ensure the authenticity of the data to confirm each transaction is secure and processed properly. For conducting this, miners are paid cryptocurrencies as fees by vendors or merchants for each transaction.

The value of cryptocurrencies shifts depending on demand & supply, as there is no fixed value for it. Buyers and sellers need to agree on a value which is based on the current cryptocurrency trading amount. Since there is no controlling body present, and it is a peer-to-peer transaction, there is no third-party transaction fee involved. The identity of the buyers and sellers are not revealed, however, each transaction is made public to all in the blockchain network. Anyone can earn cryptocurrencies through exchanges found online or through mining.

Understanding the concepts which are fundamental to cryptocurrency is a challenge. You need to go through various resources available online. Different kind of explanations works for different people. We all learn in different ways. If you want to understand more about mining & how crypto works, contact one of our blockchain consultants today. We will be happy to assist you.

--

--

BangBit Technologies

Software Development | Enterprise IT Solution | Application Support | IT Consulting - Blockchain Technologies, AI Driven Solutions, AR/VR and Mobile & Web Apps.