Academy

Consensus Mechanisms

Learn how blockchains arrive at consensus using different mechanisms.

Consensus plays a crucial role in blockchain networks by resolving conflicts and ensuring that all validators agree on the current state of the distributed ledger. The main objective of a consensus mechanism is to create a single version of truth that is universally accepted by network participants.

Validators can reach a consensus by following a set of steps called a consensus protocol. This way, they collectively decide on the state of the system and all state changes. Different consensus mechanisms have different approaches. All aim to ensure that validators reach a majority agreement on network state.

Ordering through Consensus

Consensus is needed to agree on the order of state changes in a blockchain. This allows the validators to decide between two conflicting states.

Quiz topic

Time for a Quiz!

Wolfie wants to test your knowledge. Select the correct answer.

What is the role of validators in the event of conflicting transactions?

AValidators choose the transaction that benefits them the most.
BValidators automatically reject all conflicting transactions.
CValidators collectively decide on which of the two conflicting transactions will be accepted by all validators and determine the next state.
DValidators create a new transaction to resolve the conflict.

Double Spending Attack

A Double Spending Attack is when a user attempts to spend more crypto that they own by creating multiple transactions that reference the same funds.

Let's look at an Example: Alice owns 5 AVAX

Now Alice issues two transactions at the same time to different validators:

  1. Send 5 AVAX to Bob
  2. Send 5 AVAX to Charly

It is important that there is only a limited notion of time in blockchain systems. Even if Alice does not issue these transactions at the exact same time, validators cannot identify which was issued first.

Each of the transaction in itself is valid. Alice owns 5 AVAX and should be able to send them to whomever she wants. However, she should only be able to send the amount she actually owns.

Therefore, validators have to collectively come to consensus on which of the two conflicting transactions will be included in the blockchain first, and therefore be accepted by all validators as the next state. To illustrate, we will color the validators preferring Charlie yellow and the validators preferring Bob blue.

Quiz topic

Time for a Quiz!

Wolfie wants to test your knowledge. Select the correct answer.

What is a Double Spending Attack in the context of blockchain?

AIt is when a user attempts to spend more cryptocurrency than they own by creating multiple transactions that reference the same funds.
BIt is when a user tries to double the amount of cryptocurrency they own through fraudulent transactions.
CIt is when a user performs two transactions at the exact same time to exploit the system.
DIt is when a validator duplicates transactions to increase their validation rewards.
Edit on GitHub

Last updated on 1/9/2025

On this page