On both Bitcoin and Ethereum networks miners prove their work by creating a hash for the transactions they compile into blocks of blockchain.
However, simply using a cryptography algorithm to come up with a hash is also an easy task. That’s why many of the blockchains, including Bitcoin and Ethereum have a difficulty parameter. Difficulty means that not only do miners need to come up with a hash, but the hash also needs to be smaller than the hash for the previous block.
The difficulty parameter determines the degree to which the hash needs to be smaller. If a network has a lot of miners, the difficulty parameter goes up. If the number of miners on a network decreases for some reason, the difficulty goes down. Because of this, blockchain networks are able to create blocks at somewhat steady rate no matter how many miners they have. Bitcoin network, for example, adjusts the difficulty parameter every 2016 blocks.
You may be wondering how miners are able to create a smaller target hash when a cryptography algorithm returns a unique hash for every set of data, meaning that information about the same transactions would always have the same hash unless someone changes the information. To create a hash that corresponds to the difficulty parameter of the network, miners take all the data for the transactions in the block and add a number called nonce to it. Nonce is short for “number used once.” To receive a winning hash, miners randomly generate nonce numbers and then run combinations of a nonce and transaction data through the cryptography algorithm of a blockchain network.
In essence, this means that miners are playing a lottery. They are trying to guess a winning nonce in order to win the block reward and get all the fees that blockchain network members voluntarily pay to include their transactions in the blockchain. However, the system works with Bitcoin and Ethereum because the networks are decentralized and fully transparent. This means that even though mining is similar to playing a lottery, the lottery is an honest lottery with a realistic possibility of winning and you will win if you play a lot.
On the Bitcoin blockchain, a winning hash becomes a part of the block when the winning miner adds the block to the main blockchain. For example, the hash for the block #505570 was 0000000000000000005943da03721fe216d3111ae0f15777237652fc2907a38a. The miner that came up with the hash was BTC.TOP. The winning nonce that BTC.TOP came up with to get the winning hash was 3817082374. All the information about hashes, nonce and winning miners on the Bitcoin network is transparent and becomes a part of the Bitcoin blockchain. For example, you can verify all the information about block #505570 of Bitcoin blockchain by visiting https://blockchain.info/block/0000000000000000005943da03721fe216d3111ae0f15777237652fc2907a38a. You can also use the website to find this information about every and any other block on the Bitcoin blockchain.
Issues with Proof-of-work in Ethereum and Bitcoin
There are several issues with the way proof-of-work protocol works on both the Ethereum Network and the Bitcoin network.
The first issue is that proof-of-work protocol wastes a lot of energy and resources. As the Bitcoin network became very popular in 2016 and 2017, the difficulty parameter kept growing and miners needed to invest in expensive hardware and burn a lot of electricity to find winning nonces and hashes, yet in essence this work doesn’t contribute anything to the well-being of the society. It only shows that miners believe in Bitcoin.
This is the issue that Gridcoin solved by implementing proof-of-research algorithm. One of the goals of Gridcoin cryptocurrency was to provide support to the science community. On the Gridcoin blockchain, miners perform useful scientific calculations for the distributed platform called Berkeley Open Infrastructure for Network Computing.
Another issue is a lack of finality. Both Bitcoin and Ethereum are open-source networks, which means that anyone can download and use the software. It also means that if someone on the Bitcoin or Ethereum network doesn’t disagree with the direction in which the network is going, that party can download the software and stop recognizing blocks from a certain point. This is a so-called fork issue.