WTF is Proof of Work?

‘Proof of work’ is one of the terms used to describe the process miners use to build a blockchain.

Remember there are different building blocks in any blockchain?

The process of adding each block into the chain can happen in different ways. Proof of work is one of the most commonly used, including in the Bitcoin and Ethereum blockchains.

I wrote in a previous post about how miners add blocks into a blockchain, but I’ll recap here in more detail how miners do their thing:

Miners have to go through the proof of work process to solve a cryptographic puzzle. Once they solve the puzzle, they have ‘proved’ that they contributed a certain amount of effort to the task.

This is important because the fact a miner was prepared to give up their own electricity and computer power to solve the puzzle makes them more likely to add a block of transactions without tampering with the data. In this way proof of work contributes to the security and trust of the blockchain.

Confirmations

When a block is mined and added to the chain it has a ‘depth’ of one. Essentially it’s only one block deep into the chain.

As another block is mined and appended onto the chain after the first block, the first block has a depth of two.

The amount of energy contributed to mining a new block means there is a lower chance of it being reversed the more energy contributed to cementing it into the blockchain, or the more blocks behind it.

For example, if a block has 1 block after it, it is less cemented in than another block with 10 blocks after it. This means there is still a possibility the block could be reversed, but practically the amount of computing power that would be needed to ‘undo’ the block is so enormous it would be infeasible.

It is commonly accepted in the Bitcoin blockchain for example, that once a block has 6 blocks mined after it, it will no longer be reversed and be accepted as permanent. This is known as a ‘confirmation’. Transactions on the Bitcoin blockchain will show as unconfirmed until the block containing those transactions are 6 blocks deep.

Merchants who accept bitcoin can therefore set their own limits on how many blocks are required until a transaction is confirmed. They are recommended to do this to prevent what’s known as ‘double spending’, ie. Someone spending the same one bitcoin twice in different places – leading to the merchant not receiving a valid bitcoin.

So proof of work proves the miners have done some work to add the block to the blockchain.

What you are probably thinking is – what is this work that they’re doing?

Remember hashing? In case you haven’t read the summary in previous posts, here it is again:

Making a hash of it

A hash (or hash reference) is a random string of numbers. Hash functions are a method of creating an identifier for a set of data. You put something in, the function does its thing with the code, and it spits something out. That something is called a hash (or hash reference).

The hash spat out by the function is determined by whatever you put into it in the first place.
For example, when you input the sentence ‘Amanda loves blockchain’, the output might be ‘288ejald20038afljadl463283lqpppskw42839’. This is called the ‘hash’.

The hash of ‘Amanda loves blockchain’ will always be ‘288ejald20038afljadl463283lqpppskw42839 when that sentence is run through a hash function, because it is determined by the sentence I entered.

Hash references are usually irreversible, which means that given ‘288ejald20038afljadl463283lqpppskw42839’, I cannot work out that the input was ‘Amanda loves blockchain’.  I’ve just used random combinations of characters here, but usually hash references are set lengths depending on the function that produces them.
Hashing can therefore be used to prove the ‘identity’ or content of a particular set of data, without revealing the content itself.

Hashes are used in the structure of the blockchain to reference the data within the block. The header of each block also contains hashes to show what’s inside the block itself. Hashes are a short-form summary of data if you like. A hash is non-reversible because it has been through the cryptographic hash function, so you can’t retrieve the data going backwards from the hash, without guessing the input and hashing it to get a result matching the hash.

Block headers

Block headers are the part of each block that aggregate the information inside them and order the blocks within the blockchain itself.

Block headers contain various bits of information:

– Reference to previous block (parent) – builds the blockchain structure
– Hash of all data (eg. Transactions in the Bitcoin blockchain)
– Timestamp – shows when the block was mined
– Nonce – number that when combined with block data and put through a hash function produces the solution to the puzzle
– Target – the miner aims to get a hash lower than this number

Solving the puzzle

The puzzle miners need to solve involves finding a hash of the block header that is less than the target. Remember you can’t go backwards from a hash to the source data?

