Yuma Consensus
ConsensusStake-weighted consensus algorithm that determines validator trust, miner incentives, and emission distribution within subnets.
Yuma Consensus Flow
Yuma Consensus Flow
Median
Click items to navigate to their reference pages.
The Big Picture
Yuma Consensus turns validator opinions into miner rewards. Every TAO earned by miners flows through this algorithm — it is the economic engine of Bittensor. Validators submit weight vectors scoring miners, and the algorithm aggregates them using stake-weighted median to resist manipulation by minority coalitions.
Why This Matters
Every TAO earned by a miner or validator flows through Yuma Consensus. Understanding it is essential for optimizing validator strategies, evaluating subnet health, and building applications on Bittensor.
Example Scenario
Suppose subnet 1 has 3 validators with stakes [500, 300, 200] TAO. Validator 0 scores Miner A at 0.8, Validator 1 scores 0.5, and Validator 2 scores 0.3. The stake-weighted median (κ=0.51) walks through sorted scores accumulating stake: 0.3 (20% stake), 0.5 (50% stake ≥ 49% minority). The consensus score is 0.5 — the majority-stake opinion wins.
Common Questions
- Can a single large validator control consensus?
- Only if they hold >51% of the stake. The weighted median ensures the majority stake coalition determines consensus.
- What happens to weights above consensus?
- They are clipped to the consensus value. This prevents validators from giving inflated weights to favored miners without losing trust.
- How do bonds affect dividends?
- Bonds are an EMA of validator-miner relationships. Validators earn dividends proportional to their bonds in high-incentive miners, rewarding consistent evaluation.
Use Cases
- Evaluating subnet health and miner performance
- Optimizing validator weight strategies
- Understanding miner earning potential
- Auditing consensus fairness across subnets
- Building validator management tools
Yuma Consensus is the core algorithm that processes validator weight matrices to produce consensus scores for miners. Each epoch, validators submit weight vectors scoring miners. These weights are aggregated using stake-weighted median to produce a consensus weight matrix resistant to manipulation. From this, validator trust, miner incentive, and emission dividends are calculated.
The algorithm runs per-subnet at each epoch boundary (determined by Tempo). It reads the weight matrix and stake distribution, then writes updated consensus, incentive, dividend, and emission values to storage.
Triggers
- Epoch boundary reached: (block_number + netuid + 1) % (tempo + 1) == 0
Inputs (8)
| Item | Type | Role |
|---|---|---|
| Weights SubtensorModule | storage | Validator weight vectors scoring miners |
| Alpha SubtensorModule | storage | Per-hotkey Alpha balances per subnet (stake weight since dTAO) |
| TotalHotkeyAlpha SubtensorModule | storage | Aggregated Alpha stake per hotkey per subnet for consensus weighting |
| Bonds SubtensorModule | storage | Historical bond matrix for EMA calculation |
| Tempo SubtensorModule | storage | Blocks per epoch for this subnet |
| Kappa SubtensorModule | storage | Consensus majority threshold (typically 0.5) |
| BondsMovingAverage SubtensorModule | storage | EMA smoothing factor for bond updates |
| ValidatorPermit SubtensorModule | storage | Which UIDs are permitted to validate |
Outputs (7)
| Item | Type | Role |
|---|---|---|
| Consensus SubtensorModule | storage | Consensus weight per miner UID |
| Incentive SubtensorModule | storage | Incentive scores determining miner rewards |
| Dividends SubtensorModule | storage | Validator dividend shares from emissions |
| Trust SubtensorModule | storage | Validator trust scores |
| Rank SubtensorModule | storage | Miner ranking by incentive |
| Emission SubtensorModule | storage | Per-UID emission amounts for this epoch |
| Bonds SubtensorModule | storage | Updated bond matrix after EMA |
Source Files
pallets/subtensor/src/epoch/run_epoch.rs pallets/subtensor/src/epoch/math.rs Formulas
Weighted Median
Core of Yuma Consensus. Computes stake-weighted median of validator scores for each miner, producing manipulation-resistant consensus weights.
For each miner j: 1. Collect (stake_i, weight_ij) pairs from all validators i 2. Sort by weight value 3. Walk sorted list accumulating stake until >= majority (kappa) 4. Median = weight at the majority crossing point
TypeScript: weightedMedian() in yuma-formulas.ts
Bond EMA
Exponential moving average blending current weights into historical bonds, smoothing validator-miner relationships over time. Input weights are blended between raw and clipped-to-consensus via bonds_penalty. Yuma3 applies EMA directly to weights; legacy path normalizes bonds_delta by stake first.
// weights_for_bonds = interpolate(weights, clipped_weights, bonds_penalty) // bonds_penalty=0 → raw weights, bonds_penalty=1 → fully clipped to consensus // Yuma3: EMA applied directly to weights_for_bonds (or per-pair liquid alpha) // Legacy: bonds_delta = col_normalize(hadamard(weights_for_bonds, active_stake)) B_new = alpha * W_for_bonds + (1 - alpha) * B_previous alpha = 1 - BondsMovingAverage / 1_000_000
TypeScript: matEma() in yuma-formulas.ts
Trust Score
Fraction of a validator's weight vector that agrees with consensus. Trust[i] = sum_j(min(w_ij, consensus_j)). Weights are pre-normalized (row sums to 1.0) so no division is needed.
TypeScript: computeValidatorTrust() in yuma-formulas.ts
Consensus Simulator
Consensus Calculator
Experiment with validator weights and see how consensus is computed
Input: Validator Stakes & Weights
| Validator | Stake (TAO) | → M0 | → M1 | → M2 | Actions |
|---|---|---|---|---|---|
| V0 | |||||
| V1 |
Step 1: Consensus (Weighted Median)
Step 2: Clipped Weights
| Validator | → M0 | → M1 | → M2 | Trust |
|---|---|---|---|---|
| V0 | 0.500 | 0.300 | 0.200 | 1.000 |
| V1 | 0.400 | 0.300 (was 0.40) | 0.200 | 0.900 |
Step 3: Miner Incentive (Server Emission)
Step 4: Validator Dividends
Try this: Give one validator an extreme weight (e.g., 0.9 to M0) and see how it gets clipped to consensus. Notice that the validator's trust score decreases when their weights differ from consensus.
Collusion test: Create a minority validator coalition (combined stake <50%) all giving the same outlier weight. Watch how the weighted median ignores them entirely.