How to launch a Subnet

Concise documentation on how to create a subnet, its various parameters, effects, and post-creation status.

Requirements

You have to meet these requirements to create a subnet effectively:

  • You must have a valid Dark Matter NFT.

  • The Dark Matter NFT contract must be whitelisted.

  • The price calculator must be whitelisted.

  • You must have enough $SKY tokens to pay the required fees.

Creating a Subnet

To create a subnet, call the createSubnet function in the SubnetClusterA contract. This function requires several parameters:

function createSubnet(
    uint256[2] memory _nftAndContract,
    SubnetAttributes memory _subnetAttributes,
    address[] memory _whitelistedClusters,
    uint256[] memory _computePrices
) external

Parameters

  1. _nftAndContract: An array containing:

    • Index 0: The ID of the Dark Matter NFT.

    • Index 1: The contract address of the Dark Matter NFT.

  2. _subnetAttributes: A struct containing various subnet attributes:

    • subnetLocalDAO: Address of the subnet's local DAO.

    • subnetType: Type of subnet (e.g., public, private, sovereign).

    • subnetStatusListed: Initial status of the subnet (1 for waiting, 2 for active).

    • priceCalculator: Address of the price calculator contract.

    • otherAttributes: Array for additional attributes

    • maxClusters: Maximum number of clusters allowed (must be <= 1000).

    • subnetName: Name of the subnet.

    • dnsip: DNS/IP of the subnet.

    • stackFeesReqd: STACK fees required for clusters to join.

  3. _whitelistedClusters: Array of addresses for whitelisted clusters.

  4. _computePrices: Array of initial prices for different DePIN resource types.

Note: Ensure all parameters are correctly set before calling the function, as some attributes may require additional permissions to change later.

Effects

Calling the function does this:

  • Locks the Dark Matter NFT in the contract.

  • Transfers required $SKY fees to the global DAO.

  • Creates special roles for the SubnetDAO.

  • Sets up initial subnet attributes and DePIN resource prices.

  • Whitelists the provided cluster addresses.

Post-Creation

After creation, the subnet is in a waiting or active state (depending on subnetStatusListed). The SubnetDAO can further modify attributes, activate or deactivate the subnet, and manage various aspects of the subnet using other functions in the contract.

Last updated