node-blockchain
node-blockchain copied to clipboard
Mining implies the block will be added?
When mining, shouldn't the solutionHash be compared to a targetHash and the block only be added if solutionHash <= targetHash?
Otherwise, what stops a miner from having a list of predefined hashes that meet the criteria of having 4 leading zeros and just submitting them.
On that note, it would also make more sense to have a variable number of leading zeros in the mining process' expected solution hash for each block that needs to be added to the chain.
I am currently working on a project similar to this to get a better understanding in the cryptocurrency space. Feel free to have a look and let me know if the above is indeed correct and I will make a PR
Otherwise, what stops a miner from having a list of predefined hashes that meet the criteria of having 4 leading zeros and just submitting them.
Other miners will need to confirm that the submitted hash is actually the correct hash. That is how the Blocks are confirmed in a decentral manner. If the hash cannot be confirmed with the submitted solution then it wont get integrated into the Blockchain.