Codecademy Logo

How Blockchain Works

Advantages and Disadvantages of Consensus Mechanisms

In blockchain, each consensus mechanism has its unique benefits, drawbacks, and tradeoffs. It is important for a dapp developer to consider all technical aspects before deciding on which consensus mechanism to implement.

Disadvantage of Proof of Work

In blockchain, a common criticism of Proof of Work (PoW) is that it is incredibly inefficient and consumes a lot of energy.

Advantage of Proof of Work

In blockchain, the resource-intensiveness of the Proof of Work (PoW) model is slower than other consensus mechanisms, but it encourages decentralization and is more secure by design.

Bitcoin’s Consensus Mechanism

Bitcoin uses the Proof of Work (PoW) consensus mechanism causing the verification chain to be very slow.

Solana’s Consensus Mechanism

Solana is a blockchain that uses the Proof of History (PoH) consensus mechanism and is optimized for speed and user experience.

Solana Node vs. Bitcoin Node

A Solana node has much higher requirements than a Bitcoin node leading to a more centralized blockchain.

Ethereum Migrating to Proof of Stake

Ethereum is a blockchain that is in the process of migrating from Proof of Work to Proof of Stake.

Satoshi Nakamoto and Bitcoin

Satoshi Nakamoto is famous for solving the double spending problem when they created the cryptocurrency Bitcoin.

How Blockchain Achieves Decentralization

Decentralization is core to what a blockchain is. A blockchain is a globally verifiable ledger of transactions that is collectively run and verified by each member of the network. It is a ledger of transactions that every user has access to.

Imagine if Hogwarts had a “magical” accounting ledger that recorded every transaction that occurred at the school. This book has special properties:

  • Anybody interested can obtain their own copy of this book.
  • Anytime anybody makes a transaction, the ledger updates everyone at the same time.

Double Spending Problem

The key innovation of blockchains is solving the Byzantine Generals problem. This is commonly known as the double spending problem.

The distributed ledger solves this problem. Every transaction is required to be recorded to the entire network so it can’t be duplicated.

In the case of Bitcoin, a user’s currency is moved from their wallet to someone else’s wallet. This process is recorded to, and verified, by the entire network simultaneously, so it can’t happen twice.


In blockchain, decentralization refers to an open network of computers all running the same code or hosting the same data.

Benefits of Decentralization

The three main benefits of decentralization in blockchain are:

  • Security
  • Transparency
  • Permanence

Decentralization: Security

One benefit of decentralization in blockchain is security. The “crypto” in cryptocurrency comes from cryptography, and this secures individual transactions on the blockchain (as well as provides the backbone of the consensus mechanism known as Proof of Work).

By leveraging public key cryptography, we can create secure identity and user management, despite the information and transactions being public.

Decentralization: Transparency

One benefit of decentralization in blockchain is transparency. Because blockchain networks are (or should be) open and viewable to all, they are highly transparent.

If the network is not open and nodes are not able to be downloaded and verified by anybody, we cannot call the network decentralized.

Decentralization: Permanence

One benefit of decentralization in blockchain is permanence. Because of the ledger-like nature of blockchain networks, information written to blockchains is permanent.

A blockchain is literally a chain of data blocks that are all connected together, so every transaction is recorded to that ledger permanently.

Blockchain Components

The three main components of blockchain design are:

  • Blocks
  • Miners
  • Nodes
An image that shows a miners mines a block, which is made up of a data, a nonce, and a hash, and then that block is sent to nodes.


The chunks of data that make up the blockchain are called blocks.

Elements of a Block

In blockchain, a block has three basic elements:

  • Data
  • Nonce
  • Hash


In blockchain, a nonce is a randomly generated 32-bit whole number that generates a block header hash.

Block Hash

In blockchain, a block’s hash is a 256-bit number that is connected to the nonce.

Blockchain Node

In blockchain, a node is a computer on a decentralized network that is used to watch and verify a ledger.

Node Responsibility

In blockchain, a node is only responsible for holding a copy of the existing blockchain, not adding new blocks.


In blockchain, a miner is a person or organization that creates new blocks on the blockchain.

Blockchain Mining

In blockchain, mining is the process of utilizing software to brute force guess the correct nonce that will generate the correct hash. A miner can mine the next block only if they calculate the correct hash of the block.

Proof of Stake (PoS) Consensus Mechanism

In blockchain, the Proof of Stake (PoS) Consensus Mechanism is the consensus method used by Ethereum.

It involves participants staking their tokens (the native currency of the network) in exchange for a chance to mine the next block and earn a reward. Tokens can be “slashed” if participants partake in dishonest behavior.

Consensus Mechanisms

In blockchain, a Consensus Mechanism is the mechanism by which all the different computers in the blockchain network, nodes, come to agree on what data the ledger contains.

There are many different types of consensus mechanisms, such as:

  • Proof of Work (PoW)
  • Proof of Stake (PoS)
  • Proof of Transfer (PoX)
  • Proof of Burn (PoB)
  • Proof of History (PoH)
  • Proof of Space (PoS)
  • Proof of Authority (PoA)
  • Proof of Access

Proof of Work (PoW)

In blockchain, the Proof of Work (PoW) Consensus Mechanism is the consensus mechanism used by Bitcoin.

It involves computers doing a massive amount of cryptographic work in order to potentially win a chance at mining the next block and earning a block reward.


A blockweave is a chain in which one block is connected to multiple previous blocks as opposed to a single block as in blockchain. They are used in the Proof of Access consensus mechanism.

Proof of Transfer (PoX)

In blockchain, Proof of Transfer (PoX) is a consensus mechanism that is built on Proof of Work.

While, in the Bitcoin Proof of Work mechanism, miners expend energy to generate a new Bitcoin, in Proof of Transfer, miners expend Bitcoin to generate a new Stacks block.

Proof of Burn

In blockchain, Proof of Burn is a consensus mechanism where miners mine a new block by expending energy to destroy a resource.

Proof of History

In blockchain, Proof of History is a consensus mechanism that allows validator nodes to quickly verify that a certain transaction happened between two specific points in time in the blockchain.

Proof of Space

In blockchain, Proof of Space is a consensus mechanism in which users prove they are reserving space on a hard drive for network storage. The space is called a plot.

Learn More on Codecademy