The only way to find a hash less than the target number is to hash the block header repeatedly and by trial and error find a number that matches this criterion. But if you keep hashing the same data you will always get the same hash output. You need a way of changing the data slightly each time to make the hash different at the end.

You therefore need to include some extra piece of information that will keep changing, whilst the block header itself won’t change. Each time the miner hashes the data they will add a number called a ‘nonce’. This nonce is just a way of hashing the data lots of times and changing only one thing about the data each time, to get a different hash result.

Prove it!

Eventually, the miner will hash the block header and the nonce, and will get a hash result that is less than the target number. The nonce used to get that hash is the ‘solution’ to the puzzle because it is proof the miner went through the different nonce options, adding them to the block data and hashing until it found the correct one that is less than the target.

The way miners can ‘prove’ their work is that anyone else can hash the same data on the blockchain with the nonce solution and they will get exactly the same hash of the block header.

 

Any other proofs?

The hash algorithm used in the Bitcoin blockchain is called ‘SHA256’, which is the most widely-used proof-of-work system. There are other hash algorithms that can also be used.

Proof of work is not the only consensus mechanism out there in the blockchain world that is used to form the blockchain structure. There are other consensus options like proof of stake and proof of space. These tend to use less electricity or energy than proof of work and can therefore be more environmentally friendly. Ethereum will be moving to proof of stake in the near future partly for these reasons.

So now you know about the underlying system that drives the miners in blockchains using proof of work. You have an extra building block of knowledge under your belt so congrats! In future posts I will go into proof of stake and other concepts around consensus mechanisms and the inner workings of blockchain systems – so make sure you check those out too!

85 Trackbacks / Pingbacks

  1. generic viagra cost
  2. cialis coupon walgreens
  3. cialis coupons
  4. cialis online canada
  5. where to buy cialis online
  6. viagra for sale
  7. cheap erectile dysfunction pill
  8. erectile dysfunction medications
  9. male erection pills
  10. cialis 10 mg
  11. cvs pharmacy
  12. cheap vardenafil
  13. vardenafil cost
  14. san manuel casino online
  15. empire city casino online
  16. generic viagra canada
  17. real money casino games
  18. hollywood casino online real money
  19. buy cialis online overnight shipping
  20. no credit check loans
  21. payday advance
  22. personal loan
  23. viagra 100mg
  24. best real money online casinos
  25. cialis 20
  26. cialis to buy
  27. 5 mg cialis
  28. efcaxdszdfszgd
  29. m980u9oy9y98o8y9pm
  30. generic for cialis
  31. m90uojmuy7hjhhhh
  32. rxc43rw435tr53t453t
  33. buy cialis
  34. cialis 20
  35. viagra generic name
  36. casinos online
  37. slot games
  38. chlid seat policy
  39. chauffeur GATWICK TO BRIGHTON
  40. play casino
  41. slot machine games
  42. viagra generic name
  43. viagra online canada
  44. what is sildenafil
  45. buy real viagra online
  46. viagra for men
  47. Face Mask Made In USA
  48. cialis pills
  49. generic viagra for sale
  50. cxqw234xracrwcr4
  51. xdsffx4crta4rtxa34w
  52. cheapest viagra
  53. viagra connect
  54. cialis 20 mg
  55. generic viagra without subscription walmart
  56. buy pfizer viagra online
  57. purchasing cialis online
  58. viagra buy
  59. viagra overnight delivery
  60. buy generic viagra
  61. tadalafil online
  62. casino
  63. casino gambling
  64. droga5.net
  65. viagra where to buy in georgia
  66. http://viagrabs.com/#
  67. herb viagra where to buy
  68. www.jueriy.com
  69. http://cialistodo.com
  70. buy viagra online without script
  71. when will generic cialis be available
  72. cialis cialis
  73. buy viagra online
  74. viagra online
  75. generic viagra
  76. cheap cialis
  77. generic viagra
  78. online viagra
  79. viagra canada
  80. order viagra online
  81. viagra generic
  82. viagra pill cutter
  83. shoppers drug mart cialis
  84. proviagra
  85. viagra samples

Leave a Reply