Skip to content

docs: testnet tao via btcli #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions docs/btcli/btcli-playground.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "BTCLI Live Coding Playground"
---

<link rel="stylesheet" href="https://unpkg.com/@antonz/[email protected]/dist/snippet.css" />

This page gives the user a chance to try out some BTCLI functionality right in the browser.
Expand All @@ -14,12 +15,13 @@ For a more satisfying experience, [install btcli locally](../getting-started/ins
:::danger
This is not a secure code execution environment. This page is for practice/education/entertainment purposes only.

**Do not enter the seed phrase for a wallet with *real (main "finney" network)* TAO into this or any insecure applicaiton!**
**Do not enter the seed phrase for a wallet with _real (main "finney" network)_ TAO into this or any insecure applicaiton!**

See:

- [Handle your Seed Phrase/Mnemonic Securely](../keys/handle-seed-phrase)
- [Coldkey and Hotkey Workstation Security](../getting-started/coldkey-hotkey-security)
:::
:::

## Import wallets and check balances.

Expand All @@ -45,6 +47,7 @@ btcli wallet regen-coldkey \
btcli wallet list --wallet.path ~/.bittensor/wallets

```

<codapi-snippet sandbox="python" editor="basic" init-delay="500">
</codapi-snippet>
:::
Expand All @@ -66,6 +69,7 @@ btcli wallet balance \
--wallet.path ~/.bittensor/wallets \
--network test
```

<codapi-snippet sandbox="python" editor="basic" init-delay="500">
</codapi-snippet>
:::
Expand All @@ -88,16 +92,20 @@ btcli wallet balance \
--wallet.path ~/.bittensor/wallets \
--network test
```

<codapi-snippet sandbox="python" editor="basic" init-delay="500">
</codapi-snippet>
:::


## Transfer

Transfer some Tao from playground-test1 to playground-test2. We can get the `--destination` address from the `wallet list` command above.
Transfer some Tao from `playground-test1` to `playground-test2`. We can get the `--destination` address from the `wallet list` command above.

:::info

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.
- The command returning a `request failed` response in the browser does not mean that the request failed on-chain. To confirm, check the wallet balance of `playground-test2` using the command above.
- You can also replace the wallet address under the `--destination` flag to transfer testnet TAO to your address.
:::

:::tip run it!

Expand All @@ -118,42 +126,49 @@ btcli wallet transfer \
--no-prompt \
--wallet.path ~/.bittensor/wallets
```

<codapi-snippet sandbox="python" editor="basic" init-delay="500">
</codapi-snippet>

:::info Challenges
1. Check your balance to make sure the transfer executed successfully on chain.
2. Switch the values to transfer TAO back from `playground-test2` to `playground-test1`.
3. Transfer some testnet TAO to a wallet you manage on another device. Just please don't take all of it.
4. If you have some extra testnet TAO, transfer some to the playground-test wallets to refill them.
:::

*Note: Testnet TAO has no monetary value.*
:::info Challenges

:::
1. Check your balance to make sure the transfer executed successfully on chain.
2. Switch the values to transfer TAO back from `playground-test2` to `playground-test1`.
3. Transfer some testnet TAO to a wallet you manage on another device. Just please don't take all of it.
4. If you have some extra testnet TAO, transfer some to the playground-test wallets to refill them.

_Note: Testnet TAO has no monetary value._

:::

## Subnets

### Subnet list

:::tip run it!
<codapi-settings url="https://bittensor-codex.com/v1">
</codapi-settings>

```shell

btcli subnet list
```

<codapi-snippet sandbox="python" editor="basic" init-delay="500">
</codapi-snippet>
:::


### Subnet show

:::tip run it!
<codapi-settings url="https://bittensor-codex.com/v1">
</codapi-settings>

```shell
btcli subnet show --netuid 3
```

<codapi-snippet sandbox="python" editor="basic" init-delay="500">
</codapi-snippet>
:::
Expand All @@ -175,9 +190,12 @@ btcli wallet regen-coldkey \
btcli stake list --network test --wallet.name playground-test1 --wallet-path ~/.bittensor/wallets --no-prompt

```

<codapi-snippet sandbox="python" editor="basic" init-delay="500">
</codapi-snippet>
:::

:::info Challenge
Try staking and unstaking from the playground-test wallets!

:::info Challenge
Try staking and unstaking from the playground-test wallets!
:::
54 changes: 31 additions & 23 deletions docs/evm-tutorials/evm-testnet-with-metamask-wallet.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
---
title: "EVM Testnet with Metamask Wallet"
---

import ThemedImage from '@theme/ThemedImage';
import useBaseUrl from '@docusaurus/useBaseUrl';

# EVM Testnet with Metamask Wallet

This tutorial is for how to set up your Metamask wallet to use with the testnet on Bittensor. You must run this step before you can run other tutorials in this section.
This tutorial is for how to set up your Metamask wallet to use with the testnet on Bittensor. You must run this step before you can run other tutorials in this section.

:::tip blog post: EVM on Bittensor
If you are new to EVM, try this [blog post](https://blog.bittensor.com/evm-on-bittensor-draft-6f323e69aff7) for a simplified explanation.
:::

Key values:

- The **Bittensor Testnet URL:** `https://test.chain.opentensor.ai`
- **EVM Subtensor Chain ID:** `945` (UTF-8 encoded alpha character)
- **Opentensor EVM-Bittensor GitHub repo:** `https://github.com/opentensor/evm-bittensor/tree/main`


## Step 1. Create a Metamask wallet
## Step 1. Create a Metamask wallet

1. If you don't already have it, [install Metamask wallet](https://metamask.io/download/) browser extension.
2. Create a new account.
Expand All @@ -27,52 +28,59 @@ Key values:

Add the testnet to Metamask from within the Metamask wallet. Follow the below steps:

1. Open Metamask Wallet extension on your browser. Click on the &#8942; (three vertical dots, i.e., vertical ellipsis) at the top right.
2. Select **Settings** from the drop-down menu.
1. Open Metamask Wallet extension on your browser. Click on the &#8942; (three vertical dots, i.e., vertical ellipsis) at the top right.
2. Select **Settings** from the drop-down menu.
3. Select **Networks** > **Add network**.
4. Click on **Add a network manually** at the bottom of the networks list.
5. Enter the following details:
- **Network name:** "Subtensor"
- **EVM RPC URL:** `https://test.chain.opentensor.ai`
- **Chain ID:** `945`
- **Currency symbol:** TAO
- **Network name:** "Subtensor"
- **EVM RPC URL:** `https://test.chain.opentensor.ai`
- **Chain ID:** `945`
- **Currency symbol:** TAO
6. Click **Save**.
7. Then click on **Switch network**.

With the above steps, you have successfully configured your Metamask wallet with the testnet.
With the above steps, you have successfully configured your Metamask wallet with the testnet.

## Step 3 Obtain TAO

Next, request testnet TAO in the Bittensor community Discord.
Next, request testnet TAO in the Bittensor community [Discord](https://discord.com/channels/799672011265015819/799672011814862902). Alternatively, you can transfer some testnet TAO to your wallet address using the [BTCLI Live Coding Playground](../btcli/btcli-playground.md#transfer).

:::info Note

- The BTCLI Live Coding Playground contains a limited amount of testnet TAO, so it should be used sparingly and only for transferring small amounts of testnet TAO.
- When transferring testnet TAO using the BTCLI Live Coding Playground, do not forget to replace the wallet address under the `--destination` flag with your testnet wallet address.
:::

## Step 4. Copy Metamask wallet private key into config

:::danger Stop. Did you install the dependencies?
Before you proceed, make sure you finished the [Install](./install.md) step.
:::

In this step you will copy the private key from your Metamask wallet account and paste it into the configuration file in the repo. This step will ensure that you are not prompted with password each and every step as you run these tutorials.

In this step you will copy the private key from your Metamask wallet account and paste it into the configuration file in the repo. This step will ensure that you are not prompted with password each and every step as you run these tutorials.

1. Navigate to the `examples` directory of the EVM-Bittensor repo:

```bash
cd examples
```
```bash
cd examples
```

2. Create `config.js` file by copying the `config-example.js` file:

```bash
cp config-example.js config.js
```
```bash
cp config-example.js config.js
```

3. On Metamask wallet extension, your wallet account will have a H160 account address, starting with the `0x` prefix (for example: `0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf`), and also your wallet account name.
4. Click on your wallet account name, which will open the drop-down menu.
3. On Metamask wallet extension, your wallet account will have a H160 account address, starting with the `0x` prefix (for example: `0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf`), and also your wallet account name.
4. Click on your wallet account name, which will open the drop-down menu.
5. Click on the &#8942; (three vertical dots, i.e., vertical ellipsis) next to the wallet account and select **Account details**. It will open a view with a QR code, your wallet account H160 address and a **Show private key** button.
6. Click on the **Show private key** button, enter the password. You will then see the private key for your wallet account. Copy this private key.
7. Paste this private key into `ethPrivateKey` string in your `config.js` file as shown below (mangled for security):

```javascript
const ethPrivateKey = "02c1c4112233snipsnipsnipgh933aca491e090e0b7xxyy1b124b86d9382b01a8";
const ethPrivateKey =
"02c1c4112233snipsnipsnipgh933aca491e090e0b7xxyy1b124b86d9382b01a8";
```
Save the `config.js` file. Now your setup is ready to run the tutorials with EVM testnet.

Save the `config.js` file. Now your setup is ready to run the tutorials with EVM testnet.
18 changes: 9 additions & 9 deletions docs/staking-and-delegation/managing-stake-btcli.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ Test network tokens have no real value. Before managing liquidity on Bittensor m

## View TAO balance

To stake, you'll first need some TAO. Inquire in Discord to obtain TAO on Bittensor test network.
To stake, you'll first need some TAO. Inquire in [Discord](https://discord.com/channels/799672011265015819/799672011814862902) to obtain TAO on Bittensor test network. Alternatively, you can transfer some testnet TAO to your wallet address using the [BTCLI Live Coding Playground](../btcli/btcli-playground.md#transfer).

To ensure you are targeting the test network, run `btcli config set`, select network, and set it to `test`.
:::info Note

The BTCLI Live Coding Playground contains a limited amount of testnet TAO, so it should be used sparingly and only for transferring small amounts of testnet TAO.
:::

After creating a wallet, ensure that you are targeting the test network by running the `btcli config set` command. Next, select network, and set it to `test`.

View your testnet balance with:

```shell
btcli wallet balance
```
Expand Down Expand Up @@ -65,7 +71,6 @@ btcli subnet list

You should see something like the following output. Notice that next to the subnets Netuid and Name is the subnet's token `Price (τ_in/α_in)`, which, as indicated, is a ratio of the TAO in reserve `τ_in` to alpha in reserve `α_in`.


```console
Subnets
Network: test
Expand Down Expand Up @@ -119,7 +124,6 @@ Using the specified network test from config
46 │ 928.60 Ⲃ │ 928.23 Ⲃ │ τ 0.38 │ 0.00439 │ 0.0088 │ 0.35965 Ⲃ │ 5GuqX1 │ 5Ehuid │ ~
```


## Stake into a node

Use `btcli stake add` to stake to a validator on a subnet. You'll be prompted to choose a subnet and validator, as well as specify an amount of TAO to stake into the validator's hotkey as alpha.
Expand Down Expand Up @@ -161,7 +165,6 @@ Using the specified network test from config

After selecting a validator to delegate stake to, you'll see your wallet balance and be asked to specify the amount of TAO you wish to stake.


```console
Amount to stake (TAO τ): 5
```
Expand Down Expand Up @@ -217,17 +220,16 @@ Stake is held in alpha, but note that value at the current price is also display
Press Enter to continue to the next hotkey...
```


## Transferring stake


The `btcli stake transfer` command is used to transfer ownership of stake from one wallet (coldkey) to another.

:::tip
Don't confuse this with `btcli stake move`, which does not transfer ownership to another wallet/coldkey, but moves stake between validators or subnets, effectively unstaking and restaking it in a single operation.
:::

This operation effectively comprises a series of operations, which occur as an atomic transaction:

- first, the specified amount is unstaked from the subnet alpha token into TAO
- that amount of TAO is then transferred to the ownership of the recipient
- the recipient then automatically stakes the newly received TAO into the subnet, receiving the alpha tokens in return
Expand Down Expand Up @@ -312,5 +314,3 @@ The `btcli stake move` command is used to moves stake between validators or subn
:::tip
Don't confuse this with `btcli stake transfer`, which is used to transfer ownership of stake from one wallet (coldkey) to another.
:::


Loading