Let’s share what is the best answer to this interview question.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Leone Costa
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.