Introduce SubtensorApi interface for SDK#2862
Merged
Conversation
added 19 commits
May 2, 2025 08:20
added 2 commits
May 6, 2025 17:17
…eat/roman/subtensor-api
thewhaleking
requested changes
May 7, 2025
Contributor
thewhaleking
left a comment
There was a problem hiding this comment.
Small changes, otherwise g2g
Co-authored-by: BD Himes <37844818+thewhaleking@users.noreply.github.com>
Co-authored-by: BD Himes <37844818+thewhaleking@users.noreply.github.com>
Co-authored-by: BD Himes <37844818+thewhaleking@users.noreply.github.com>
added 3 commits
May 7, 2025 15:45
thewhaleking
approved these changes
May 7, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends: opentensor/async-substrate-interface#100 (until this PR is merged, most tests fail)
SubtensorApi– Usage GuideThe
SubtensorApiis a high-level, unified interface to interact with the Bittensor blockchain. It wraps both the synchronous and asynchronousSubtensorimplementations, providing modular access to chain subsystems like wallets, delegates, neurons, and more.1. Basic Synchronous Usage (default)
2. Asynchronous Usage
3. Legacy Method Support
You can enable all legacy methods from the original
Subtensorclass directly on this interface:4. Retry and Fallback RPC Nodes
Enable redundancy and resilience with fallback chains and retry logic:
5. Mock Mode for Testing
Use
mock=Trueto simulate the interface without connecting to the blockchain:6. Subsystem Overview
All methods are grouped into logical modules for better organization and readability. Some methods may belong to more than one group if they span multiple functional areas. This does not compromise the internal logic — rather, it enhances discoverability and cohesion. Method equivalence between
SubtensorApiand the originalSubtensoris automatically verified by test coverage on every pull request (PR).The following properties are modular access points for specialized subsystems:
chaincommitmentsdelegatesextrinsicsmetagraphsneuronsqueriesstakessubnetswallets7. Custom Configuration Support
You can pass a pre-built
Configobject:8. Using as a Context Manager (Synchronous)
9. Using as a Context Manager (Asynchronous)