Difficulty

Storage Map v101 → v490 · 1 shape change

POW difficulty for registration .

Explore chain
Queried by: minersvalidatorsdevelopersanalytics

The Big Picture

POW registration requires solving a computational puzzle. Difficulty controls how hard that puzzle is. When many people try to register, difficulty rises (like Bitcoin mining). When registration cools off, difficulty drops. It's a self-balancing mechanism that keeps registration accessible but not free.

Why This Matters

Thinking about POW registration? Difficulty tells you how much compute you'll need. High difficulty might make burn registration more economical. This is essential for cost planning.

Example Scenario

Query Difficulty(netuid=1) returns 10000000. This is the target difficulty. Your POW solution must produce a hash below this target. Lower target = harder to find valid solutions = more compute needed.

Common Questions

How does difficulty adjust?
Based on TargetRegistrationsPerInterval. If actual registrations exceed target, difficulty increases. If below target, difficulty decreases. Check AdjustmentInterval for frequency.
Should I use POW or burn?
Compare the electricity/hardware cost to solve the POW against the current Burn cost. On popular subnets, burn is often cheaper for occasional registrations.
What's the unit?
Difficulty is a u64 target value. Your POW hash must be less than this value. Higher number = easier (more valid hashes), lower number = harder.
Are there limits?
Yes, check MinDifficulty and MaxDifficulty for the bounds. Difficulty won't go below or above these.

Use Cases

  • Estimate computational cost before POW registration
  • Choose between POW and burn registration based on cost
  • Monitor subnet popularity through difficulty proxy
  • Build registration cost estimators
  • Track network activity via difficulty adjustments

From Chain Metadata

MAP ( netuid ) --> Difficulty

Purpose & Usage

Purpose

Control registration computational cost - harder difficulty means more computation needed to register.

Common Query Patterns

  • Query by netuid before attempting POW registration
  • Monitor difficulty changes over time
  • Compare difficulty across subnets
Part of: Neuron Registration

Migration Notes

v424 v432 Breaking

key type changed from u16 to NetUid

Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.

Query Keys

#NameTypeDescription
1
netuid
NetUid u16netuid (NetUid, hashed key component)

Stored Value

Difficulty (u64)

RAO -> TAO (/ 10^9)

Default Value

10000000 0x8096980000000000

Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.

Relationships

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query Difficulty storage
const netuid = 1;

const result = await api.query.SubtensorModule.Difficulty.getValue(netuid);
console.log("Difficulty:", result);

On-Chain Activity

Write Frequency
●●●●●○ High 1M–10M est. writes

1M to 10M writes

#151 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 9,385,000

Version History

v101 block 1 Added
v425–v431 · runtime versions skipped on chain (never deployed)
v432 block 8,636,190 Shape changed Current
  • key : u16 → NetUid

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v101
Current Version
v490