Subnet Nodes

Add Subnet Node

Once the user has begun running their node within the AI Model Hosting network, a peer_id will be returned. Once returned, users can then store their peer data on the blockchain to begin accruing rewards.

pub fn add_subnet_node(
    origin: OriginFor<T>, 
    subnet_id: u32, 
    peer_id: PeerId, 
    stake_to_be_added: u128
) -> DispatchResult

Parameters

  • subnet_id: The key of the subnet.

  • peer_id: The ID of the peer running a node to host a subnet model. This is returned when a peer is successfully added.

    • The peer_id must abide by the following possible formats

      • The peer_id must be between 32 and 128 characters.

      • Starting with a Qm - Peer ID (sha256) encoded as a raw base58btc multihash.

      • Starting with a 1 - Peer ID (ed25519, using the "identity" multihash) encoded as a raw base58btc multihash.

      • Starting with a e or b or z or m - Peer ID (sha256) encoded as a CID.

  • stake_to_be_added: The balance to stake towards a specific subnet.

    • There is a minimum required stake balance per peer.


Update Subnet Node

A peer can update its peer_id if they're able to submit consensus. This is primarily meant for updating the peer_id if a subnet nodes hosting subnet goes down and the node needs to be restarted under a new peer_id.

pub fn update_subnet_node(
    origin: OriginFor<T>, 
    subnet_id: u32, 
    peer_id: PeerId,
) -> DispatchResult

Parameters

  • subnet_id: The key of the subnet.

  • peer_id: The ID of the peer running a node to host a subnet. This is returned when a peer is successfully added.

    • The peer_id must abide by the following possible formats

      • The peer_id must be between 32 and 128 characters.

      • Starting with a Qm - Peer ID (sha256) encoded as a raw base58btc multihash.

      • Starting with a 1 - Peer ID (ed25519, using the "identity" multihash) encoded as a raw base58btc multihash.

      • Starting with a e or b or z or m - Peer ID (sha256) encoded as a CID.


Remove Subnet Node

pub fn remove_subnet_node(
    origin: OriginFor<T>, 
    subnet_id: u32, 
) -> DispatchResult

Parameters

  • subnet_id: The key of the subnet.

Last updated