Skip to content

Commit 55f8f4b

Browse files
authored
Merge pull request #39 from latent-to/doc-updates
Local development docs
2 parents aac2c71 + 8b6fc50 commit 55f8f4b

File tree

13 files changed

+620
-320
lines changed

13 files changed

+620
-320
lines changed

docs/btcli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ btcli wallet transfer [OPTIONS]
686686
| `--destination`, `--dest`, `-d` | TEXT | Destination address (ss58) of the wallet (coldkey). |
687687
| `--amount`, `-a` | FLOAT | Amount (in TAO) to transfer. |
688688
| `--all` | | Transfer all available balance. |
689-
| `--all`, `-a` | | Whether to display the balances for all the wallets. |
689+
| `--all` | | Whether to display the balances for all the wallets. |
690690
| `--period`, `-era` | INTEGER | Length (in blocks) for which the transaction should be valid. |
691691
| `--wallet-name`, `--name`, `--wallet_name`, `--wallet.name` | TEXT | Name of the wallet. |
692692
| `-p`, `--wallet-path`, `--wallet_path`, `--wallet.path` | TEXT | Path where the wallets are located. For example: `/Users/btuser/.bittensor/wallets`. |

docs/glossary.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ A unit of data in the Bittensor blockchain, containing a collection of transacti
4444

4545
**See also:** [Subtensor API](./sdk/subtensor-api.md)
4646

