Table of contents
Proof of work is a cryptographic concept that essentially means that you’re proving your work to the blockchain. This is necessary because without it, there would be no way to tell if someone actually performed any work.
It’s important, though it might sound basic because this is what secures “cryptocurrency” like Bitcoin and Ethereum. Proof of work ensures that people aren’t cheating the system out of money by playing around with their funds without actually mining any coins – all they’re doing is spending energy on something useless.
The proof is a hash that can be mathematically proven to have been generated from a new block. The transaction has been validated and appended to the blockchain.
In practice, this means that if you have the hash from a new block, you have proof of work from it.
Proof of work protocols are much more nuanced, but that is the basic idea. The block must contain the proof in order to be valid.
Other requirements need to be fulfilled in order for a block to be added to the blockchain – namely, it must have sufficient proof of work AND sufficient proof of stake.
But both these proofs really boil down to demonstrating that you have carried out some amount of work by finding a solution for the block puzzle. The proof-of-stake portion is just another means of demonstrating this – in addition to providing a transaction history over multiple blocks. You need something else. This something else is a stake in the system, and it’s used to punish individuals who might try to cheat the system.
Both proofs of work and proof of stake are forms of “computational effort” that demonstrate that a miner has spent a certain amount of energy on a block. Without having proof that the miner has been making some effort, the network couldn’t trust them.
There’s one more thing to remember: when we say something is “computationally expensive”, we mean that it requires some serious amount of processing power.
A proof of work protocol is specifically designed at the beginning to take an amount of time that’s likely to be much higher than what it would take to do something useful with the same hardware. The point is, you can’t just spend five seconds and get a number out of it.
If you did so, people could generate blocks left, right, center,
and there would be absolutely no way for you to tell who had done so. It’s also unclear whether their block would even be valid because it might not include enough proof-of-work.
The idea here is that the amount of energy the miner has to spend on each hash must be relatively high to demonstrate that they actually did something useful. It would also be extremely expensive for someone else to try to generate identical blocks because it’s infeasible.
On top of this, people who generated blocks could be made by their peers to suffer a cost for doing so. This is where proof of stake comes in – if you generated a block, your peers could take your stake-holding away from you, given that you’ve committed some kind of wrongful act. If you’re not abusing the system (and if you earned it), then you get your stake back when someone else creates blocks after continuing mining without problems.
It’s worth noting that “proof” doesn’t really mean anything in this context. You can’t prove that you’ve solved a block puzzle; you can only show that you did the work necessary to get it right. Some people refer to this as “virtual proof”, and others use other names for it like stamp-and-go and verifiable delay function (VDF). The point is, “proof” doesn’t really mean anything; it’s just there because we use expressions like these often.
Challenge–response protocols, a different type of network protocol, use a form of proof where the “proof” is what you do to demonstrate that you have “proved” something. In those, it is an actual property that you must demonstrate by presenting some kind of cryptographic signature or key to someone else. It’s a property of yours. In proof-of-work, it’s not a property of yours – it’s what you did to prove the work.
Why would you require proof of work?
– To provide evidentiary value
Proof-of-work can be used as an evidentiary value for locking and unlocking transactions and smart contracts and other things on a blockchain.
To generate scarcity: Proof-of-work can be used to ensure that there are not too many coins in circulation, resulting in scarcity rather than inflation.
– To create finality
Proof-of-work can seal transactions into a block much more quickly than other types of blockchains using different consensus mechanisms.
– As a measure of computational effort
It would be possible to require that all miners must use high-end devices to process hashes, but that’s much more expensive, much slower and cumbersome than proof of work, and it’s not very practical. Having proof of work as an alternate means of spending the same energy on the network is still very efficient and practical.
Hashes and Cryptographic Hashes
When we talk about the “hash” in blockchain technology, we usually refer to a cryptographic hash – a function designed specifically to map data of any size to a fixed 256-bit (32-byte) hash. The reason cryptographic hashing is used is that it provides an asymmetric security mechanism that allows anyone to verify that two inputs are the same.
In short, it’s impossible (or at least impractical) for someone who does not know the hash value x to determine what data will produce that same hash value. It’s possible for anyone who knows the data and the hash value itself to easily confirm whether two inputs are identical or not by applying the same algorithm and getting the same result.
In Blockchain technology, a cryptographic hash is a function of data that produces a fixed 32-byte result from any given input. In this sense, the term “hash” is not limited to documents or signatures or anything else that can be easily mapped to 256 bits. It can refer to any kind of data structure – records, blocks of transactions, scripts of smart contracts… you name it.
The more punctuation we add around a block of transactional information (like a block header), the harder it becomes to determine what was included inside it. The most common method of encrypting data is to use a cipher and apply a mathematical transformation to the data; we can think of these as “hash functions”.
As we add more data, the result becomes more difficult for an attacker to guess. In the case of a blockchain, the more redundancy we add, the harder it becomes for someone with malicious intent to alter or destroy it. This is because there are many possible encodings that will give us the same 256-bit hash. But this isn’t very helpful in a practical sense – you can’t just go through every single possible hashes and check each one against your data.
If you want to know what a cryptographic hash actually looks like, take a look at this GitHub page. As an example, the SHA256crypt algorithm is a common hash function that maps data of any size to fixed-size 256-bit (32-byte) outputs.
To double-check that no one has tampered with the data, it’s possible to use multiple hashes, or checksums for short. This is how the SHA2 family works. A good example of this is when you download a file from the internet, and are shown a message saying “Sorry, not enough bytes in this file to verify”. By using multiple inputs, including different combinations of character data and checksums, you can show that you downloaded the correct file.
This is also true when someone claims they have found a new block in Ethereum’s Ethereum blockchain network. First, they send out a “difficulty” along with their block; this is just another proof using cryptographic hashing. What this proof does is give proof that it’s difficult to create the hash.
The reason for this is that it can’t be done in just one go, so instead, they have to go through the same hashing algorithm multiple times. This way, when they finish sending out their proof, anyone can confirm that it’s incredibly difficult to create a block by doing what the person did – in fact, it’s so difficult that if someone went through all these steps but sent out very different data instead of a new block, no one will believe them unless they have specific knowledge of the data being used to generate the proof.
The data is called a Nonce and consists of a random string of zeros and ones (indeed, the word nonce is an old-fashioned term for “number used once”), and it’s randomly generated and added to each block. The hashing function is applied multiple times with different outputs until the input data doesn’t produce any more hashes.
When you download a file from the internet, you’re given a chance to verify that the file came from the source it claims to come from (by using checksums or hashes), as well as that it’s exactly what was claimed (by calculating how difficult it is to generate these hashes).
What’s interesting is that anyone can do this. Even if someone else has already found a block, anyone else can do the same calculations and show that the blocks are the same – that they are indeed all part of one single blockchain.
Checksums are not considered an ideal security measure because it’s possible for checksums to be faked, even if the hash function is strong. This means you’d need to apply more checksums in order to make it more secure.
This is important to know, because if it is possible for attackers to fake the checksums, then they may be able to trick you into believing that their fraudulent transaction is legitimate.
This means that even with blockchain technology, you need to make sure you’re getting trustworthy information about transactions. Just like when downloading files or verifying downloads, you should always use checksums with blockchain technology.
Cryptographic hashes provide a useful method of creating digital signatures; they make the process of validating data incredibly simple and easy to implement with just one hash function. But, unfortunately, they are not foolproof.