Skip to main content

Bittensor Pallet

The Bittensor pallet is an essential component of the Hippius blockchain ecosystem, designed to facilitate the submission of miner weights from the Hippius chain to the Bittensor chain via RPC. This pallet ensures that the performance metrics of miners are accurately communicated and utilized within the Bittensor network.

Overview

The Bittensor pallet provides functionalities to handle the following operations:

  • Weight Submission: Sends the calculated weights of miners to the Bittensor chain.
  • Version Key Fetching: Retrieves the version key from the Bittensor API.
  • Weight Calculation: Computes weights for different types of miners based on their performance metrics.

Key Features

1. Weight Submission

Users can submit the weights of miners to the Bittensor chain:

Function: submit_weight_extrinsic

  • Parameters:

    • block_number: The current block number.
  • Returns: A Result indicating success or failure of the operation.

2. Fetching Version Key

The pallet can fetch the version key required for communication with the Bittensor API:

Function: fetch_version_key

  • Returns: A Result<u16, http::Error> containing the version key.

3. Calculating Weights for Miners

The pallet includes methods to calculate weights for different types of miners based on their performance metrics:

Functions:

  • calculate_storage_miner_weights
  • calculate_storage_s3_weights
  • calculate_validator_weights
  • calculate_gpu_miner_weights
  • calculate_compute_miner_weights

Each function takes a list of miners and their metrics, returning vectors of weights and corresponding node identifiers.

Storage Structures

The Bittensor pallet utilizes several storage structures to manage state:

  • None: This pallet does not define any persistent storage structures.

Events

The pallet emits several events to notify the system and users about significant actions:

  • None: This pallet does not currently define any events.

Errors

The pallet defines several error types to handle various failure scenarios:

  • NoneValue: Raised when a value is None.
  • StorageOverflow: Raised when a storage operation exceeds its limits.
  • SubmissionDisabled: Raised when submission of weights is disabled.

Conclusion

The Bittensor pallet plays a vital role in the Hippius blockchain ecosystem by enabling the submission of miner weights to the Bittensor chain. Its design ensures that miner performance metrics are accurately communicated, enhancing the overall functionality and interoperability of the network.

For further information, please refer to the related pallets and documentation within the Hippius ecosystem.