DEV Community

Cover image for Proof of work vs Proof of stake
Mends Albert
Mends Albert

Posted on

Proof of work vs Proof of stake

A blockchain is a network of distributed computers running the same data. Wait, data redundancy? Yes, that is the only way to secure the network.

Say, Bob, Alice and John are nodes (distributed computers) on a blockchain network. Each of them has the same copy of data in the blockchain.

So when an attacker temper with Alices blockchain and modified some data on the network it can be easily detected since Bob and John have the original copies of data that don't match Alice's own.

In a real Blockchain network, we have about thousands of these nodes if not millions it will take hackers months and years to hack all these nodes simultaneously.

What then is proof of work? Deo made a transaction with Steve on bitcoin a lot of things happens in the process for Steve to receive the transaction.

Include Making sure Doe has the right amount of balance, Deo has his signature on the transaction, The transaction has been added to the blockchain for miners to mine and finally, Steve receives his money.

We are more interested in how the transaction is been added to the block. A cryptographic puzzle has to be solved by the miners(nodes in the blockchain network) to add a new transaction to the chain.

This puzzle is sometimes generating a lot of random hashes to match a particular string format.

For example, the cryptographic puzzle wants the hash(an algorithm that takes an arbitrary amount of data input—a credential—and produces a fixed-size output of enciphered text called a hash value) of the new block to contain ‘000000’ six leading zeros.

Miners would have to generate random hashes to match this (brute force). Some of the puzzles are computationally expensive and consume more electricity and resource to mine a single block. (Mining a block is adding a new block to a blockchain network).

The difficulty is how hard a miner has to work to get a block added to a network and nonce is the number of times a miner generated random hashes to add a new block.

When a miner successfully mines a new block, he receives a reward for his work and then shares his block with all other nodes. Currently, Bitcoin and Ethereum use proof of work. Ethereum is yet to move to proof of stake.

Proof of stake:

Instead of miners solving a cryptographic puzzle to add a new block to the blockchain network, miners are allowed to stake an amount.

A higher stake amount means they are a higher chance of you becoming the node that validates a new block. Your coins are locked up while you stake them, but you can unstake them if you want to trade them.

The validator checks if the transactions in the block are accurate. If so, they add the block to the blockchain and receive crypto rewards for their contribution.

However, if a validator proposes adding a block with inaccurate information, they lose some of their staked holdings as a penalty.

The Cardano blockchain uses the proof of stake protocol to validate new blocks.

Proof of work requires hardware and energy because minging capacity depends
largely on a miner's computational power.

PoS doesn't require validators to purchase specialized equipment or to solve
complex equations

Top comments (0)