SlotDuration

Constant v151 → current u64

Sets the timing for block production - how many milliseconds between each slot.

Current Value

12000
Relevant for: validatorsdevelopersanalytics

The Big Picture

Aura consensus divides time into fixed-duration slots. SlotDuration determines how long each slot lasts (typically 12 seconds / 12000ms). This is a fundamental parameter that determines the chain's block production rate. Faster slots = more blocks per minute = higher throughput but more resource usage. The slot duration is set at genesis and should not change during operation.

Why This Matters

How fast does this chain produce blocks? SlotDuration tells you. At 12000ms (12 seconds), you can expect roughly 5 blocks per minute, which affects transaction confirmation times.

Example

Query SlotDuration() returns 12000 (milliseconds). This means each block slot is 12 seconds. When submitting a transaction, expect confirmation within ~12 seconds if included in the next block.

Common Questions

Is every slot filled with a block?
Not necessarily. If the designated authority is offline or fails, the slot is empty. Block number may lag behind slot number when blocks are missed.
Can this value change?
The runtime constant cannot change without a runtime upgrade. This value is fixed at genesis and should remain stable throughout the chain's operation.
How does this relate to finality?
SlotDuration affects block production (Aura), not finality (Grandpa). Blocks can be produced quickly but finality may take longer depending on Grandpa consensus.
Why 12 seconds?
Balance between speed and safety. Faster blocks increase network load and require better connectivity. 12 seconds allows reasonable transaction throughput while accommodating network latency and validator distribution.

From Chain Metadata

The slot duration Aura should run with, expressed in milliseconds. The effective value of this type should not change while the chain is running. For backwards compatibility either use [`MinimumPeriodTimesTwo`] or a const.

Use Cases

  • Calculate expected block time
  • Build block countdown timers
  • Estimate transaction confirmation times
  • Research network throughput characteristics
  • Debug block production timing issues

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query SlotDuration constant
const value = api.consts[stringCamelCase("Aura")][stringCamelCase("SlotDuration")];
console.log("SlotDuration:", value.toHuman());

// Convert RAO to TAO if this is a balance value
const taoValue = value.toBigInt() / BigInt(1e9);
console.log("TAO:", taoValue.toString());

Type Information

Type
u64
Byte Size
8 bytes
Encoding
fixed
Raw Hex
0xe02e000000000000

Runtime Info

Pallet
Aura
First Version
v151
Latest Version
v151
Current Runtime
v393