sudo

Call v101 → current #0

Authenticates the sudo key and dispatches a function call with Root origin.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validatorssubnet ownersdevelopers

The Big Picture

The sudo call is the ultimate administrative tool - it allows the sudo key holder to execute any call as if it came from the Root origin. This bypasses normal permission checks, making it critical for governance and emergency response but also dangerous if misused. Subtensor still runs the Sudo pallet, so Sudo.Key holds a live key on mainnet rather than having been dropped in favour of an on-chain council.

Why This Matters

Some operations require Root origin - the highest privilege level in Substrate. During early network development or for emergency maintenance, sudo provides a way to execute these privileged operations. Think of it as the 'root' user in Linux.

Example Scenario

The network needs to adjust a critical parameter that only accepts Root origin. The sudo key holder calls sudo(inner_call=set_critical_param(value)). The inner call executes with Root privileges. Sudid event confirms success or reports failure.

Common Questions

Is sudo safe to use?
Sudo is powerful and should be used carefully. The sudo key holder has ultimate control over the network. In production, consider replacing sudo with proper governance mechanisms like Democracy or Council.
What if the inner call fails?
The Sudid event reports the result. A failed inner call doesn't affect the outer sudo call - you still pay fees for the attempt.

Use Cases

  • Execute privileged operations during network bootstrapping
  • Emergency network maintenance
  • Configure runtime parameters that require Root
  • Deploy runtime upgrades

From Chain Metadata

Authenticates the sudo key and dispatches a function call with `Root` origin. The dispatch origin for this call must be _Signed_. ## Complexity O(1).

Input Parameters

#NameTypeDescription
0
call
RuntimeCall Box<<T as Config>::RuntimeCall>call (RuntimeCall)

Permissions

Origin
Root
Required Role

Requirements

  • Signer must be the current sudo key
  • Call must be a valid runtime call

Effects

Events Emitted

Postconditions

  • The inner call is dispatched with Root origin
  • Sudid event emitted with call result

Side Effects

  • Inner call may modify any storage with Root privileges
  • All checks in inner call still apply

Code Examples

// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);

// Build sudo call (typed, named args)
const call = undefined as any /* RuntimeCall — replace with real value */;

const tx = api.tx.Sudo.sudo({
  call,
});

On-Chain Activity

Usage Frequency
●●○○○○ Low 1K–10K extrinsics

Infrequent

#69 most used call

Success Rate Competitive

5–20% of submissions succeed — expect frequent failures

As of block 9,385,000

Runtime Info

Pallet Index
12
Call Index
0
First Version
v101
Current Version
v490