> 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/copy-of-subnet-template/introduction.md).

# Introduction

The subnet template is a P2P coordination layer to deploy clusters of nodes that communicate in a decentralized network. Your job is to build the distributed AI application logic on top of it.

There are three main facets for building a decentralized AI subnet:

## Application

This is the business logic for each peer and can be made to be role-isolated. Peers or roles have specific tasks; this is where that logic deploys from and lives. For example, a peer can be responsible for generating inference, validating trainer peers, etc.

The application logic is deployed from the [server](/copy-of-subnet-template/server.md) template. The template handles deploying **both the communication and consensus & scoring classes mentioned below**.

## Communication

This is how peers communicate with one another. There are two main features for peers to communicate with one another: **using a GossipSub or direct P2P communication** via custom protocols or the API protocol.

**Learn how to use the built-in communication templates, and build your own** [**here**](/copy-of-subnet-template/communication.md)**.**

## Consensus & Scoring

The consensus mechanism is for scoring peers. Each peer needs to know the scores of each other peer, whether there is one role or many roles. On each epoch, a validator from the subnet will be randomly elected for an attestation-based consensus mechanism, where this validator submits scores for each peer in the subnet. The other peers can vote on that proposal by attesting to it; not attesting to it counts as a non-vote. The subnet must reach a consensus of >66% to generate emissions.
