Skip to content

document metagraph + upgrade glossary #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jul 4, 2025
Merged

document metagraph + upgrade glossary #19

merged 28 commits into from
Jul 4, 2025

Conversation

MichaelTrestman
Copy link

No description provided.

@MichaelTrestman MichaelTrestman marked this pull request as ready for review June 25, 2025 02:51
Copy link

cloudflare-workers-and-pages bot commented Jun 25, 2025

Deploying developer-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: b5accf6
Status: ✅  Deploy successful!
Preview URL: https://1a963af3.developer-docs-6uq.pages.dev
Branch Preview URL: https://metagraph.developer-docs-6uq.pages.dev

View logs

@MichaelTrestman MichaelTrestman marked this pull request as draft June 25, 2025 02:55
@MichaelTrestman MichaelTrestman marked this pull request as ready for review June 27, 2025 16:34
@MichaelTrestman MichaelTrestman marked this pull request as draft June 27, 2025 21:01
@MichaelTrestman MichaelTrestman changed the title document the metagraph document metagraph + upgrade glossary Jul 1, 2025
@MichaelTrestman MichaelTrestman marked this pull request as ready for review July 3, 2025 20:35
Copy link

@basfroman basfroman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@basfroman basfroman requested a review from a team July 3, 2025 21:38
@MichaelTrestman MichaelTrestman requested review from a team and removed request for a team July 3, 2025 22:03
@MichaelTrestman MichaelTrestman merged commit 7b8b888 into main Jul 4, 2025
1 check passed
Copy link

@chideraao chideraao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few changes/suggestions but LGTM!


```python
# Save metagraph for later use
metagraph.save()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe this is related to the m = Metagraph(...) definition line from earlier. I'd suggest using m.save() and m.load() in these code examples for consistency


This section provides practical examples of working with the Bittensor metagraph using the Python SDK. Each example demonstrates different aspects of metagraph analysis and data extraction.

Code examples can be found [here](https://github.com/latent-to/developer-docs/tree/main/static/code-examples/)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link opens an empty GH page.

asyncio.run(main())
```

### Complete Neuron Information

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this example returns an error:

Neuron 0:
  UID: 0
  Hotkey: 5H6vi9RFCQafW9ZXr6R7LDNMt38CTNBzG4grEEdKGGdhBHYp
  Coldkey: 5CoRXrWzSQKrRzibFoLF39fKRUmvF2mMZKDvDexfWNR4ikQQ
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[39], line 31
     28         print(f"  ---")
     30 if __name__ == "__main__":
---> 31     main() 

Cell In[39], line 15, in main()
     13 print(f"  Hotkey: {neuron.hotkey}")
     14 print(f"  Coldkey: {neuron.coldkey}")
---> 15 print(f"  Stake: τ{neuron.stake:.9f}")
     16 print(f"  Rank: {neuron.rank}")
     17 print(f"  Trust: {neuron.trust}")

TypeError: unsupported format string passed to Balance.__format__

## Source Code References

### Core Implementation
- **Metagraph Class**: [`bittensor/bittensor/core/metagraph.py`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/metagraph.py)
Copy link

@chideraao chideraao Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link returns an empty page

Suggested change
- **Metagraph Class**: [`bittensor/bittensor/core/metagraph.py`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/metagraph.py)
- **Metagraph Class**: [`bittensor/bittensor/core/metagraph.py`](https://github.com/opentensor/bittensor/blob/master/bittensor/core/metagraph.py)


### Core Implementation
- **Metagraph Class**: [`bittensor/bittensor/core/metagraph.py`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/metagraph.py)
- **Chain Data**: [`bittensor/bittensor/core/chain_data/metagraph_info.py`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/chain_data/metagraph_info.py)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Chain Data**: [`bittensor/bittensor/core/chain_data/metagraph_info.py`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/chain_data/metagraph_info.py)
- **Chain Data**: [`bittensor/bittensor/core/chain_data/metagraph_info.py`](https://github.com/opentensor/bittensor/blob/master/bittensor/core/chain_data/metagraph_info.py)

- **Mathematical Operations**: [`subtensor/pallets/subtensor/src/epoch/math.rs`](https://github.com/opentensor/subtensor/blob/main/pallets/subtensor/src/epoch/math.rs)

### Key Constants
- **TAO Stake Weight**: [`bittensor/bittensor/core/settings.py:7`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/settings.py#L7) - `ROOT_TAO_STAKE_WEIGHT = 0.18`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **TAO Stake Weight**: [`bittensor/bittensor/core/settings.py:7`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/settings.py#L7) - `ROOT_TAO_STAKE_WEIGHT = 0.18`
- **TAO Stake Weight**: [`bittensor/bittensor/core/settings.py:7`](https://github.com/opentensor/bittensor/blob/master/bittensor/core/settings.py#L8) - `ROOT_TAO_STAKE_WEIGHT = 0.18`

:::info Cache Location
Metagraph files are saved to `~/.bittensor/metagraphs/network-{network}/netuid-{netuid}/block-{block_number}.pt` by default. The files are persistent and not temporary.

**Source**: [`bittensor/bittensor/core/metagraph.py:96-115`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/metagraph.py#L96-L115)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Source**: [`bittensor/bittensor/core/metagraph.py:96-115`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/metagraph.py#L96-L115)
**Source**: [`bittensor/bittensor/core/metagraph.py:96-115`](https://github.com/opentensor/bittensor/blob/master/bittensor/core/metagraph.py#L96-L115)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants