20.04.2024

How Ethereum Mining Works

Today, miners play an important role in making sure ethereum works.

This role isn’t immediately obvious, though.

Many new users think that the sole purpose of mining is to generate ethers in a way that doesn’t require a central issuer (see our guide «What is Ether?«). This is true. Ethereum’s tokens are created through the process of mining at a rate of 5 ether per mined block. But mining also has another at least as important role.

Usually, banks are in charge of keeping accurate records of transactions. They ensure that money isn’t created out of thin air, and that users don’t cheat and spend their money more than once.

Blockchains, though, introduce an entirely new way of record-keeping, one where the entire network, rather than an intermediary, verifies transactions and adds them to the public ledger.

Although a ‘trustless’ or ‘trust-minimizing’ monetary system is the goal, someone still needs to secure the financial records, ensuring that no one cheats.

Mining is one innovation that makes decentralized record-keeping possible.

Miners come to consensus about the transaction history while preventing fraud (notably the double spending of ethers) – an interesting problem that hadn’t been solved in decentralized currencies before proof-of-work blockchains.

Although ethereum is looking into other methods of coming to consensus about the validity of transactions, mining currently holds the platform together.

How mining works

Today, ethereum’s mining process is almost the same as bitcoin’s.

For each block of transactions, miners use computers to repeatedly and very quickly guess answers to a puzzle until one of them wins.

More specifically, the miners will run the block’s unique header metadata (including timestamp and software version) through a hash function (which will return a fixed-length, scrambled string of numbers and letters that looks random), only changing the ‘nonce value’, which impacts the resulting hash value.

If the miner finds a hash that matches the current target, the miner will be awarded ether and broadcast the block across the network for each node to validate and add to their own copy of the ledger. If miner B finds the hash, miner A will stop work on the current block and repeat the process for the next block.

It’s difficult for miners to cheat at this game. There’s no way to fake this work and come away with the correct puzzle answer. That’s why the puzzle-solving method is called ‘proof-of-work’.

On the other hand, it takes almost no time for others to verify that the hash value is correct, which is exactly what each node does.

Approximately every 12–15 seconds, a miner finds a block. If miners start to solve the puzzles more quickly or slowly than this, the algorithm automatically readjusts the difficulty of the problem so that miners spring back to roughly the 12-second solution time.

The miners randomly earn these ether, and their profitability depends on luck and the amount of computing power they devote to it.

The specific proof-of-work algorithm that ethereum uses is called ‘ethash’, designed to require more memory to make it harder to mine using expensive ASICs – specialized mining chips that are now the only profitable way of mining bitcoin.

In a sense, ethash might have succeeded in that purpose, since dedicated ASICs aren’t available to mine ethereum (at least not yet).

Furthermore, since ethereum aims to transition from proof-of-work mining to ‘proof of stake’ – which we discuss below – buying an ASIC might not be a smart option since it likely won’t prove useful for long.

Shift to proof of stake

Ethereum might not need miners forever, though.

Developers plan to ditch proof-of-work, the algorithm that the network currently uses to determine which transactions are valid and protect it from tampering, in favor of proof of stake, where the network is secured by the owners of tokens.

If and when that algorithm is rolled out, proof-of-stake could be a means for achieving distributed consensus that uses fewer resources.

Leave a Reply

Your email address will not be published. Required fields are marked *