Skip to main content

Environment Variables

SUBMIT A PRSUBMIT AN ISSUElast edit: Dec 10, 2025

This page documents the environment variables that provide configuration options to the Bittensor SDK.

General​

BT_SUBTENSOR_CHAIN_ENDPOINT​

The Subtensor chain endpoint address used when launching a local network (LocalNet).

info

This variable will be renamed or deprecated in Bittensor SDK version 10.

NEST_ASYNCIO​

If the variable is set to 1, the nest_asyncio patch is applied to support nested asyncio event loops.

READ_ONLY​

If set to 1, Bittensor is run in in read-only mode, and write-required operations are disabled (e.g., btlogging and bittensor-wallet).

Allows Bittensor to be run in read-only systems.

USE_TORCH​

When set to 1, forces the use of PyTorch instead of NumPy for certain operations.
The SDK uses False if the variable is not set.

Subtensor​

BT_SUBTENSOR_CHAIN_ENDPOINT​

The Subtensor node (RPC endpoint) URL to connect to Bittensor (overrides the default chain address).

The SDK uses bittensor.core.settings.DEFAULT_ENDPOINT if the variable is not set.

See Bittensor Networks

BT_SUBTENSOR_NETWORK​

The default Subtensor network name. Allows selecting the network (e.g., finney or testnet) during Subtensor initialization without specifying an explicit endpoint.
The SDK uses bittensor.core.settings.DEFAULT_NETWORK if the variable is not set.

Axon​

BT_AXON_PORT​

The port on which the local Axon server will listen for incoming connections. The SDK uses 8091 if the variable is not set.

BT_AXON_IP​

The local IP address (interface) used to start Axon. The SDK uses "[::]" if the variable is not set.

BT_AXON_EXTERNAL_PORT​

The external port of Axon advertised to other network peers. The SDK uses None if the variable is not set.

BT_AXON_EXTERNAL_IP​

The external IP address that Axon will share with other network participants. The SDK uses None if the variable is not set.

BT_AXON_MAX_WORKERS​

The maximum number of worker threads for the Axon server. The SDK uses 10 if the variable is not set.

Logging​

BT_LOGGING_DEBUG​

When set to true or 1, enables DEBUG level message output.

BT_LOGGING_TRACE​

When set to true or 1, enables the most verbose TRACE logging level.

BT_LOGGING_INFO​

When set to true or 1, enables INFO level message output.

BT_LOGGING_RECORD_LOG​

When set to true or 1, enables log file recording.
The SDK uses False if the variable is not set.

BT_LOGGING_LOGGING_DIR​

Specifies the directory path for storing log files. The SDK uses bittensor.core.settings.MINERS_DIR if the variable is not set.

BT_LOGGING_ENABLE_THIRD_PARTY_LOGGERS​

When set to true or 1, enables third-party loggers.
The SDK logger always acts as the primary logger. Whether enabled or not, messages from third-party loggers are still filtered according to the SDK’s configured logging level.

PriorityThreadPoolExecutor​

BT_PRIORITY_MAX_WORKERS​

Maximum number of worker threads for the PriorityThreadPoolExecutor. The SDK uses 5 if the variable is not set.

BT_PRIORITY_MAXSIZE​

Maximum task queue size for the PriorityThreadPoolExecutor. The SDK uses 10 if the variable is not set.

Wallet​

BT_WALLET_NAME​

Wallet name to use unless specified. The SDK uses default if the variable is not set,

BT_WALLET_HOTKEY​

Hotkey name to use unless specified. The SDK uses default if the variable is not set,

BT_WALLET_PATH​

The SDK uses bittensor.core.settings.WALLETS_DIR if the variable is not set.

MEV Protection​

BT_MEV_PROTECTION​

When set to 1, true, yes, or on (case-insensitive), enables MEV Shield protection by default for all supported extrinsics. When enabled, transactions are automatically encrypted and submitted through the MEV Shield pallet to protect against front-running and MEV attacks.

This sets the DEFAULT_MEV_PROTECTION constant used throughout the SDK, so you don't need to pass mev_protection=True to every extrinsic call.

The SDK uses False if the variable is not set.

See MEV Shield Protection for details on using MEV protection.

Testing​

FAST_BLOCKS​

The SDK runs e2e tests in fast-block mode if the variable is not set.

USE_DOCKER​

If set to 1 or true, uses the Docker-based LocalNet image for launching e2e tests.
The SDK uses False if the variable is not set.

LOCALNET_SH_PATH​

Full path to the scripts/localnet.sh file in the cloned Subtensor repository used to launch the local chain (including for e2e tests if the Docker image is not used).

SDK skips running e2e tests if the variable is not set (used only together with the USE_DOCKER variable).

SKIP_PULL​

Controls whether the Docker image used for end-to-end tests should be pulled from a remote container registry (e.g. GitHub Container Registry) before the test run. This is useful in CI pipelines where a custom image is built and should not be overwritten by a remote version.

  • When SKIP_PULL=0 (default), the test framework runs docker pull to ensure the latest version of the image is used.
  • When SKIP_PULL=1, the pull step is skipped. The tests will only run if the required Docker image is already available locally.