Registration

Each subnet must be registered on-chain with the following requirements:

  • Cost: 100 TENSOR

Required parameters:

The blockchain stores the following parameters for each subnet:

pub struct SubnetData {
	pub id: u32,
	pub path: Vec<u8>,
	pub min_nodes: u32,
	pub target_nodes: u32,
	pub memory_mb: u128,
	pub initialized: u64,
	pub registration_blocks: u64,
	pub activated: u64,
}
  • id: The unique identifier for the subnet (generated on-chain)

  • path: The unique path for the subnet (submitted by the registerer)

    • This is the location of the open-sourced model from which subnet nodes can download it.

  • min_nodes: The minimum required nodes to run a subnet defined by blockchain validators using the memory_mbparameter (generated on-chain)

    • min_nodesis calculated using a non-linear or linear (depending on the parameters) slope based on the subnets required memory, as:

        pub fn get_min_subnet_nodes(base_node_memory: u128, memory_mb: u128) -> u32 {
          // --- Get min nodes based on default memory settings
          let simple_min_subnet_nodes: u128 = memory_mb / base_node_memory;
      
          // --- Parameters
          let params: MinNodesCurveParametersSet = MinNodesCurveParameters::<T>::get();
          let one_hundred = Self::PERCENTAGE_FACTOR;
          let x_curve_start = params.x_curve_start;
          let y_end = params.y_end;
          let y_start = params.y_start;
          let x_rise = Self::PERCENTAGE_FACTOR / 100;
      
          let max_subnet_memory = MaxSubnetMemoryMB::<T>::get();
      
          let mut subnet_mem_position = Self::PERCENTAGE_FACTOR;
          
          // If max subnet memory in curve is surpassed
          if memory_mb < max_subnet_memory {
            subnet_mem_position = memory_mb * Self::PERCENTAGE_FACTOR / max_subnet_memory;
          }
      
          // The position of the range where ``memory_mb`` is located
          // let subnet_mem_position = memory_mb * Self::PERCENTAGE_FACTOR / max_subnet_memory;
          let mut min_subnet_nodes: u32 = MinSubnetNodes::<T>::get();
      
          if subnet_mem_position <= x_curve_start {
            if simple_min_subnet_nodes as u32 > min_subnet_nodes {
              min_subnet_nodes = simple_min_subnet_nodes as u32;
            }
            return min_subnet_nodes
          }
      
          let mut x = 0;
      
          if subnet_mem_position >= x_curve_start && subnet_mem_position <= Self::PERCENTAGE_FACTOR {
            // If subnet memory position is in between range
            x = (subnet_mem_position-x_curve_start) * Self::PERCENTAGE_FACTOR / (Self::PERCENTAGE_FACTOR-x_curve_start);
          } else if subnet_mem_position > Self::PERCENTAGE_FACTOR {
            // If subnet memory is greater than 100%
            x = Self::PERCENTAGE_FACTOR;
          }
      
          let y = (y_start - y_end) * (Self::PERCENTAGE_FACTOR - x) / Self::PERCENTAGE_FACTOR + y_end;
      
          let min_subnet_nodes_on_curve = Self::percent_mul_round_up(y, simple_min_subnet_nodes);
      
          // Redundant
          if min_subnet_nodes_on_curve as u32 > min_subnet_nodes {
            min_subnet_nodes = min_subnet_nodes_on_curve as u32;
          }
      
          min_subnet_nodes
        }
      
  • target_nodes: The target nodes are multiple of the min_nodesbased on the TargetNodesMultiplier

  • memory_mb: Memory (MB) to fully host the subnet minus embedding layers (submitted by the registerer)

  • initialized: The block the subnet was activated (generated on-chain)

  • registration_blocks: The time the subnet has in the registration period to qualify for activation (submitted by the registerer with a required minimum and maximum)

    • The minimum required registration period is 9 days and the maximum is 21 days.

  • activated: The block the subnet was activated

Once a subnet is registered, it can then achieve the required activation conditions.

Last updated