Skip to main content
SUBMIT A PRSUBMIT AN ISSUElast edit: Apr 26, 2024

Create Wallet

This section describes steps to create a Bittensor wallet, regenerate keys and encrypt keys. If you are new to Bittensor wallets, see Working with Keys for an explanation of Bittensor wallet keys.

Ways of creating wallet

You can create a Bittensor wallet either for basic uses like securely storing your TAO and receiving and sending them, or for advanced uses like creating a subnet and participating as a subnet miner or a subnet validator:

  • For basic use: Create an external wallet account by using the Chrome Extension for Bittensor Wallet. An external wallet account created in this way will allow you to use TAO without installing Bittensor. If your activities are limited to sending or receiving TAO then this is a recommended option.
  • For subnet participation: Create a local wallet account using btcli command line tool on your computer. This requires that you install Bittensor on your machine. If you are interested in either creating a subnet or participating as a subnet miner or a subnet validator, then you must use this option.

Creating a basic wallet

Suitable for non-technical users

Use this option if your activities are limited to sending and receiving TAO and you are not creating a subnet or participating as a subnet validator or a subnet miner.

To create a basic wallet account use the Chrome Extension for Bittensor Wallet. Follow the below steps:

  1. The Wallet will first create a wallet account address in the form of a 48-hexadecimal character string that usually starts with 5.
  2. Critically, the Wallet will show you a 12-word list arranged in a specific order. You are required to keep this list of words, without changing the word order, in a safe location. This list of ordered words is called by various names such as mnemonic or seed phrase.
  3. The Wallet will then prompt you for specific mnemonic words as a way of authentication.
  4. Next, you will assign a name and a password to your wallet account.
  5. Finally, to receive TAO from another party, you will give them your wallet account address from Step 1 (the 48-hexadecimal character string) as the destination address. Similarly, to send (transfer) TAO to another party, you will first ask them for their wallet address and send TAO to their wallet address. You can create multiple wallet accounts, each with a different name, and even a different password for each wallet account, this way.

Mnemonic

Always keep your mnemonic safe

Anyone who knows the mnemonic for your wallet account can access your TAO tokens. Hence you must always keep this mnemonic in a safe and secure place, known only to you. More important, if you lose your wallet address, you can use its mnemonic (that you stored away in safekeeping) to restore the wallet.

Use Import option in Chrome Wallet Extension

To restore your lost coldkey, use the Import option in Chrome Extension for Bittensor Wallet and provide your 12-word mnemonic.

Creating a local wallet with CLI

Suitable for subnet participation

Use this option if you are creating a subnet or participating as a subnet validator or a subnet miner. You must install Bittensor for this option.

After you have installed Bittensor, you can create a local wallet on your machine in the following two ways:

  • Using btcli.
  • Using Python.

Coldkey and hotkey

A Bittensor wallet consists of a coldkey and a hotkey. Only coldkey is created when you use the Chrome Extension for Bittensor Wallet. This is sufficient for normal storage and sending and receiving of TAO. But to participate in a subnet, you will not only need a local coldkey but also a local hotkey.

Explanation of keys

See Working with Keys for an explanation of coldkey and hotkey.

Creating a coldkey using btcli

If you plan to perform any of the following tasks, you only need to create a coldkey:

  • Create a subnet.
  • Transfer TAO.
  • Delegate to a validator-delegate's hotkey.

However, if you want to validate or mine in a subnet, you will need to create hotkey also. See the below section Creating a hotkey using btcli.

Run the following command on your terminal by giving a name to your wallet, replacing the my_coldkey.

btcli wallet new_coldkey --wallet.name <my_coldkey>

For example,

btcli wallet new_coldkey --wallet.name test-coldkey

You will see the following terminal output. The mnemonic is hidden for security reasons.

IMPORTANT: Store this mnemonic in a secure (preferably offline place), as anyone who has possesion of this mnemonic can use it to regenerate the key and access your tokens.
The mnemonic to the new coldkey is:
**** *** **** **** ***** **** *** **** **** **** ***** *****
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 **** *** **** **** ***** **** *** **** **** **** ***** *****
Regenerating the coldkey

Make a note of the above command option regen_coldkey showing how to regenerate your coldkey in case you lose it.

Creating a hotkey using btcli

If you plan to validate or mine in a subnet, then you must create both a coldkey and a hotkey.

First create a coldkey as described above in the Creating a coldkey using btcli. Then provide this coldkey as a parameter to generate a hotkey. This will pair the hotkey with the coldkey. See below.

Use the below command to generate the hotkey. Replace <my_coldkey> with the coldkey generated above, and <my_first_hotkey> with a name for your hotkey.

btcli wallet new_hotkey --wallet.name <my_coldkey> --wallet.hotkey <my_first_hotkey>

For example,

btcli wallet new_hotkey --wallet.name test-coldkey --wallet.hotkey my_first_hotkey

You will see the terminal log like below. The mnemonic is hidden for security reasons.

IMPORTANT: Store this mnemonic in a secure (preferably offline place), as anyone who has possesion of this mnemonic can use it to regenerate the key and access your tokens.
The mnemonic to the new hotkey is:
**** *** **** **** ***** **** *** **** **** **** ***** *****
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 **** *** **** **** ***** **** *** **** **** **** ***** *****
Regenerating the hotkey

Make a note of the above command option regen_hotkey showing how to regenerate your hotkey in case you lose it.

Encrypting the hotkey

By default, the hotkey is not encrypted on the device whereas the coldkey is encrypted. To encrypt your hotkey, run this command:

btcli wallet new_hotkey --use_password

Creating a wallet using Python

Copy and paste the following three lines into your Python interpreter. Replace the string values for name (my_coldkey) and hotkey (my_first_hotkey) with your own.

