SubnetsBuilding a Subnet

Building a Subnet on Commune

What are Subnets?

Building a subnet on Commune means defining a desired output and building a validation and scoring system around it to align miner incentives towards an efficient competition of producing the desired output.

This document will give a overview of everything you should consider when building a subnet.

First, you should be familiar with Yuma Consensus that runs on all subnets except subnet 0.

On a technical level, you have to define 4 core things

  • Validator
  • Miner
  • Network Communication between them
  • Subnet Parameters

Validator

Validators are the most important and difficult component. Incentives are the fundamental product of your subnet, and they are defined by the validator.

Learn more about what validating means see here!

When designing incentives through validation, there are several things to consider:

  • adversarial robustness

Miners will dig through the code to find mechanism weaknesses that allow them to increase their score without increasing the value of their output. This can happen at minimal to subnet-breaking scale. Your validation is only as good as it is robust against bad actors. Consider things like miners running validators or over-fitting on data.

  • sensitive scoring

Validators score the value of miners to produce granular weights of their value. Your scoring should capture the differences in value between different miner outputs as sensitively as possible. The more sensitive, the more incentive for miners to care about quality and its details.

  • cost of validating a output has to be below the miners cost of producing it

Economically, a subnet stops making sense once the cost of validating an output is almost the same or exceeds the cost of producing it. Operating a validator is fine to require high-end GPUs or thousands of dollars a month, but on a per evaluated output basis the cost as to be well below the miners.

  • trustless & decentralized

Everyone with stake should be able to operate a validator and no component of it should depend on trust in you, only trust in code. An example of this is using a validation dataset that only you have full access to.

  • mining competition should not flatten out, but stimulate perpetual improvement

Validation should avoid putting a ceiling on the performance optimization of miners. In some contexts this is unavoidable, but generally an incentive landscape that rewards perpetual unbound improvement is fundamentally superior.

Miner

Miners are usually less complicated than validators, most of their logic is up for the miners to optimize. You have to provide a base template that your miners will modify and improve upon in the quest of maximizing their rewards.

Learn more what mining means see here!

Subnet Parameters

Subnet Parameters provide you a set of configurable constraints that you can adapt based on your validation design choices and needs on the fly. However, you have to move within the constraints of Global Parameters.

Learn more about what Subnet Parameters exist here!

Networking

Validators and miners are both endpoints communicating with one another. Usually Validators send requests to miners, miners compute an output and send a response back to validators. However there are things to consider like DDOSing, request load management, blacklisting, filtering etc.

Subnet Template

See Subnet Template

See an example of how to structure your subnet code.

View More

This subnet code template serves as a starting point for your development journey. You should replace the placeholder logic with your own custom implementations. This includes the scoring logic in the validator, the output generation logic in the miner, and any other components that require customization.

Note that there are many creative ways of building a subnet and this template is just the most basic form. Allow yourself to think freely and out of conventions. Fundamentally you just have validators calculating the weights of miners based on Yuma Consensus. Everything else is wide open for you to innovate in unexpected ways!

Strategically consider these things

  • optics, branding, marketing

    For your subnet to experience growth and be appreciated by the community you have to ensure it is seen and its value understood. The more excited people are about your subnet, the more stake, validators, miners you will be able to attract. Its important to take this seriously.

  • communication

    You should actively communicate about what is going on in your subnet and your latest developments. Talking with validators, miners and interested community members is key to make sure people are on the same page as you. This is a vital component to a successful subnet.

  • docs/guide

    Your code documentation and validator/miner documentation are very important to grow the participants and their happiness on your subnet. As good as the rest of your subnet is, if your docs are bad that will be a big negative for people.

  • utilization & product

    The subnets output should be valuable in some shape or form. This value should be actualized by utilizing it or making it available to the world. You should regularly present it and if possible facilitate peoples interaction with it through a dedicated frontend. You should be actively thinking about and optimally have a good plan on how to maximize the value generation out of your subnets output. However, the subnets output could also be a public good, such as an open-source dataset or model.

If you tackle all these factors competently while having a strong subnet mechanism, you are setup for big success in the Commune ecosystem.

Deployment and Operation

Initially you should deploy to testnet and ensure all components and their edge-cases are working like expected.

Once you are ready to deploy to Mainnet, follow these directions on how to deploy a subnet.

For emission production to start, you will have to get above the 5% Subnet Stake Threshold level. Communicating about your subnet with the Community will be key to achieve this.

After launch, monitor the performance and health of your subnet, help participants to resolve errors or technical issues. Constantly monitor the behavior of miners, manually check miner outputs and their scores to ensure the validation is working like intended. Monitor the incentive distribution over miners to see emerging extremes that could indicate an active exploit. Always work on improving the subnets mechanism.

Similar to how miners will perpetually optimize, you should do the same with the validation.

Thats it! Those are all basic things to know and consider before starting your journey of building a subnet. If you succeed, you can be greatly rewarded and will certainly learn a lot of things on the way. This is an exciting and emerging field and you have the opportunity to become one of the entrepreneurial pioneers!