Mining

x1xx1x
5 min read

What is Mining?

Mining Involves validating cryptocurrency transaction on a blockchain network and adding them to a distribution ledger…It prevents double-spending of digital currency on a distributed network It also helps keep the network secure.

Ethereum was using a proof of work consensus mechanism which was heavily reliant on the power of gpu and cpu’s mining. The miners used their computation power to process new incoming transactions and produce new blocks until ethereum upgraded to proof-of-stake consensus mechanism.

How mining keeps the network secure.

In decentralized systems like Ethereum, we need to ensure that everyone in the world agrees on the ordering of transactions.

For example, if Alice sent Bob 1 ETH, which he further sent to Charlie, the order of the transactions NEEDS to be as follows

Alice --> Bob 1 ETH

Bob --> Charlie 1 ETH

Any other transaction order will not work, and it is important everyone agrees to this.

Miners are also responsible for validating cryptocurrency transactions on the blockchain network and adding them to the ledger. Importantly, this process prevents the double-spending of digital currency.

Since decentralized systems lack a central authority, mining is crucial to the network's safety and validity.

How are Ethereum transactions mined? (simplified)

1. Creating a Transaction

  • User Action: You want to send some Ether (ETH) or interact with a smart contract. You create a transaction request from your Ethereum account.

  • Signing: You sign this transaction with your private key, which proves that you are the owner of the account.

2. Broadcasting the Transaction

  • Sending Out: Once signed, your transaction is sent out to the Ethereum network through a node (a computer that participates in the Ethereum network).

3. Mempool

  • Waiting Area: When nodes receive your transaction, they add it to their local mempool. Think of the mempool as a waiting area where all pending transactions sit until they are processed.

4. Mining a Block

  • Grouping Transactions: At some point, a miner (a special type of node that validates and adds transactions to the blockchain) picks several transactions from the mempool to create a new block. They try to choose transactions that will earn them the highest fees while staying within the block size limits.

5. Validating Transactions

  • Checking Validity: The miner checks each transaction to ensure it’s valid. This means:

    • The sender has enough Ether to send.

    • The transaction is properly signed.

    • The transaction format is correct.

6. Executing Transactions

  • Running on EVM: The miner then runs each transaction on their local copy of the Ethereum Virtual Machine (EVM). If the transaction is successful, the miner collects the transaction fees.

7. Creating Proof of Work

  • Securing the Block: After executing all transactions, the miner creates a Proof-of-Work certificate. This is a way to prove that they did the work to validate the block. It involves solving a complex mathematical problem.

8. Broadcasting the Block

  • Sharing the Block: Once the miner has the Proof-of-Work, they broadcast the completed block to the entire network. This block contains all the transactions, the Proof-of-Work, and the new state of the blockchain.

9. Verification by Other Nodes

  • Double-Checking: Other nodes in the network receive the new block and verify it. They check the Proof-of-Work and execute all the transactions in the block on their own EVMs to ensure everything matches.

10. Updating the Blockchain

  • Adding the Block: If everything checks out, the nodes add the new block to their version of the blockchain. They also update their mempool by removing the transactions that were included in the new block.

11. Repeating the Process

  • Cycle Continues: This process keeps repeating as new transactions are created and mined into blocks.

Different Methods of Mining

  1. CPU-based mining

  2. GPU-based mining

  3. Application-specific integrated circuit mining

  4. cloud mining

CPU-based mining

  • CPU-based mining refers to the process of using a computer's central processing unit (CPU) to mine cryptocurrencies. In the early days of digital currency, like Bitcoin and other altcoins, mining was done with CPUs. However, CPU mining is quite slow and impractical today because it can take months to earn even a tiny amount of mining rewards while constantly running your CPU at 100% of its capacity and paying for high electrical costs.

GPU-based mining

  • GPU-based mining refers to the process of using a Graphics Processing Unit (GPU) to mine cryptocurrencies. GPUs are highly efficient at performing the parallel processing tasks required for mining, which involves solving complex cryptographic puzzles to validate and secure transactions on a blockchain.

Application-specific integrated circuit mining

  • ASIC (Application-specific integrated circuit) mining refers to the use of specialized hardware designed solely for mining cryptocurrency. Unlike general-purpose hardware like CPUs or GPUs , ASICs are custom-built to perform one specific task: mine a particular cryptocurrency ….making them significantly more efficient and powerful at that task. However, they are expensive, and as more and more miners join the network and mining becomes harder, the hardware becomes obsolete quickly. A brand new ASIC would usually only last 1-2 years max.

cloud mining

  • Cloud mining refers to the practice of mining cryptocurrencies, such as Bitcoin, using remote data centers instead of personal mining hardware. Users can lease computational power from these data centers and receive a share of the mining profits. The appeal of cloud mining lies in its accessibility as users don't need to purchase expensive mining rigs or worry about maintenance, electricity costs, or other technical aspects of mining.

Resources

The following are additional recommended but optional readings and viewings to learn more about mining:

0
Subscribe to my newsletter

Read articles from x1x directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

x1x
x1x

Everyday learner