> For the complete documentation index, see [llms.txt](https://docs.hypertensor.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hypertensor.org/build-a-subnet/consensus.md).

# Consensus

> See [Consensus Thread](/subnet-template/server/consensus-thread.md) in the template.

The **Consensus system** governs how nodes in a subnet **agree on the behavior and performance of each other**, particularly by assigning **weights** (or scores) that reflect the quality of their contributions.

The `Consensus` class runs **independently and in parallel** to the main Hypertensor network logic, and is designed to execute during each epoch.

## What It Does

The template provides a baseline `Consensus` implementation with the following responsibilities:

#### **1. Validator**

If the current node is elected as the **validator** for this epoch:

* Collects or computes **scores** for each node (e.g., based on output similarity, task performance, latency, etc.).
* Submits these scores **on-chain** to Hypertenso&#x72;**.**

#### **2. Attestor**

If the current node is assigned as an **attestor**:

* Collects or computes **scores** for each node.
* Retrieves the validator’s submitted scores for the epoch.
* Compares both sets of scores.
* Attest if they match exactly (e.g., **100% accuracy**)

> 📌 Attestation ensures accountability: validators must submit correct, verifiable scores, or face slashing, rejection, or reduced reputation.

***

## Epoch Flow Overview

1. **Epoch begins** (triggered by time or block height)
2. Each node checks its role:
   * If **validator**: generate and publish scores
   * If **attestor**: independently verify the scores
3. **Attestation is submitted** if scores match the validator's submitted consensus data.

***

## Customization

Subnets can extend the `Consensus` class to implement their own:

* Scoring logic (not included in template)
* Attestation criteria
* Coordination with on-chain governance or punishment systems