47+
### Burn cost
48+
49+
This refers to the required amount of TAO to be recycled when creating a new subnet, i.e., cost of registering a new subnet.
50+
51+
**See also:** [Burn cost](./subnets/create-a-subnet.md#burn-cost)
52+
4753
## C
4854

4955
### Coldkey
@@ -465,6 +471,7 @@ Where:
465471
- [`bittensor/bittensor/core/metagraph.py:325-331`](https://github.com/opentensor/bittensor/blob/main/bittensor/core/metagraph.py#L325-331)
466472
- [`subtensor/pallets/subtensor/src/epoch/run_epoch.rs:605`](https://github.com/opentensor/subtensor/blob/main/pallets/subtensor/src/epoch/run_epoch.rs#L605)
467473

474+
468475
### Recycling and burning
469476

470477
Tokens (TAO and subnet-specific alpha) can be 'removed from circulation', meaning these tokens exist in neither wallet nor liquidity pool, and cannot be transacted. This can happen in two ways:
@@ -473,15 +480,18 @@ Tokens (TAO and subnet-specific alpha) can be 'removed from circulation', meanin
473480

474481
- In contrast, when tokens are **burned** they exist in no wallet and no pool and can no longer be transacted; however they are still included in the record of token issuance, so they will not be re-emitted, and in effect will forever remain as a quantity of *missing* tokens, a difference between issuance and the effective quantity in circulation.
475482

483+
476484
#### Recycling
477485

478486
Tokens are recycled in several cases in Bittensor operations:
479487

488+
480489
- **All transaction fees are recycled**: When transaction fees are collected, they are deducted from `TotalIssuance`, effectively recycling them back into the system for future emission. See [Transaction Fees in Bittensor](./fees)
481490
- **Subnet Creation fees**: When a new subnet is created, the cost is recycled, except for one TAO, which is used to initialize the subnet's TAO liquidity pool.
482491
- **Neuron Registration fees**: When a user registers a hotkey on a subnet to participate as a miner or validator, they are charged a registration fee in TAO. Alpha tokens worth the current swap value of the fee are taken from the subnet's alpha liquidity pool and recycled.
483492
- **Extrinsic transaction**: Users can manually recycle alpha tokens using the `recycle_alpha` extrinsic, which reduces both the user's stake and the subnet's `SubnetAlphaOut` tracker.
484493

494+
485495
#### Burning
486496

487497
Subnet-specific alpha tokens are burned in several contexts:
@@ -503,6 +513,7 @@ The process of registering keys with a subnet and purchasing a UID slot.
503513

504514
**See also:** [Subnet Miners](./miners/), [Subnet Validators](./validators/), [Working with Subnets](./subnets/working-with-subnets.md)
505515

516+
506517
### Root Subnet/Subnet Zero
507518

508519
Subnet Zero a.k.a. the root subnet is a special subnet. No miners can register on subnet zero, and no validation work is performed. However validators can register, and $\tau$-holders can stake to those validators, as with any other subnet. This offers a mechanism for $\tau$-holders to stake $\tau$ into validators in a subnet-agnostic way. This works because the weight of a validator in a subnet includes both their share of that subnet's $\alpha$ and their share of staked TAO in Subnet Zero.
@@ -744,7 +755,6 @@ The relationship between these metrics creates a feedback loop: consensus determ
744755
A position occupied by a subnet miner or subnet validator within a subnet, identified by a unique UID. The UID is assigned to a hotkey when it is registered in a subnet, allowing the hotkey to participate as a subnet validator or subnet miner.
745756

746757
**See also:** [Subnet Miners](./miners/), [Subnet Validators](./validators/), [Working with Subnets](./subnets/working-with-subnets.md)
747-
748758
### Unstaking
749759

750760
The process of detaching TAO from a validator hotkey.
@@ -871,6 +881,7 @@ Where $\alpha$ is the EMA smoothing factor (see [Exponential Moving Average](#ex
871881
- Bonds are stored as sparse matrices in blockchain state
872882

873883
**Bond Decay:**
884+
874885
- Bonds decay over time using [EMA](#exponential-moving-average-ema) with the `bonds_moving_avg` parameter
875886
- Higher decay rates (larger α) make bonds more responsive to recent performance
876887
- Lower decay rates (smaller α) allow bonds to persist longer

docs/learn/ema.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
22
title: "Exponential Moving Averages (EMAs)in Bittensor"
33
---
4+
45
# Exponential Moving Averages (EMAs) in Bittensor
56

6-
The exponential moving average (EMA) is a [mathematical technique](https://en.wikipedia.org/wiki/Exponential_smoothing) for tracking a dynamic quantity, such as a token price, over time. Specifically, EMA is a weighted moving average that exponentially decreases the weight of older data point. This extracts a signal reflecting where the value has spent *most* of its time *most recently*, stabilizing or 'smoothing' the constant noise of rapid, largely random fluctuations.
7+
The exponential moving average (EMA) is a [mathematical technique](https://en.wikipedia.org/wiki/Exponential_smoothing) for tracking a dynamic quantity, such as a token price, over time. Specifically, EMA is a weighted moving average that exponentially decreases the weight of older data point. This extracts a signal reflecting where the value has spent _most_ of its time _most recently_, stabilizing or 'smoothing' the constant noise of rapid, largely random fluctuations.
78

89
Bittensor uses EMAs to smooth two critical dynamical values during the emission process:
910

1011
- Emissions to each subnet are determined by an EMA-smoothed representation of subnet price each tempo. This protects emissions from price volatility or intentional manipulation.
1112

12-
- Emissions to participants of each subnet are determined by EMAs of instantaneous validator-miner bond-strengths. This plays an important roll in ensuring that validators and miners are fairly rewarded for innovation, as measured by eventual consensus (rather than immediate consensus) about miner weights.
13+
- Emissions to participants of each subnet are determined by EMAs of instantaneous validator-miner bond-strengths. This plays an important role in ensuring that validators and miners are fairly rewarded for innovation, as measured by eventual consensus (rather than immediate consensus) about miner weights.
1314

1415
## Mathematical definition
1516

16-
1717
The EMA of a changing value at a given time is determined by weighted average of the current value and the EMA at the last time step. The parameter factor, or 'smoothing factor' is called $\alpha$.
1818

1919
$$
@@ -30,14 +30,12 @@ The alpha parameter controls how quickly the EMA responds to changes:
3030
Note that this alpha parameter is distinct from and unrelated to the usage of 'alpha' to refer to subnet-specific currencies.
3131
:::
3232

33-
34-
3533
## Subnet Price Emission Smoothing
3634

3735
This use of EMA smoothing protects the network's economic model from price manipulation by making emissions extremely slow to respond to price changes.
3836

3937
**How It Works**:
40-
The price EMA uses a sophisticated dynamic alpha calculation to ensures that new subnets have even slower price adaptation than mature ones.
38+
The price EMA uses a sophisticated dynamic alpha calculation to ensure that new subnets have even slower price adaptation than mature ones.
4139

4240
$$
4341
\alpha = \frac{ \mathrm{base\_alpha} \times \mathrm{blocks\_since\_start}}{\mathrm{blocks\_since\_start} + \mathrm{halving\_blocks}}
@@ -48,6 +46,7 @@ The value for **base_alpha** in the above is currently ~0.0003 for Bittensor mai
4846
:::
4947

5048
See:
49+
5150
- [Yuma Consensus/Coinbase emission source code](https://github.com/opentensor/subtensor/blob/main/pallets/subtensor/src/epoch/run_epoch.rs#L223)
5251
- [Default alpha value for subnet price smoothing](https://github.com/opentensor/subtensor/blob/main/pallets/subtensor/src/lib.rs#L828)
5352

@@ -56,20 +55,24 @@ See:
5655
This smoothing function ensures that relationships between validators and miners evolve gradually, preventing sudden manipulation while rewarding validators who discover promising miners early.
5756

5857
### Basic Bond EMA (Liquid Alpha Disabled)
58+
5959
**Default Mode**: Single $\alpha$ for all validator-miner pairs
60+
6061
- **Default $\alpha$**: ~0.1 (10%)
6162
- **Response Time**: 7-22 blocks for significant changes (~1-4 minutes)
6263
- **Formula**
63-
The EMA of the bond (BondEMA)of a validator i for a miner j, at time t, is the $\alpha$-weighted average of the instantaneous bond and the previous timestep's BondEMA:
64-
$$
65-
BondEMA_{ij}^{(t)} = \alpha \times \, InstantBond_{ij} + (1-\alpha)\,BondEMA_{ij}^{(t-1)}
66-
$$
64+
The EMA of the bond (BondEMA)of a validator i for a miner j, at time t, is the $\alpha$-weighted average of the instantaneous bond and the previous timestep's BondEMA:
65+
$$
66+
BondEMA_{ij}^{(t)} = \alpha \times \, InstantBond_{ij} + (1-\alpha)\,BondEMA_{ij}^{(t-1)}
67+
$$
6768

6869
### Advanced Bond EMA (Liquid Alpha Enabled)
70+
6971
**Consensus-Based Mode**: Dynamic $\alpha$ per validator-miner pair based on consensus alignment
70-
- **$\alpha$ Range**: Dynamic between $\alpha$_low and $\alpha$_high (default: 0.7 to 0.9)
71-
- **Sigmoid Steepness**: Controls transition rate between $\alpha$_low and $\alpha$_high (default: 1000)
72+
73+
- **$\alpha$ Range**: Dynamic between $\alpha$\_low and $\alpha$\_high (default: 0.7 to 0.9)
74+
- **Sigmoid Steepness**: Controls transition rate between $\alpha$\_low and $\alpha$\_high (default: 1000)
7275
- **Individual Alpha**: Each validator-miner pair gets its own $\alpha$ value
7376
- **Response Time**: 1-13 blocks depending on consensus alignment (~12 seconds to 2.6 minutes)
7477

75-
See [Liquid Alpha/Consensus-Based Weights](../subnets/consensus-based-weights)
78+
See [Liquid Alpha/Consensus-Based Weights](../subnets/consensus-based-weights)

0 commit comments

Comments
 (0)