Bitcoin uses the hash proof of work system to generate blocks that bitcoin miners must tackle.
The resulting proof of work is a piece of data which is difficult to produce in terms of time and money with a lot of trial and error involved, but is easy for others to verify according to predetermined requirements. In bitcoin, the proof of work system is called Hashcash.
More on Hashcash
Bitcoin uses hashcash proofs of work in order to generate new blocks. These blocks are then accepted by network participants after miners have completed a proof of work to cover all data in the block. The rate at which new blocks are generated has to be controlled by the network. This is done by automatically adjusting the difficulty level every 1-10 minutes. The probability of a worker computer to generate the next block is always low and so it is difficult to predict which miner will generate the next block.
Valid blocks will hash to a value less than the current target after the work is completed. Since each block contains the hash of the preceding block, one block is actually a chain of blocks that contain a large amount of work. Changing a block — which can only be done by creating a new block with its predecessor —requires regenerating all successors and redoing the work they contain, thereby protecting the blockchain from tampering.
The most widely used proof-of-work scheme is based on SHA-256. Other hashing algorithms are Scrypt, Blake-256, CryptoNight, HEFTY1, Quark, SHA-3, scrypt-jane, scrypt-n, and others.
Proof of work examples
If the base string that needs to be worked on is “Hello, world!” the target will be to find a variation of it so that SHA-256 hashes to a value beginning with ‘000’. The string will be varied by adding an integer value to the end (called a nonce) and adding to it each time.
Finding a match for “Hello, world!” would take 4,251 tries with zeroes in the first four digits:
“Hello, world!0” => 1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64
“Hello, world!1” => e9afc424b79e4f6ab42d99c81156d3a17228d6e1eef4139be78e948a9332a7d8
“Hello, world!2” => ae37343a357a8297591625e7134cbea22f5928be8ca2a32aa475cf05fd4266b7
“Hello, world!4248” => 6e110d98b388e77e9c6f042ac6b497cec46660deef75a55ebc7cfdf65cc0b965
“Hello, world!4249” => c004190b822f1669cac8dc37e761cb73652e7832fb814565702245cf26ebb9e6
“Hello, world!4250” => 0000c3af42fc31103f1fdc0151fa747ff87349a4714df7cc52ea464e12dcd4e9
4251 hashes on a computer is not much work since most computers can reach at least 4 million hashes per second. Proof of work difficulty will vary, set automatically to keep up a steady stream of block generation. An actual bitcoin proof of work is more complex than the example above, including the generation transaction which gives the miner an incentive to do the work and makes sure that every miner hashes a unique data set.
Traditional proof of work
- Hashcash with double iterated SHA256
- Hashcash with scrypt internal hash
- Momentum birthday collision
- Cuckoo Cycle proof of work https://github.com/tromp/cuckoo
- Various other proof of works functions (e.g. Ethereum had a few candidates)
Proof of X
- Proof of Stake
- Proof of Burn
- Stellar Consensus Protocol