Proof of workload (proof of work)
One key to blockchain is to add a threshold for security and stability: If a participant wants to create chunks and join a blockchain, it must prove that he has done a very difficult job, which is "proof of work", or POW. Can be understood as POW used to keep the rhythm of the blockchain.
The difficulty of work is reflected by the amount of computation, which cannot be completed quickly, and the difficulty increases over time. Satoshi set a new block in bitcoin every 10 minutes (dynamically set the difficulty value). and hash calculation (hash) of the characteristics, to meet this requirement.
In addition, the person who completes this work will also receive the corresponding reward. such as "miners" through the "mining", production blocks, to obtain a bitcoin reward. High speed is preferred.
Hash Calculation: the process of obtaining a hash value for the specified data. It is characterized by the fact that the hash value of the specified data is unique and that the hash value of the original data changes.
The POW algorithm used in bitcoin is Hashcash, which was originally used to prevent spam. The data that computes the hash consists of two parts, one is chunk data (such as hash of the previous chunk, timestamp, transaction information, difficulty value, etc.), and the other is the calculator nonce. Use a hash function (such as SHA256) to calculate the hash value, and if it does not meet the difficulty requirement, then nonce+1 until the requirement is met.
Difficulty value: generally defined by targetbits, meaning is binary hash value in front of how many bit is 0, temporarily called the target upper bound, if the calculated hash value is smaller than the target upper bound, then the valid proof is indicated. Because a small number is smaller than the target upper bound, it is necessary to change the nonce repeatedly to calculate the hash. As shown, the second line of the hash is the target upper bound, the first line does not meet the requirements, the third line meets the requirements.
The article is only the blockchain technology learning record, if there is a mistake or textual research is not rigorous place, please advise.
Resources:
https://jeiwan.cc/
https://liuchengxu.gitbook.io/blockchain/
Initial knowledge of Blockchain (iii)