Skip to main content

No project description provided

Project description

Bittensor Wallet SDK

Discord Chat License: MIT PyPI version


Internet-scale Neural Networks

Bittensor SDKBTCLIResearch

Bittensor Wallet SDK

The Bittensor Wallet SDK is a Python interface for a powerful Rust-based Bittensor wallet functionality. You do not need to know Rust to use this Wallet SDK. However, if you want to contribute to the Rust components of this Wallet SDK, the Rust source is located in the src directory.

Documentation

For a full documentation on how to use btwallet, see the Bittensor Wallet SDK section on the developer documentation site.


Before you proceed

  1. If you installed either Bittensor SDK version 8.1.0 or BTCLI version 8.1.0 then the Wallet SDK 2.0.0 is already installed. The below installation steps are only for a standalone installation of the Wallet SDK 2.0.0 package.
  2. IMPORTANT: The Wallet SDK 2.0.0 is compatible only with Bittensor SDK version 8.1.0 and later versions and BTCLI version 8.1.0 and later versions. Earlier versions of Bittensor SDK and BTCLI are not compatible with Wallet SDK 2.0.0.

Install

Follow the below steps to install the Bittensor Wallet SDK:

From PyPI

Use this option if you want to use the Wallet SDK.

$ python3 -m venv btwallet-venv  # create a virtual env
$ source btwallet-venv/bin/activate  # activate the env
$ pip install bittensor-wallet  # install bittensor-wallet

From source

Use this option if you want to develop your application using the Wallet SDK.

python3 -m venv btwallet-venv  # create a virtual env
source venv/bin/activate  # activate the env
git clone https://github.com/opentensor/btwallet.git
cd btwallet
pip install maturin
maturin develop

After the maturin develop command completes, run the below command:

pip list

You will see bittensor-wallet in the list on installed packages. This means the installation was successful.


Verify your installation

In the python3 interpreter, run the below code to verify that your installation was successful. See an example output below:

python3
Python 3.12.4 (v3.12.4:8e8a4baf65, Jun  6 2024, 17:33:18) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bittensor_wallet
>>> print(bittensor_wallet.__version__)
2.0.0
>>>

The above will print the Wallet SDK version you just installed, i.e., 2.0.0, confirming that the installation was successful.


Usage examples

1. Create a wallet

In the python3 interpreter, run the below code:

from bittensor_wallet import Wallet

# creates wallet with name `default`
wallet = Wallet()
wallet.create()

If a wallet with the name "default" already exists, then you will see a message. If it doesn't exist, then the above code will create both a coldkey and a hotkey and displays the following information, including your mnemonic (mnemonics are replaced with x in the below example for security):

IMPORTANT: Store this mnemonic in a secure (preferable offline place), as anyone who has possession of this mnemonic can use it to regenerate the key and access your tokens.

The mnemonic to the new coldkey is:

forward xxxx xxx xxx xxxx xxxx xxxx xxx xx xx xx actress

You can use the mnemonic to recreate the key in case it gets lost. The command to use to regenerate the key using this mnemonic is:
btcli w regen-coldkey --mnemonic "forward xxxx xxx xxx xxxx xxxx xxxx xxx xx xx xx actress"

Specify password for key encryption:
Retype your password:

IMPORTANT: Store this mnemonic in a secure (preferable offline place), as anyone who has possession of this mnemonic can use it to regenerate the key and access your tokens.

The mnemonic to the new hotkey is:

fuel xxxx xxx xxx xxxx xxxx xxxx xxx xx xx xxx bind

You can use the mnemonic to recreate the key in case it gets lost. The command to use to regenerate the key using this mnemonic is:
btcli w regen-hotkey --mnemonic "fuel xxxx xxx xxx xxxx xxxx xxxx xxx xx xx xxx bind"

name: 'default', hotkey: 'default', path: '~/.bittensor/wallets/'
>>> print(wallet)
Wallet (Name: 'default', Hotkey: 'default', Path: '~/.bittensor/wallets/')
>>>

2. Pass arguments to a class other than the default

name (str): The name of the wallet, used to identify it among possibly multiple wallets.
hotkey (str): String identifier for the hotkey.
path (str): File system path where wallet keys are stored.
config (Config): Bittensor configuration object.

In the python3 interpreter, run the below code. See an example below (only partial is shown):

python3
Python 3.12.4 (v3.12.4:8e8a4baf65, Jun  6 2024, 17:33:18) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from bittensor_wallet import Wallet
>>> my_name = "my_wallet_name"
>>> my_path = "path_to_my_wallet"
>>> my_hotkey = "name_of_my_hotkey"
>>>
>>> my_wallet = Wallet(name=my_name, path=my_path, hotkey=my_hotkey)
>>> my_wallet.create()

IMPORTANT: Store this mnemonic in a secure (preferable offline place), as anyone who has possession of this mnemonic can use it to regenerate the key and access your tokens.

The above will create a wallet with "my_wallet_name".

3. Use your own config

from bittensor_wallet.config import Config
config = Config()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bittensor_wallet-2.0.0a5.tar.gz (62.8 kB view hashes)

Uploaded Source

Built Distributions

bittensor_wallet-2.0.0a5-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl (2.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.5+ i686

bittensor_wallet-2.0.0a5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

bittensor_wallet-2.0.0a5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl (2.9 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.5+ i686

bittensor_wallet-2.0.0a5-cp312-cp312-macosx_11_0_arm64.whl (735.5 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

bittensor_wallet-2.0.0a5-cp312-cp312-macosx_10_12_x86_64.whl (776.1 kB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

bittensor_wallet-2.0.0a5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

bittensor_wallet-2.0.0a5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl (2.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.5+ i686

bittensor_wallet-2.0.0a5-cp311-cp311-macosx_11_0_arm64.whl (736.0 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

bittensor_wallet-2.0.0a5-cp311-cp311-macosx_10_12_x86_64.whl (778.1 kB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

bittensor_wallet-2.0.0a5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

bittensor_wallet-2.0.0a5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl (2.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.5+ i686

bittensor_wallet-2.0.0a5-cp310-cp310-macosx_11_0_arm64.whl (735.8 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

bittensor_wallet-2.0.0a5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

bittensor_wallet-2.0.0a5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl (2.9 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.5+ i686

bittensor_wallet-2.0.0a5-cp39-cp39-macosx_11_0_arm64.whl (736.7 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page