Mining

Why Trust Techopedia

What is Mining?

Mining, in the context of blockchain technology, refers to the process of finding new blocks to hold transaction data on a blockchain network. The term is best known for its association with Bitcoin, although many other prominent blockchain networks also use mining, including Litecoin, Dogecoin, and Kaspa.

Advertisements

The mining process is a rewards-based system in which mining nodes (specialized computers on the network) compete to solve an algorithmic puzzle. The node that solves the puzzle first assembles the next block and earns a block reward paid in the cryptocurrency used by the blockchain. For example, a Bitcoin miner would earn bitcoins for mining a new block, whereas a Litecoin miner would earn litecoins for mining a new block.

Techopedia Explains the Mining Meaning

Techopedia Explains the Mining Meaning

The blockchain mining definition refers to the consensus mechanism used by Bitcoin and many other blockchains called proof of work (PoW) mining. Blocks are groups of transactions and data. In proof of work blockchains, miners compete to find a block by finding an algorithmic hash value that matches the block’s contents as well as a nonce, which is a number used only once. Once the correct hash value is found through mining, the miner then includes pending transactions in the block and earns a block reward paid in cryptocurrency.

Mining is an energy-intensive process that requires miners to generate hashes based on an algorithm until one of the miners finds the correct hash. Across the Bitcoin network, hash rates can exceed 700 million terahashes per second. This hashing activity is the work in proof of work mining.

How Mining Works

To understand mining, it’s helpful to first understand the basic structure of blockchains. Blocks hold transactions and data. Each block also holds a hash value of the prior block’s header, which links blocks together in the blockchain. A hash is a data input represented as a hexadecimal value as dictated by the hashing algorithm.

For example, the Bitcoin network uses SHA-256 to generate hash values.

Data Input (Transactions) SHA-256 Hash Output (Transaction Hashes)
Alice sent Bob 1 bitcoin 7d1838090ffe4310b9e1688f88ace3299803434b5055906db80c430a4a1371cd
Bob sent Carol 2 bitcoins c9f5b245a5e40fda604f49202fd9061c8f96c4e4ba254ab3036218d5ccc1dab3
Alice sent Bob 1 bitcoin, Bob sent Carol 2 bitcoins eb98beea33f2acbe868cab0373c1cfc98dcb26d3ecf3bfe487b5b5ecfa0705bc

Each transaction uses a unique transaction hash. Later in the mining process, transactions are paired and hashed together. Hashing is used throughout the protocol, ranging from wallet addresses to mining new blocks. Hash values seem random, but the same input always generates the same fixed-length output using a given algorithm.

In proof-of-work networks, blocks of transactions are assembled and added to the blockchain by the miner that generates the correct hash for the block. More accurately, the miner must find a qualifying hash at the required difficulty for the solving the block. Think of each hash as a guess, but a guess that must follow the rules of the protocol.

Bitcoin’s total hash rate, meaning how many hashes network mining generates per second, has risen steadily since 2021.

How Mining Works
Source: Blockchain.com

Mining difficulty changes based on the combined hash rate for the network. The lowest possible difficulty is 1. However, the difficulty for the Bitcoin block shown below was nearly 84 trillion. To mine this block the miner had to find a hash that matched the block data and the nonce, but which also had 19 leading zeros.

The successful hash was 00000000000000000002ff6d98c9f7a961db78b13c67429d18fdee6506c19e21.

The nonce, also highlighted below, increments by one with each unsuccessful attempt to mine a block, starting at zero.

How Mining Works
Source: Blockchain.com

The miner earned 6.35265978 BTC, part of which was new bitcoins minted by the protocol and part of which came from network fees paid by Bitcoin network users.

Merkle root: a7acdabb6325bc562125a1e22388f76826affffd085afc96776eb621dea752d6

The Merkle root for the above block is a hash of all 1,720 transaction hashes in the block. Transaction hashes are hashed in pairs, with the resulting hashes again paired and the pairs then paired again and again until they create one hash: the Merkle root.

Merkle three

In this regard, hashing also offers a way of identifying individual transactions with a unique identifier as well as reconciling an entire block to be sure the data is unchanged. The Merkle root becomes part of the block header, along with the previous block’s hash, which links the blocks in the chain as miners add new blocks.

Types of Mining

Mining takes several forms in regard to the hardware used to generate hashes.

