bittensor 6.4.0__tar.gz → 6.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bittensor-6.4.0/bittensor.egg-info → bittensor-6.4.2}/PKG-INFO +9 -8
- {bittensor-6.4.0 → bittensor-6.4.2}/README.md +9 -8
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/__init__.py +11 -4
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/chain_data.py +6 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/network.py +0 -1
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/overview.py +2 -2
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/stake.py +1 -1
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/network.py +2 -2
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/transfer.py +10 -3
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/subtensor.py +58 -11
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/__init__.py +22 -16
- {bittensor-6.4.0 → bittensor-6.4.2/bittensor.egg-info}/PKG-INFO +9 -8
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/integration_tests/test_subtensor_integration.py +4 -19
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/utils/test_utils.py +38 -30
- {bittensor-6.4.0 → bittensor-6.4.2}/LICENSE +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bin/btcli +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/axon.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/btlogging.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/cli.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/__init__.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/delegates.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/identity.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/inspect.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/list.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/metagraph.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/misc.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/register.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/root.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/senate.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/transfer.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/unstake.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/utils.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/commands/wallets.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/config.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/dendrite.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/errors.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/__init__.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/delegation.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/log_utilities.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/prometheus.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/registration.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/root.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/senate.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/serving.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/set_weights.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/staking.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/extrinsics/unstaking.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/keyfile.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/metagraph.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/mock/__init__.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/mock/keyfile_mock.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/mock/subtensor_mock.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/mock/wallet_mock.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/stream.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/synapse.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/tensor.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/threadpool.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/types.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/_register_cuda.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/balance.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/formatting.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/networking.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/registration.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/stats.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/test_utils.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/wallet_utils.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/utils/weight_utils.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor/wallet.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor.egg-info/SOURCES.txt +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor.egg-info/dependency_links.txt +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor.egg-info/requires.txt +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/bittensor.egg-info/top_level.txt +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/setup.cfg +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/setup.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/__init__.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/helpers/__init__.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/helpers/helpers.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/integration_tests/__init__.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/integration_tests/test_cli.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/integration_tests/test_cli_no_network.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/integration_tests/test_metagraph_integration.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/__init__.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/test_axon.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/test_dendrite.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/test_keyfile.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/test_metagraph.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/test_subtensor.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/test_synapse.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/test_tensor.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/test_wallet.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/utils/__init__.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/utils/test_balance.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/utils/test_networking.py +0 -0
- {bittensor-6.4.0 → bittensor-6.4.2}/tests/unit_tests/utils/test_weight_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bittensor
|
|
3
|
-
Version: 6.4.
|
|
3
|
+
Version: 6.4.2
|
|
4
4
|
Summary: bittensor
|
|
5
5
|
Home-page: https://github.com/opentensor/bittensor
|
|
6
6
|
Author: bittensor.com
|
|
@@ -228,7 +228,7 @@ positional arguments:
|
|
|
228
228
|
lock_cost Return the lock cost to register a subnet.
|
|
229
229
|
create Create a new bittensor subnetwork on this chain.
|
|
230
230
|
register Register a wallet to a network.
|
|
231
|
-
|
|
231
|
+
pow_register Register a wallet to a network using PoW.
|
|
232
232
|
hyperparameters View subnet hyperparameters.
|
|
233
233
|
|
|
234
234
|
options:
|
|
@@ -309,28 +309,28 @@ Axon: Serves Synapse protocols with custom blacklist, priority and verify functi
|
|
|
309
309
|
```python
|
|
310
310
|
import bittensor
|
|
311
311
|
|
|
312
|
-
class
|
|
312
|
+
class MySynapse( bittensor.Synapse ):
|
|
313
313
|
input: int = 1
|
|
314
314
|
output: int = None
|
|
315
315
|
|
|
316
316
|
# Define a custom request forwarding function
|
|
317
|
-
def forward( synapse:
|
|
317
|
+
def forward( synapse: MySynapse ) -> MySynapse:
|
|
318
318
|
# Apply custom logic to synapse and return it
|
|
319
319
|
synapse.output = 2
|
|
320
320
|
return synapse
|
|
321
321
|
|
|
322
322
|
# Define a custom request verification function
|
|
323
|
-
def verify_my_synapse( synapse:
|
|
323
|
+
def verify_my_synapse( synapse: MySynapse ):
|
|
324
324
|
# Apply custom verification logic to synapse
|
|
325
325
|
# Optionally raise Exception
|
|
326
326
|
|
|
327
327
|
# Define a custom request blacklist function
|
|
328
|
-
def blacklist_my_synapse( synapse:
|
|
328
|
+
def blacklist_my_synapse( synapse: MySynapse ) -> bool:
|
|
329
329
|
# Apply custom blacklist
|
|
330
330
|
# return False ( if non blacklisted ) or True ( if blacklisted )
|
|
331
331
|
|
|
332
332
|
# Define a custom request priority function
|
|
333
|
-
def prioritize_my_synape( synapse:
|
|
333
|
+
def prioritize_my_synape( synapse: MySynapse ) -> float:
|
|
334
334
|
# Apply custom priority
|
|
335
335
|
return 1.0
|
|
336
336
|
|
|
@@ -348,6 +348,7 @@ my_axon.attach(
|
|
|
348
348
|
|
|
349
349
|
Dendrite: Inheriting from PyTorch's Module class, represents the abstracted implementation of a network client module designed
|
|
350
350
|
to send requests to those endpoints to receive inputs.
|
|
351
|
+
|
|
351
352
|
Example:
|
|
352
353
|
```python
|
|
353
354
|
dendrite_obj = dendrite( wallet = bittensor.wallet() )
|
|
@@ -367,7 +368,7 @@ Use the `root` subcommand to access setting weights on the network across subnet
|
|
|
367
368
|
```bash
|
|
368
369
|
btcli root weights --wallet.name <coldname> --wallet.hotkey <hotname>
|
|
369
370
|
Enter netuids (e.g. 0, 1, 2 ...):
|
|
370
|
-
# Here enter your selected netuids to
|
|
371
|
+
# Here enter your selected netuids to set weights on
|
|
371
372
|
1, 2
|
|
372
373
|
|
|
373
374
|
>Enter weights (e.g. 0.09, 0.09, 0.09 ...):
|
|
@@ -201,7 +201,7 @@ positional arguments:
|
|
|
201
201
|
lock_cost Return the lock cost to register a subnet.
|
|
202
202
|
create Create a new bittensor subnetwork on this chain.
|
|
203
203
|
register Register a wallet to a network.
|
|
204
|
-
|
|
204
|
+
pow_register Register a wallet to a network using PoW.
|
|
205
205
|
hyperparameters View subnet hyperparameters.
|
|
206
206
|
|
|
207
207
|
options:
|
|
@@ -282,28 +282,28 @@ Axon: Serves Synapse protocols with custom blacklist, priority and verify functi
|
|
|
282
282
|
```python
|
|
283
283
|
import bittensor
|
|
284
284
|
|
|
285
|
-
class
|
|
285
|
+
class MySynapse( bittensor.Synapse ):
|
|
286
286
|
input: int = 1
|
|
287
287
|
output: int = None
|
|
288
288
|
|
|
289
289
|
# Define a custom request forwarding function
|
|
290
|
-
def forward( synapse:
|
|
290
|
+
def forward( synapse: MySynapse ) -> MySynapse:
|
|
291
291
|
# Apply custom logic to synapse and return it
|
|
292
292
|
synapse.output = 2
|
|
293
293
|
return synapse
|
|
294
294
|
|
|
295
295
|
# Define a custom request verification function
|
|
296
|
-
def verify_my_synapse( synapse:
|
|
296
|
+
def verify_my_synapse( synapse: MySynapse ):
|
|
297
297
|
# Apply custom verification logic to synapse
|
|
298
298
|
# Optionally raise Exception
|
|
299
299
|
|
|
300
300
|
# Define a custom request blacklist function
|
|
301
|
-
def blacklist_my_synapse( synapse:
|
|
301
|
+
def blacklist_my_synapse( synapse: MySynapse ) -> bool:
|
|
302
302
|
# Apply custom blacklist
|
|
303
303
|
# return False ( if non blacklisted ) or True ( if blacklisted )
|
|
304
304
|
|
|
305
305
|
# Define a custom request priority function
|
|
306
|
-
def prioritize_my_synape( synapse:
|
|
306
|
+
def prioritize_my_synape( synapse: MySynapse ) -> float:
|
|
307
307
|
# Apply custom priority
|
|
308
308
|
return 1.0
|
|
309
309
|
|
|
@@ -321,6 +321,7 @@ my_axon.attach(
|
|
|
321
321
|
|
|
322
322
|
Dendrite: Inheriting from PyTorch's Module class, represents the abstracted implementation of a network client module designed
|
|
323
323
|
to send requests to those endpoints to receive inputs.
|
|
324
|
+
|
|
324
325
|
Example:
|
|
325
326
|
```python
|
|
326
327
|
dendrite_obj = dendrite( wallet = bittensor.wallet() )
|
|
@@ -340,7 +341,7 @@ Use the `root` subcommand to access setting weights on the network across subnet
|
|
|
340
341
|
```bash
|
|
341
342
|
btcli root weights --wallet.name <coldname> --wallet.hotkey <hotname>
|
|
342
343
|
Enter netuids (e.g. 0, 1, 2 ...):
|
|
343
|
-
# Here enter your selected netuids to
|
|
344
|
+
# Here enter your selected netuids to set weights on
|
|
344
345
|
1, 2
|
|
345
346
|
|
|
346
347
|
>Enter weights (e.g. 0.09, 0.09, 0.09 ...):
|
|
@@ -377,4 +378,4 @@ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR I
|
|
|
377
378
|
|
|
378
379
|
|
|
379
380
|
## Acknowledgments
|
|
380
|
-
**learning-at-home/hivemind**
|
|
381
|
+
**learning-at-home/hivemind**
|
|
@@ -27,7 +27,7 @@ import nest_asyncio
|
|
|
27
27
|
nest_asyncio.apply()
|
|
28
28
|
|
|
29
29
|
# Bittensor code and protocol version.
|
|
30
|
-
__version__ = "6.4.
|
|
30
|
+
__version__ = "6.4.2"
|
|
31
31
|
version_split = __version__.split(".")
|
|
32
32
|
__version_as_int__ = (
|
|
33
33
|
(100 * int(version_split[0]))
|
|
@@ -107,9 +107,16 @@ __rao_symbol__: str = chr(0x03C1)
|
|
|
107
107
|
# Block Explorers map network to explorer url
|
|
108
108
|
## Must all be polkadotjs explorer urls
|
|
109
109
|
__network_explorer_map__ = {
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
"opentensor": {
|
|
111
|
+
"local": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
|
|
112
|
+
"endpoint": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
|
|
113
|
+
"finney": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
|
|
114
|
+
},
|
|
115
|
+
"taostats": {
|
|
116
|
+
"local": "https://x.taostats.io",
|
|
117
|
+
"endpoint": "https://x.taostats.io",
|
|
118
|
+
"finney": "https://x.taostats.io",
|
|
119
|
+
},
|
|
113
120
|
}
|
|
114
121
|
|
|
115
122
|
# --- Type Registry ---
|
|
@@ -174,6 +174,8 @@ custom_rpc_type_registry = {
|
|
|
174
174
|
["max_burn", "Compact<u64>"],
|
|
175
175
|
["bonds_moving_avg", "Compact<u64>"],
|
|
176
176
|
["max_regs_per_block", "Compact<u16>"],
|
|
177
|
+
["serving_rate_limit", "Compact<u64>"],
|
|
178
|
+
["max_validators", "Compact<u16>"],
|
|
177
179
|
],
|
|
178
180
|
},
|
|
179
181
|
}
|
|
@@ -963,6 +965,8 @@ class SubnetHyperparameters:
|
|
|
963
965
|
max_burn: int
|
|
964
966
|
bonds_moving_avg: int
|
|
965
967
|
max_regs_per_block: int
|
|
968
|
+
serving_rate_limit: int
|
|
969
|
+
max_validators: int
|
|
966
970
|
|
|
967
971
|
@classmethod
|
|
968
972
|
def from_vec_u8(cls, vec_u8: List[int]) -> Optional["SubnetHyperparameters"]:
|
|
@@ -1013,6 +1017,8 @@ class SubnetHyperparameters:
|
|
|
1013
1017
|
max_burn=decoded["max_burn"],
|
|
1014
1018
|
bonds_moving_avg=decoded["bonds_moving_avg"],
|
|
1015
1019
|
max_regs_per_block=decoded["max_regs_per_block"],
|
|
1020
|
+
max_validators=decoded["max_validators"],
|
|
1021
|
+
serving_rate_limit=decoded["serving_rate_limit"],
|
|
1016
1022
|
)
|
|
1017
1023
|
|
|
1018
1024
|
def to_parameter_dict(self) -> "torch.nn.ParameterDict":
|
|
@@ -558,7 +558,7 @@ class OverviewCommand:
|
|
|
558
558
|
result: List["bittensor.NeuronInfoLite"] = []
|
|
559
559
|
|
|
560
560
|
try:
|
|
561
|
-
subtensor = bittensor.subtensor(config=subtensor_config)
|
|
561
|
+
subtensor = bittensor.subtensor(config=subtensor_config, log_verbose=False)
|
|
562
562
|
|
|
563
563
|
all_neurons: List["bittensor.NeuronInfoLite"] = subtensor.neurons_lite(
|
|
564
564
|
netuid=netuid
|
|
@@ -587,7 +587,7 @@ class OverviewCommand:
|
|
|
587
587
|
result: List[Tuple[str, "bittensor.Balance"]] = []
|
|
588
588
|
|
|
589
589
|
try:
|
|
590
|
-
subtensor = bittensor.subtensor(config=subtensor_config)
|
|
590
|
+
subtensor = bittensor.subtensor(config=subtensor_config, log_verbose=False)
|
|
591
591
|
|
|
592
592
|
# Pull all stake for our coldkey
|
|
593
593
|
all_stake_info_for_coldkey = subtensor.get_stake_info_for_coldkey(
|
|
@@ -375,7 +375,7 @@ class StakeShow:
|
|
|
375
375
|
Returns:
|
|
376
376
|
A dictionary mapping SS58 addresses to their respective stake account details.
|
|
377
377
|
"""
|
|
378
|
-
subtensor = bittensor.subtensor(config=cli.config)
|
|
378
|
+
subtensor = bittensor.subtensor(config=cli.config, log_verbose=False)
|
|
379
379
|
|
|
380
380
|
wallet_stake_accounts = {}
|
|
381
381
|
|
|
@@ -159,7 +159,7 @@ def set_hyperparameter_extrinsic(
|
|
|
159
159
|
):
|
|
160
160
|
with subtensor.substrate as substrate:
|
|
161
161
|
extrinsic_params = substrate.get_metadata_call_function(
|
|
162
|
-
"
|
|
162
|
+
"AdminUtils", extrinsic
|
|
163
163
|
)
|
|
164
164
|
value_argument = extrinsic_params["fields"][
|
|
165
165
|
len(extrinsic_params["fields"]) - 1
|
|
@@ -167,7 +167,7 @@ def set_hyperparameter_extrinsic(
|
|
|
167
167
|
|
|
168
168
|
# create extrinsic call
|
|
169
169
|
call = substrate.compose_call(
|
|
170
|
-
call_module="
|
|
170
|
+
call_module="AdminUtils",
|
|
171
171
|
call_function=extrinsic,
|
|
172
172
|
call_params={"netuid": netuid, str(value_argument["name"]): value},
|
|
173
173
|
)
|
|
@@ -129,12 +129,19 @@ def transfer_extrinsic(
|
|
|
129
129
|
"[green]Block Hash: {}[/green]".format(block_hash)
|
|
130
130
|
)
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
explorer_urls = bittensor.utils.get_explorer_url_for_network(
|
|
133
133
|
subtensor.network, block_hash, bittensor.__network_explorer_map__
|
|
134
134
|
)
|
|
135
|
-
if
|
|
135
|
+
if explorer_urls != {}:
|
|
136
136
|
bittensor.__console__.print(
|
|
137
|
-
"[green]Explorer Link: {}[/green]".format(
|
|
137
|
+
"[green]Opentensor Explorer Link: {}[/green]".format(
|
|
138
|
+
explorer_urls.get("opentensor")
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
bittensor.__console__.print(
|
|
142
|
+
"[green]Taostats Explorer Link: {}[/green]".format(
|
|
143
|
+
explorer_urls.get("taostats")
|
|
144
|
+
)
|
|
138
145
|
)
|
|
139
146
|
else:
|
|
140
147
|
bittensor.__console__.print(
|
|
@@ -109,8 +109,8 @@ class subtensor:
|
|
|
109
109
|
investments.
|
|
110
110
|
|
|
111
111
|
Attributes:
|
|
112
|
-
network (str): The name of the Bittensor network (e.g., 'finney', 'local') the instance
|
|
113
|
-
connected to, determining the blockchain interaction context.
|
|
112
|
+
network (str): The name of the Bittensor network (e.g., 'finney', 'test', 'archive', 'local') the instance
|
|
113
|
+
is connected to, determining the blockchain interaction context.
|
|
114
114
|
chain_endpoint (str): The blockchain node endpoint URL, enabling direct communication
|
|
115
115
|
with the Bittensor blockchain for transaction processing and data retrieval.
|
|
116
116
|
|
|
@@ -154,18 +154,20 @@ class subtensor:
|
|
|
154
154
|
def add_args(cls, parser: argparse.ArgumentParser, prefix: str = None):
|
|
155
155
|
prefix_str = "" if prefix == None else prefix + "."
|
|
156
156
|
try:
|
|
157
|
-
default_network = os.getenv("BT_SUBTENSOR_NETWORK") or "
|
|
157
|
+
default_network = os.getenv("BT_SUBTENSOR_NETWORK") or "finney"
|
|
158
158
|
default_chain_endpoint = (
|
|
159
159
|
os.getenv("BT_SUBTENSOR_CHAIN_ENDPOINT")
|
|
160
|
-
or bittensor.
|
|
160
|
+
or bittensor.__finney_entrypoint__
|
|
161
161
|
)
|
|
162
162
|
parser.add_argument(
|
|
163
163
|
"--" + prefix_str + "subtensor.network",
|
|
164
164
|
default=default_network,
|
|
165
165
|
type=str,
|
|
166
166
|
help="""The subtensor network flag. The likely choices are:
|
|
167
|
-
-- local (local running network)
|
|
168
167
|
-- finney (main network)
|
|
168
|
+
-- test (test network)
|
|
169
|
+
-- archive (archive network +300 blocks)
|
|
170
|
+
-- local (local running network)
|
|
169
171
|
If this option is set it overloads subtensor.chain_endpoint with
|
|
170
172
|
an entry point node from that network.
|
|
171
173
|
""",
|
|
@@ -195,6 +197,7 @@ class subtensor:
|
|
|
195
197
|
Args:
|
|
196
198
|
network (str): The network flag. The likely choices are:
|
|
197
199
|
-- finney (main network)
|
|
200
|
+
-- archive (archive network +300 blocks)
|
|
198
201
|
-- local (local running network)
|
|
199
202
|
-- test (test network)
|
|
200
203
|
chain_endpoint (str): The chain endpoint flag. If set, overrides the network argument.
|
|
@@ -295,10 +298,18 @@ class subtensor:
|
|
|
295
298
|
network: str = None,
|
|
296
299
|
config: "bittensor.config" = None,
|
|
297
300
|
_mock: bool = False,
|
|
301
|
+
log_verbose: bool = True,
|
|
298
302
|
) -> None:
|
|
299
303
|
"""
|
|
300
304
|
Initializes a Subtensor interface for interacting with the Bittensor blockchain.
|
|
301
305
|
|
|
306
|
+
NOTE: Currently subtensor defaults to the finney network. This will change in a future release.
|
|
307
|
+
|
|
308
|
+
We strongly encourage users to run their own local subtensor node whenever possible. This increases
|
|
309
|
+
decentralization and resilience of the network. In a future release, local subtensor will become the
|
|
310
|
+
default and the fallback to finney removed. Please plan ahead for this change. We will provide detailed
|
|
311
|
+
instructions on how to run a local subtensor node in the documentation in a subsequent release.
|
|
312
|
+
|
|
302
313
|
Args:
|
|
303
314
|
network (str, optional): The network name to connect to (e.g., 'finney', 'local').
|
|
304
315
|
Defaults to the main Bittensor network if not specified.
|
|
@@ -320,6 +331,22 @@ class subtensor:
|
|
|
320
331
|
# Setup config.subtensor.network and config.subtensor.chain_endpoint
|
|
321
332
|
self.chain_endpoint, self.network = subtensor.setup_config(network, config)
|
|
322
333
|
|
|
334
|
+
if (
|
|
335
|
+
self.network == "finney"
|
|
336
|
+
or self.chain_endpoint == bittensor.__finney_entrypoint__
|
|
337
|
+
) and log_verbose:
|
|
338
|
+
bittensor.logging.info(
|
|
339
|
+
f"You are connecting to {self.network} network with endpoint {self.chain_endpoint}."
|
|
340
|
+
)
|
|
341
|
+
bittensor.logging.warning(
|
|
342
|
+
"We strongly encourage running a local subtensor node whenever possible. "
|
|
343
|
+
"This increases decentralization and resilience of the network."
|
|
344
|
+
)
|
|
345
|
+
bittensor.logging.warning(
|
|
346
|
+
"In a future release, local subtensor will become the default endpoint. "
|
|
347
|
+
"To get ahead of this change, please run a local subtensor node and point to it."
|
|
348
|
+
)
|
|
349
|
+
|
|
323
350
|
# Returns a mocked connection with a background chain connection.
|
|
324
351
|
self.config.subtensor._mock = (
|
|
325
352
|
_mock
|
|
@@ -330,12 +357,32 @@ class subtensor:
|
|
|
330
357
|
config.subtensor._mock = True
|
|
331
358
|
return bittensor.subtensor_mock.MockSubtensor()
|
|
332
359
|
|
|
333
|
-
#
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
360
|
+
# Attempt to connect to chosen endpoint. Fallback to finney if local unavailable.
|
|
361
|
+
try:
|
|
362
|
+
# Set up params.
|
|
363
|
+
self.substrate = SubstrateInterface(
|
|
364
|
+
ss58_format=bittensor.__ss58_format__,
|
|
365
|
+
use_remote_preset=True,
|
|
366
|
+
url=self.chain_endpoint,
|
|
367
|
+
type_registry=bittensor.__type_registry__,
|
|
368
|
+
)
|
|
369
|
+
except ConnectionRefusedError as e:
|
|
370
|
+
bittensor.logging.error(
|
|
371
|
+
f"Could not connect to {self.network} network with {self.chain_endpoint} chain endpoint. Exiting..."
|
|
372
|
+
)
|
|
373
|
+
bittensor.logging.info(
|
|
374
|
+
f"You can check if you have connectivity by runing this command: nc -vz localhost {self.chain_endpoint.split(':')[2]}"
|
|
375
|
+
)
|
|
376
|
+
exit(1)
|
|
377
|
+
# TODO (edu/phil): Advise to run local subtensor and point to dev docs.
|
|
378
|
+
|
|
379
|
+
try:
|
|
380
|
+
self.substrate.websocket.settimeout(600)
|
|
381
|
+
except:
|
|
382
|
+
bittensor.logging.warning("Could not set websocket timeout.")
|
|
383
|
+
|
|
384
|
+
bittensor.logging.info(
|
|
385
|
+
f"Connected to {self.network} network and {self.chain_endpoint}."
|
|
339
386
|
)
|
|
340
387
|
|
|
341
388
|
def __str__(self) -> str:
|
|
@@ -123,8 +123,8 @@ def strtobool(val: str) -> Union[bool, Literal["==SUPRESS=="]]:
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
def get_explorer_root_url_by_network_from_map(
|
|
126
|
-
network: str, network_map: Dict[str, str]
|
|
127
|
-
) -> Optional[str]:
|
|
126
|
+
network: str, network_map: Dict[str, Dict[str, str]]
|
|
127
|
+
) -> Optional[Dict[str, str]]:
|
|
128
128
|
r"""
|
|
129
129
|
Returns the explorer root url for the given network name from the given network map.
|
|
130
130
|
|
|
@@ -136,42 +136,48 @@ def get_explorer_root_url_by_network_from_map(
|
|
|
136
136
|
The explorer url for the given network.
|
|
137
137
|
Or None if the network is not in the network map.
|
|
138
138
|
"""
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
explorer_urls: Optional[Dict[str, str]] = {}
|
|
140
|
+
for entity_nm, entity_network_map in network_map.items():
|
|
141
|
+
if network in entity_network_map:
|
|
142
|
+
explorer_urls[entity_nm] = entity_network_map[network]
|
|
142
143
|
|
|
143
|
-
return
|
|
144
|
+
return explorer_urls
|
|
144
145
|
|
|
145
146
|
|
|
146
147
|
def get_explorer_url_for_network(
|
|
147
148
|
network: str, block_hash: str, network_map: Dict[str, str]
|
|
148
|
-
) -> Optional[str]:
|
|
149
|
+
) -> Optional[List[str]]:
|
|
149
150
|
r"""
|
|
150
151
|
Returns the explorer url for the given block hash and network.
|
|
151
152
|
|
|
152
153
|
Args:
|
|
153
154
|
network(str): The network to get the explorer url for.
|
|
154
155
|
block_hash(str): The block hash to get the explorer url for.
|
|
155
|
-
network_map(Dict[str, str]): The network
|
|
156
|
+
network_map(Dict[str, Dict[str, str]]): The network maps to get the explorer urls from.
|
|
156
157
|
|
|
157
158
|
Returns:
|
|
158
159
|
The explorer url for the given block hash and network.
|
|
159
160
|
Or None if the network is not known.
|
|
160
161
|
"""
|
|
161
162
|
|
|
162
|
-
|
|
163
|
+
explorer_urls: Optional[Dict[str, str]] = {}
|
|
163
164
|
# Will be None if the network is not known. i.e. not in network_map
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
)
|
|
165
|
+
explorer_root_urls: Optional[
|
|
166
|
+
Dict[str, str]
|
|
167
|
+
] = get_explorer_root_url_by_network_from_map(network, network_map)
|
|
167
168
|
|
|
168
|
-
if
|
|
169
|
+
if explorer_root_urls != {}:
|
|
169
170
|
# We are on a known network.
|
|
170
|
-
|
|
171
|
-
root_url=
|
|
171
|
+
explorer_opentensor_url = "{root_url}/query/{block_hash}".format(
|
|
172
|
+
root_url=explorer_root_urls.get("opentensor"), block_hash=block_hash
|
|
173
|
+
)
|
|
174
|
+
explorer_taostats_url = "{root_url}/search?query={block_hash}".format(
|
|
175
|
+
root_url=explorer_root_urls.get("taostats"), block_hash=block_hash
|
|
172
176
|
)
|
|
177
|
+
explorer_urls["opentensor"] = explorer_opentensor_url
|
|
178
|
+
explorer_urls["taostats"] = explorer_taostats_url
|
|
173
179
|
|
|
174
|
-
return
|
|
180
|
+
return explorer_urls
|
|
175
181
|
|
|
176
182
|
|
|
177
183
|
def ss58_address_to_bytes(ss58_address: str) -> bytes:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bittensor
|
|
3
|
-
Version: 6.4.
|
|
3
|
+
Version: 6.4.2
|
|
4
4
|
Summary: bittensor
|
|
5
5
|
Home-page: https://github.com/opentensor/bittensor
|
|
6
6
|
Author: bittensor.com
|
|
@@ -228,7 +228,7 @@ positional arguments:
|
|
|
228
228
|
lock_cost Return the lock cost to register a subnet.
|
|
229
229
|
create Create a new bittensor subnetwork on this chain.
|
|
230
230
|
register Register a wallet to a network.
|
|
231
|
-
|
|
231
|
+
pow_register Register a wallet to a network using PoW.
|
|
232
232
|
hyperparameters View subnet hyperparameters.
|
|
233
233
|
|
|
234
234
|
options:
|
|
@@ -309,28 +309,28 @@ Axon: Serves Synapse protocols with custom blacklist, priority and verify functi
|
|
|
309
309
|
```python
|
|
310
310
|
import bittensor
|
|
311
311
|
|
|
312
|
-
class
|
|
312
|
+
class MySynapse( bittensor.Synapse ):
|
|
313
313
|
input: int = 1
|
|
314
314
|
output: int = None
|
|
315
315
|
|
|
316
316
|
# Define a custom request forwarding function
|
|
317
|
-
def forward( synapse:
|
|
317
|
+
def forward( synapse: MySynapse ) -> MySynapse:
|
|
318
318
|
# Apply custom logic to synapse and return it
|
|
319
319
|
synapse.output = 2
|
|
320
320
|
return synapse
|
|
321
321
|
|
|
322
322
|
# Define a custom request verification function
|
|
323
|
-
def verify_my_synapse( synapse:
|
|
323
|
+
def verify_my_synapse( synapse: MySynapse ):
|
|
324
324
|
# Apply custom verification logic to synapse
|
|
325
325
|
# Optionally raise Exception
|
|
326
326
|
|
|
327
327
|
# Define a custom request blacklist function
|
|
328
|
-
def blacklist_my_synapse( synapse:
|
|
328
|
+
def blacklist_my_synapse( synapse: MySynapse ) -> bool:
|
|
329
329
|
# Apply custom blacklist
|
|
330
330
|
# return False ( if non blacklisted ) or True ( if blacklisted )
|
|
331
331
|
|
|
332
332
|
# Define a custom request priority function
|
|
333
|
-
def prioritize_my_synape( synapse:
|
|
333
|
+
def prioritize_my_synape( synapse: MySynapse ) -> float:
|
|
334
334
|
# Apply custom priority
|
|
335
335
|
return 1.0
|
|
336
336
|
|
|
@@ -348,6 +348,7 @@ my_axon.attach(
|
|
|
348
348
|
|
|
349
349
|
Dendrite: Inheriting from PyTorch's Module class, represents the abstracted implementation of a network client module designed
|
|
350
350
|
to send requests to those endpoints to receive inputs.
|
|
351
|
+
|
|
351
352
|
Example:
|
|
352
353
|
```python
|
|
353
354
|
dendrite_obj = dendrite( wallet = bittensor.wallet() )
|
|
@@ -367,7 +368,7 @@ Use the `root` subcommand to access setting weights on the network across subnet
|
|
|
367
368
|
```bash
|
|
368
369
|
btcli root weights --wallet.name <coldname> --wallet.hotkey <hotname>
|
|
369
370
|
Enter netuids (e.g. 0, 1, 2 ...):
|
|
370
|
-
# Here enter your selected netuids to
|
|
371
|
+
# Here enter your selected netuids to set weights on
|
|
371
372
|
1, 2
|
|
372
373
|
|
|
373
374
|
>Enter weights (e.g. 0.09, 0.09, 0.09 ...):
|
|
@@ -587,25 +587,10 @@ class TestSubtensor(unittest.TestCase):
|
|
|
587
587
|
msg="only tries to submit once, then exits",
|
|
588
588
|
)
|
|
589
589
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
return s.connect_ex((host, port)) == 0
|
|
595
|
-
|
|
596
|
-
def test_defaults_to_local(self):
|
|
597
|
-
port = int(
|
|
598
|
-
bittensor.__local_entrypoint__.split(":")[-1]
|
|
599
|
-
) # Default port for local subtensor
|
|
600
|
-
if self.is_port_open("127.0.0.1", port):
|
|
601
|
-
# If service is running, check default values
|
|
602
|
-
sub = bittensor.subtensor()
|
|
603
|
-
self.assertEqual(sub.network, "local")
|
|
604
|
-
self.assertEqual(sub.chain_endpoint, bittensor.__local_entrypoint__)
|
|
605
|
-
else:
|
|
606
|
-
# If service is not running, expect a ConnectionRefusedError
|
|
607
|
-
with self.assertRaises(ConnectionRefusedError):
|
|
608
|
-
bittensor.subtensor()
|
|
590
|
+
def test_defaults_to_finney(self):
|
|
591
|
+
sub = bittensor.subtensor()
|
|
592
|
+
assert sub.network == "finney"
|
|
593
|
+
assert sub.chain_endpoint == bittensor.__finney_entrypoint__
|
|
609
594
|
|
|
610
595
|
|
|
611
596
|
if __name__ == "__main__":
|
|
@@ -700,63 +700,71 @@ class TestCUDASolverRun(unittest.TestCase):
|
|
|
700
700
|
|
|
701
701
|
@ddt
|
|
702
702
|
class TestExplorerURL(unittest.TestCase):
|
|
703
|
-
network_map: Dict[str, str] = {
|
|
704
|
-
"nakamoto": "https://polkadot.js.org/apps/?rpc=wss://archivelb.nakamoto.opentensor.ai:9943#/explorer",
|
|
705
|
-
"example": "https://polkadot.js.org/apps/?rpc=wss://example.example.com#/explorer",
|
|
706
|
-
"nobunaga": "https://polkadot.js.org/apps/?rpc=wss://nobunaga.bittensor.com:9943#/explorer",
|
|
707
|
-
# "bad": None # no explorer for this network
|
|
708
|
-
}
|
|
709
|
-
|
|
710
703
|
@data(
|
|
711
704
|
(
|
|
712
|
-
"
|
|
713
|
-
|
|
705
|
+
"local",
|
|
706
|
+
{
|
|
707
|
+
"opentensor": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
|
|
708
|
+
"taostats": "https://x.taostats.io",
|
|
709
|
+
},
|
|
714
710
|
),
|
|
715
711
|
(
|
|
716
|
-
"
|
|
717
|
-
|
|
712
|
+
"endpoint",
|
|
713
|
+
{
|
|
714
|
+
"opentensor": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
|
|
715
|
+
"taostats": "https://x.taostats.io",
|
|
716
|
+
},
|
|
718
717
|
),
|
|
719
718
|
(
|
|
720
|
-
"
|
|
721
|
-
|
|
719
|
+
"finney",
|
|
720
|
+
{
|
|
721
|
+
"opentensor": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer",
|
|
722
|
+
"taostats": "https://x.taostats.io",
|
|
723
|
+
},
|
|
722
724
|
),
|
|
723
|
-
("bad",
|
|
724
|
-
("",
|
|
725
|
-
("
|
|
725
|
+
("bad", {}),
|
|
726
|
+
("", {}),
|
|
727
|
+
("unknown", {}),
|
|
726
728
|
)
|
|
727
729
|
@unpack
|
|
728
730
|
def test_get_explorer_root_url_by_network_from_map(
|
|
729
|
-
self, network: str, expected:
|
|
730
|
-
) ->
|
|
731
|
+
self, network: str, expected: dict
|
|
732
|
+
) -> None:
|
|
731
733
|
self.assertEqual(
|
|
732
734
|
bittensor.utils.get_explorer_root_url_by_network_from_map(
|
|
733
|
-
network,
|
|
735
|
+
network, bittensor.__network_explorer_map__
|
|
734
736
|
),
|
|
735
737
|
expected,
|
|
736
738
|
)
|
|
737
739
|
|
|
738
740
|
@data(
|
|
739
741
|
(
|
|
740
|
-
"
|
|
742
|
+
"local",
|
|
741
743
|
"0x123",
|
|
742
|
-
|
|
744
|
+
{
|
|
745
|
+
"opentensor": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer/query/0x123",
|
|
746
|
+
"taostats": "https://x.taostats.io/search?query=0x123",
|
|
747
|
+
},
|
|
743
748
|
),
|
|
744
749
|
(
|
|
745
|
-
"
|
|
746
|
-
"
|
|
747
|
-
|
|
750
|
+
"endpoint",
|
|
751
|
+
"0x456",
|
|
752
|
+
{
|
|
753
|
+
"opentensor": "https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fentrypoint-finney.opentensor.ai%3A443#/explorer/query/0x456",
|
|
754
|
+
"taostats": "https://x.taostats.io/search?query=0x456",
|
|
755
|
+
},
|
|
748
756
|
),
|
|
749
|
-
("bad", "
|
|
750
|
-
("", "
|
|
751
|
-
("
|
|
757
|
+
("bad", "0x789", {}),
|
|
758
|
+
("", "0xabc", {}),
|
|
759
|
+
("unknown", "0xdef", {}),
|
|
752
760
|
)
|
|
753
761
|
@unpack
|
|
754
762
|
def test_get_explorer_url_for_network_by_network_and_block_hash(
|
|
755
|
-
self, network: str, block_hash: str, expected:
|
|
756
|
-
) ->
|
|
763
|
+
self, network: str, block_hash: str, expected: dict
|
|
764
|
+
) -> None:
|
|
757
765
|
self.assertEqual(
|
|
758
766
|
bittensor.utils.get_explorer_url_for_network(
|
|
759
|
-
network, block_hash,
|
|
767
|
+
network, block_hash, bittensor.__network_explorer_map__
|
|
760
768
|
),
|
|
761
769
|
expected,
|
|
762
770
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|