import bittensor as bt
wallet = bt.wallet(name = 'my_coldkey', hotkey = 'my_first_hotkey' )
wallet.create_if_non_existent()

You will see a terminal output like this for an example wallet with name as tst1_coldkey and hotkey as tst1_hotkey. The mnemonic is hidden for security reasons.

>>> import bittensor as bt
>>> wallet = bt.wallet(name = 'tst1_coldkey', hotkey = 'tst1_hotkey')
>>> wallet.create_if_non_existent()

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:

**** **** **** **** **** **** **** **** **** **** **** ****

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 **** **** **** **** **** **** **** **** **** **** **** ****

Specify password for key encryption:
Password not strong enough. Try increasing the length of the password or the password complexity
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:

**** **** **** **** **** **** **** **** **** **** **** ****

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 **** **** **** **** **** **** **** **** **** **** **** ****

wallet(tst1_coldkey, tst1_hotkey, ~/.bittensor/wallets/)
>>>

Location and addresses of the local wallets

Local wallets are stored on your machine under ~/.bittensor/wallets. Use the below command to list them:

tree ~/.bittensor/

You will see an output like this:

tree ~/.bittensor/
/Users/docwriter/.bittensor/ # The Bittensor root directory.
└── wallets # The folder containing all Bittensor wallets.
└── tst1_coldkey # The name of the wallet.
   ├── coldkey # The password-encrypted coldkey.
   ├── coldkeypub.txt # The unencrypted version of the coldkey.
   └── hotkeys # The folder containing all this coldkey's hotkeys.
   └── tst1_hotkey # The unencrypted hotkey information.

and listing out the contents of the coldkeypub.txt file:

cd ~/.bittensor/wallets/tst1_coldkey
cat coldkeypub.txt | jq
{
"accountId": "0x36e49805b105af2b5572cfc86426247df111df2f584767ca739d9fa085246c51",
"publicKey": "0x36e49805b105af2b5572cfc86426247df111df2f584767ca739d9fa085246c51",
"secretPhrase": null,
"secretSeed": null,
"ss58Address": "5DJgMDvzC27QTBfmgGQaNWBQd8CKP9z5A12yjbG6TZ5bxNE1"
}

The contents of the coldkeypub.txt are to be interpreted as below:

  • The fields accountId and publicKey contain the same value.
  • The secretPhrase and secretSeed are not included in the file due to the high-security nature of the coldkey. When you create your wallet, either using Chrome extension or btcli, the mnemonic (secretPhrase) is shown only once while secretSeed is not shown.
  • The ss58Address is the SS58-version of the accountId or publicKey. Send this as your coldkey public wallet address for receiving TAO from another party.
Conversion between publicKey and ss58Address

Use this site SS58.org to verify the conversions between publicKey and ss58Address fields.

Similarly, listing out the contents of the hotkeys/tst_hotkey file:

cat hotkeys/tst1_hotkey | jq
{
"accountId": "0xc66695556006c79e278f487b01d44cf4bc611f195615a321bf3208f5e351621e",
"publicKey": "0xc66695556006c79e278f487b01d44cf4bc611f195615a321bf3208f5e351621e",
"secretPhrase": "pyramid xxx wide slush xxx hub xxx crew spin xxx easily xxx",
"secretSeed": "0x6c359cc52ff1256c9e5 * * * 5536c * * * 892e9ffe4e4066ad2a6e35561d6964e",
"ss58Address": "5GYqp3eKu6W7KxhCNrHrVaPjsJHHLuAs5jbYWfeNzVudH8DE"
}

The contents of the hotkeys/tst1_hotkey file are to be interpreted as below:

  • The fields accountId and publicKey contain the same value, just as seen in coldkeypub.txt.
  • The secretPhrase and secretSeed are shown because the hotkey is by default not encrypted.
  • The ss58Address is the SS58-version of the accountId or publicKey. Send this as your hotkey public wallet address for receiving TAO from another party.

Listing all the local wallets

You can list all the local wallets stored in Bittensor's root directly with:

btcli wallet list

You will see a terminal output like this:

Wallets
└─
tst1_coldkey (5DJgMDvzC27QTBfmgGQaNWBQd8CKP9z5A12yjbG6TZ5bxNE1)
└── tst1_hotkey (5GYqp3eKu6W7KxhCNrHrVaPjsJHHLuAs5jbYWfeNzVudH8DE)

The output will show only the ss58Address field values from the coldkeypub.txt and tst1_hotkey files of the wallets.

Use the ss58Address keys as destinations for TAO

Use the above shown ss58Address field values as your public wallet addresses, i.e., as destinations for TAO transfers from another wallet to your wallet. For example, when using a command: btcli wallet transfer.

Store your mnemonics safely

If someone has your mnemonic, they own your TAO

If you lose the password to your wallet, or if you have lost the access to the machine where the wallet is stored, you can regenerate the coldkey using the mnemonic you saved during wallet creation steps above. You can not retrieve the wallet with the password alone. Remember that if someone has your mnemonic, they own your TAO.

As a reminder, if you need to regenerate your wallets, you can use the btcli with your mnemonic, as shown below:

btcli wallet regen_coldkey --mnemonic **** *** **** **** ***** **** *** **** **** **** ***** *****

Updating legacy wallet

It is important that you update any legacy Bittensor wallets to the new NaCL format for security. You may accomplish this with the btcli using the wallet update subcommands.

See the below example command and the terminal output:

btcli wallet update
>> Do you want to update all legacy wallets? [y/n]: n
>> ===== wallet(tst1_coldkey, default, ~/.bittensor/wallets/) =====
>> ✅ Keyfile is updated.
>> 🔑 Keyfile (NaCl encrypted, ~/.bittensor/wallets/tst1_coldkey/coldkey)>