CPU MiningGPU MiningASIC MiningCloud Mining

In the early days of Bitcoin mining it was possible to mine up to 200 bitcoins in a day with a central processing unit (CPU). With today’s much higher hash rate and difficulty mining Bitcoin by CPU power is unfeasible. However, for some mining algorithms, such as RandomX or CryptoNight, CPU mining is still viable. Profitability depends on the the value of the cryptocurrency being mined and electricity cost to run the miner.

Graphics Processing Units (GPUs) offer a way to mine with much more efficiency for some algorithms. GPU mining rigs were extremely popular for mining Ethereum prior to Ethereum’s switch to proof of stake from proof of work.

Application-specific integrated circuits (ASICs) dominate the Bitcoin mining industry and are designed to hash a specific algorithm. While costlier than GPU mining rigs, ASICs are much more efficient. An alternative to ASICs, Field Programmable Gate Arrays (FPGAs), can produce higher hash rates compared to GPUs but are still less efficient than ASICs.

The expense and upkeep of crypto mining rigs gave rise to a cloud mining industry in which miners can rent hash rate from providers that run and maintain the rigs.

Uses of Blockchain Mining

Blockchain mining serves several functions, all of which are contribute to the security and prosperity of the blockchain ecosystem.

Validate transactions
Miners on the blockchain validate transactions to prevent double spending. The shared Merkle root provides a simple way for other nodes to verify the transactions in the block.

Secure transactions
Proof of work requires miners to find a qualifying hash for the block to mine a block. Any attempt to change a transaction also changes the hash for the block. An attempt to change a single transaction or even one character would also require re-mining the block in addition to all subsequent blocks? – and at a speed faster than the rest of the network can mine new blocks. The power cost and time involved in mining new blocks makes a proof of work networks secure.

Create additional supply

Mining also creates additional supply of cryptocurrency for the network. However, supply tokenomics vary by network. Bitcoin and Litecoin are both designed with a finite number of coins to be mined, whereas Dogecoin has fixed yearly inflation of five billion new dogecoins per year.

Is Mining Legal?

Blockchain mining is legal in most countries around the world. However, several countries have banned cryptocurrencies, in full or in part, including mining, according to the Library of Congress. Iran, Pakistan, Egypt, China, and other countries restrict or ban the use or mining of cryptocurrencies.

Local governments may also impose zoning or power restrictions that can affect the ability to mine cryptocurrencies.

Mining Pros and Cons

Proof of work mining brings advantages compared to proof of stake or other consensus mechanisms. However, energy usage and high equipment costs spotlight some of the disadvantages.

Pros

  • Crypto mining is often considered more secure compared to other consensus mechanisms due to the prohibitive cost of re-mining blocks to change a previous transaction
  • Mining provides a more decentralized method of consensus
  • The mining mechanism allows anyone to participate in consensus and earn cryptocurrency for helping to secure the network

Cons

  • Mining with proof of work is vastly more energy-intensive compared to other consensus mechanisms, such as proof of stake
  • Some proof of work mining networks, such as Bitcoin, provide much slower transaction speeds
  • Expensive equipment requirements can make it costlier to mine, often concentrating mining hash rates with well-financed miners or mining pools

The Bottom Line

Mining is often considered the most secure way to protect cryptocurrency transactions and the integrity of the blockchain. The process revolves around generating cryptographic hashes to find a qualifying hash that opens a new block to hold transactions. While mining has its advantages, such as security and enhanced decentralization, the process can also be costly, both in electricity costs and equipment.

FAQs

What is mining in simple terms?

What are the 4 types of mining?

What is the purpose of mining?

Is mining legal?

Advertisements

Related Questions

Related Terms

Mensholong Lepcha
Crypto & Blockchain Writer
Mensholong Lepcha
Crypto & Blockchain Writer

Mensholong is an experienced crypto and blockchain journalist, now a full-time writer at Techopedia. He has previously contributed news coverage and in-depth market analysis to Capital.com, StockTwits, XBO, and other publications. He began his writing career at Reuters in 2017, covering global equity markets. In his spare time, Mensholong enjoys watching soccer, finding new music, and buying BTC and ETH for his crypto portfolio.

',a='';if(l){t=t.replace('data-lazy-','');t=t.replace('loading="lazy"','');t=t.replace(/