|
| 1 | +--- |
| 2 | +title: "BTCLI Live Coding Playground" |
| 3 | +--- |
| 4 | +< link rel= "stylesheet" href= "https://unpkg.com/@antonz/[email protected]/dist/snippet.css" /> |
| 5 | + |
| 6 | +This page gives the user a chance to try out some BTCLI functionality right in the browser. |
| 7 | + |
| 8 | +The BTCLI Live Coding Playground is an ephemeral environment run in a container, meaning nothing stays in between requests, so you'll have to load in you wallet each time. For this reason, you must only use test wallets in the playground. Any coldkey used in the playground should be considered compromised. |
| 9 | + |
| 10 | +The BTCLI Live Coding Playground is also experimental and a bit flakey, so if you see error responses, try again, but if they persist, the service may be down. |
| 11 | + |
| 12 | +For a more satisfying experience, [install btcli locally](../getting-started/install-btcli) and try [managing stake with BTCLI](../staking-and-delegation/managing-stake-btcli) |
| 13 | + |
| 14 | +:::danger |
| 15 | +This is not a secure code execution environment. This page is for practice/education/entertainment purposes only. |
| 16 | + |
| 17 | +**Do not enter the seed phrase for a wallet with *real (main "finney" network)* TAO into this or any insecure applicaiton!** |
| 18 | + |
| 19 | +See: |
| 20 | +- [Handle your Seed Phrase/Mnemonic Securely](../keys/handle-seed-phrase) |
| 21 | +- [Coldkey and Hotkey Workstation Security](../getting-started/coldkey-hotkey-security) |
| 22 | +::: |
| 23 | + |
| 24 | +## Import wallets and check balances. |
| 25 | + |
| 26 | +I've created two wallets for this tutorial and put some testnet TAO into them. Run the code below to import them into bittensor-codex(the code execution service), and list them to see their public keys. |
| 27 | + |
| 28 | +### Import both wallets and list their keys |
| 29 | + |
| 30 | +:::tip run it! |
| 31 | +<codapi-settings url="https://bittensor-codex.com/v1"> |
| 32 | +</codapi-settings> |
| 33 | + |
| 34 | +```shell |
| 35 | +btcli wallet regen-coldkey \ |
| 36 | +--mnemonic "add aerobic there stool organ switch about diagram arctic vague replace seminar" \ |
| 37 | +--wallet.name 'playground-test1' \ |
| 38 | +--no-use-password --wallet.path ~/.bittensor/wallets |
| 39 | + |
| 40 | +btcli wallet regen-coldkey \ |
| 41 | +--mnemonic "nominee sort fringe gauge tank sure core memory abandon lamp alter flash" \ |
| 42 | +--wallet.name 'playground-test2' \ |
| 43 | +--no-use-password --wallet.path ~/.bittensor/wallets |
| 44 | + |
| 45 | +btcli wallet list --wallet.path ~/.bittensor/wallets |
| 46 | + |
| 47 | +``` |
| 48 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 49 | +</codapi-snippet> |
| 50 | +::: |
| 51 | + |
| 52 | +### Check balance for `playground-test1` |
| 53 | + |
| 54 | +:::tip run it! |
| 55 | +<codapi-settings url="https://bittensor-codex.com/v1"> |
| 56 | +</codapi-settings> |
| 57 | + |
| 58 | +```shell |
| 59 | +btcli wallet regen-coldkey \ |
| 60 | +--mnemonic "add aerobic there stool organ switch about diagram arctic vague replace seminar" \ |
| 61 | +--wallet.name 'playground-test1' \ |
| 62 | +--no-use-password --wallet.path ~/.bittensor/wallets |
| 63 | + |
| 64 | +btcli wallet balance \ |
| 65 | +--wallet.name 'playground-test1' \ |
| 66 | +--wallet.path ~/.bittensor/wallets \ |
| 67 | +--network test |
| 68 | +``` |
| 69 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 70 | +</codapi-snippet> |
| 71 | +::: |
| 72 | + |
| 73 | +### Check balance for `playground-test2` |
| 74 | + |
| 75 | +:::tip run it! |
| 76 | +<codapi-settings url="https://bittensor-codex.com/v1"> |
| 77 | +</codapi-settings> |
| 78 | + |
| 79 | +```shell |
| 80 | + |
| 81 | +btcli wallet regen-coldkey \ |
| 82 | +--mnemonic "nominee sort fringe gauge tank sure core memory abandon lamp alter flash" \ |
| 83 | +--wallet.name 'playground-test2' \ |
| 84 | +--no-use-password --wallet.path ~/.bittensor/wallets |
| 85 | + |
| 86 | +btcli wallet balance \ |
| 87 | +--wallet.name 'playground-test2' \ |
| 88 | +--wallet.path ~/.bittensor/wallets \ |
| 89 | +--network test |
| 90 | +``` |
| 91 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 92 | +</codapi-snippet> |
| 93 | +::: |
| 94 | + |
| 95 | + |
| 96 | +## Transfer |
| 97 | + |
| 98 | +Transfer some Tao from playground-test1 to playground-test2. We can get the `--destination` address from the `wallet list` command above. |
| 99 | + |
| 100 | +Note: Just because the transaction fails to display in the browser below does not mean it failed on-chain. Check playground-test2's balance using the above command. |
| 101 | + |
| 102 | +:::tip run it! |
| 103 | + |
| 104 | +<codapi-settings url="https://bittensor-codex.com/v1"> |
| 105 | +</codapi-settings> |
| 106 | + |
| 107 | +```shell |
| 108 | +btcli wallet regen-coldkey \ |
| 109 | +--mnemonic "add aerobic there stool organ switch about diagram arctic vague replace seminar" \ |
| 110 | +--wallet.name 'playground-test1' \ |
| 111 | +--no-use-password --wallet.path ~/.bittensor/wallets |
| 112 | + |
| 113 | +btcli wallet transfer \ |
| 114 | +--amount 0.1 \ |
| 115 | +--wallet.name 'playground-test1' \ |
| 116 | +--network test \ |
| 117 | +--destination "5ESAWH9HDB9PZvs1q5j3aWF3x1wo88kwaqNcJEabGKsHMvX6" \ |
| 118 | +--no-prompt \ |
| 119 | +--wallet.path ~/.bittensor/wallets |
| 120 | +``` |
| 121 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 122 | +</codapi-snippet> |
| 123 | + |
| 124 | + :::info Challenges |
| 125 | + 1. Check your balance to make sure the transfer executed successfully on chain. |
| 126 | + 2. Switch the values to transfer TAO back from `playground-test2` to `playground-test1`. |
| 127 | + 3. Transfer some testnet TAO to a wallet you manage on another device. Just please don't take all of it. |
| 128 | + 4. If you have some extra testnet TAO, transfer some to the playground-test wallets to refill them. |
| 129 | + |
| 130 | + *Note: Testnet TAO has no monetary value.* |
| 131 | + |
| 132 | +::: |
| 133 | + |
| 134 | + |
| 135 | +## Subnets |
| 136 | +### Subnet list |
| 137 | + |
| 138 | +:::tip run it! |
| 139 | +<codapi-settings url="https://bittensor-codex.com/v1"> |
| 140 | +</codapi-settings> |
| 141 | +```shell |
| 142 | + |
| 143 | +btcli subnet list |
| 144 | +``` |
| 145 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 146 | +</codapi-snippet> |
| 147 | +::: |
| 148 | + |
| 149 | + |
| 150 | +### Subnet show |
| 151 | +:::tip run it! |
| 152 | +<codapi-settings url="https://bittensor-codex.com/v1"> |
| 153 | +</codapi-settings> |
| 154 | +```shell |
| 155 | +btcli subnet show --netuid 3 |
| 156 | +``` |
| 157 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 158 | +</codapi-snippet> |
| 159 | +::: |
| 160 | + |
| 161 | +## List a wallet's stakes |
| 162 | + |
| 163 | +See [Staking/Delegation Overview](../staking-and-delegation/delegation). |
| 164 | + |
| 165 | +:::tip run it! |
| 166 | +<codapi-settings url="https://bittensor-codex.com/v1"> |
| 167 | +</codapi-settings> |
| 168 | + |
| 169 | +```shell |
| 170 | +btcli wallet regen-coldkey \ |
| 171 | +--mnemonic "add aerobic there stool organ switch about diagram arctic vague replace seminar" \ |
| 172 | +--wallet.name 'playground-test1' \ |
| 173 | +--no-use-password --wallet.path ~/.bittensor/wallets |
| 174 | + |
| 175 | +btcli stake list --network test --wallet.name playground-test1 --wallet-path ~/.bittensor/wallets --no-prompt |
| 176 | + |
| 177 | +``` |
| 178 | +<codapi-snippet sandbox="python" editor="basic" init-delay="500"> |
| 179 | +</codapi-snippet> |
| 180 | + |
| 181 | + :::info Challenge |
| 182 | + Try staking and unstaking from the playground-test wallets! |
| 183 | +::: |
0 commit comments