Created
March 25, 2024 23:53
-
-
Save salmanshah1d/d4643c733f31edbb5f1d5c9080cfad1e to your computer and use it in GitHub Desktop.
Query the top miner on SN24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: python top_miner.py --wallet.name <name> --wallet.hotkey <hotkey> | |
import bittensor | |
subtensor = bittensor.subtensor(log_verbose=False) | |
root_validators = subtensor.neurons_lite(netuid=0) | |
netuid = 24 | |
metagraph = subtensor.metagraph(netuid) | |
miner_ranks = [(uid, metagraph.ranks[uid]) for uid in metagraph.uids] | |
# sort miners by ascending rank, take the top one (i.e. last one) and print its uid | |
print(f"The top miner on SN{netuid} is {sorted(miner_ranks, key=lambda x: x[1])[-1][0]}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment