-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitcheck.py
More file actions
39 lines (33 loc) · 1.13 KB
/
Copy pathcommitcheck.py
File metadata and controls
39 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import bittensor as bt
# sub = bt.subtensor()
# owner = sub.get_hotkey_owner(hotkey_ss58 = "5G1qw5gC3kTEAsy6rKNTLZDqeLypqDUQcoARDZXEhK2jZzwR")
# print(owner)
# exit()
def get_commits(netuid: int, uid: int):
try:
sub = bt.subtensor()
print(sub)
meta = sub.metagraph(netuid)
commits = sub.get_all_revealed_commitments(netuid)
hotkeys = meta.hotkeys
hotkey = hotkeys[uid]
if hotkey in commits:
commit = commits[hotkey]
return {
'uid': uid,
'hotkey': hotkey,
'commit_data': commit
}
else:
print(f"No commit data found for UID {uid} (hotkey: {hotkey})")
return None
except Exception as e:
print(f"Error getting commit data: {e}")
return None
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Check commit data for a given UID")
parser.add_argument("--uid", required=True, help="UID to check")
args = parser.parse_args()
uid = int(args.uid)
print(get_commits(120, uid))