pub struct BittensorConfig {
pub wallet_name: String,
pub hotkey_name: String,
pub network: String,
pub netuid: u16,
pub chain_endpoint: Option<String>,
pub fallback_endpoints: Vec<String>,
pub weight_interval_secs: u64,
pub read_only: bool,
pub connection_pool_size: Option<usize>,
pub health_check_interval: Option<Duration>,
pub circuit_breaker_threshold: Option<u32>,
pub circuit_breaker_recovery: Option<Duration>,
}Expand description
Bittensor network configuration
§Example
use bittensor_rs::config::BittensorConfig;
let config = BittensorConfig::default();
assert_eq!(config.network, "finney");Fields§
§wallet_name: StringWallet name for operations
hotkey_name: StringHotkey name for the neuron
network: StringNetwork to connect to (“finney”, “test”, or “local”)
netuid: u16Subnet netuid
chain_endpoint: Option<String>Optional chain endpoint override
fallback_endpoints: Vec<String>Optional fallback chain endpoints for failover
weight_interval_secs: u64Weight setting interval in seconds
read_only: boolRead-only mode (default: false) When true, wallet is only used for querying metagraph, not signing transactions
connection_pool_size: Option<usize>Connection pool size (default: 3)
health_check_interval: Option<Duration>Health check interval (default: 60 seconds)
circuit_breaker_threshold: Option<u32>Circuit breaker failure threshold (default: 5)
circuit_breaker_recovery: Option<Duration>Circuit breaker recovery timeout (default: 60 seconds)
Implementations§
Source§impl BittensorConfig
impl BittensorConfig
Sourcepub fn finney(wallet_name: &str, hotkey_name: &str, netuid: u16) -> Self
pub fn finney(wallet_name: &str, hotkey_name: &str, netuid: u16) -> Self
Create a new configuration for the finney network
§Example
use bittensor_rs::config::BittensorConfig;
let config = BittensorConfig::finney("my_wallet", "my_hotkey", 1);
assert_eq!(config.network, "finney");Sourcepub fn testnet(wallet_name: &str, hotkey_name: &str, netuid: u16) -> Self
pub fn testnet(wallet_name: &str, hotkey_name: &str, netuid: u16) -> Self
Create a new configuration for the test network
§Example
use bittensor_rs::config::BittensorConfig;
let config = BittensorConfig::testnet("my_wallet", "my_hotkey", 1);
assert_eq!(config.network, "test");Sourcepub fn local(wallet_name: &str, hotkey_name: &str, netuid: u16) -> Self
pub fn local(wallet_name: &str, hotkey_name: &str, netuid: u16) -> Self
Create a new configuration for a local network
§Example
use bittensor_rs::config::BittensorConfig;
let config = BittensorConfig::local("my_wallet", "my_hotkey", 1);
assert_eq!(config.network, "local");Sourcepub fn get_chain_endpoint(&self) -> String
pub fn get_chain_endpoint(&self) -> String
Get the chain endpoint, auto-detecting based on network if not explicitly configured
§Panics
Panics if the network is not one of: finney, test, local
§Example
use bittensor_rs::config::BittensorConfig;
let config = BittensorConfig::default();
let endpoint = config.get_chain_endpoint();
assert!(endpoint.starts_with("wss://"));Sourcepub fn get_chain_endpoints(&self) -> Vec<String>
pub fn get_chain_endpoints(&self) -> Vec<String>
Get all chain endpoints including fallbacks
Returns the primary endpoint followed by any configured fallback endpoints. If no fallbacks are configured, network-specific defaults are added.
§Example
use bittensor_rs::config::BittensorConfig;
let config = BittensorConfig::default();
let endpoints = config.get_chain_endpoints();
assert!(!endpoints.is_empty());Sourcepub fn with_endpoint(self, endpoint: &str) -> Self
pub fn with_endpoint(self, endpoint: &str) -> Self
Set a custom chain endpoint
Sourcepub fn with_fallback_endpoints(self, endpoints: Vec<String>) -> Self
pub fn with_fallback_endpoints(self, endpoints: Vec<String>) -> Self
Set fallback endpoints
Sourcepub fn with_pool_size(self, size: usize) -> Self
pub fn with_pool_size(self, size: usize) -> Self
Set connection pool size
Sourcepub fn with_read_only(self, read_only: bool) -> Self
pub fn with_read_only(self, read_only: bool) -> Self
Set read-only mode
Trait Implementations§
Source§impl Clone for BittensorConfig
impl Clone for BittensorConfig
Source§fn clone(&self) -> BittensorConfig
fn clone(&self) -> BittensorConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BittensorConfig
impl Debug for BittensorConfig
Source§impl Default for BittensorConfig
impl Default for BittensorConfig
Source§impl<'de> Deserialize<'de> for BittensorConfig
impl<'de> Deserialize<'de> for BittensorConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for BittensorConfig
impl RefUnwindSafe for BittensorConfig
impl Send for BittensorConfig
impl Sync for BittensorConfig
impl Unpin for BittensorConfig
impl UnwindSafe for BittensorConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read moreSource§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.