Now

Storage Plain v101 → current

Current Unix timestamp in milliseconds as set by the block author.

Explore chain
Queried by: developersvalidatorsanalytics

The Big Picture

This is THE source of time on the blockchain. Any pallet, smart contract, or application that needs to know 'what time is it?' queries this storage. It's updated exactly once per block by the validator as an inherent extrinsic. The value is Unix timestamp in milliseconds.

Why This Matters

When your application needs time-based logic - auction deadlines, vesting schedules, rate limiting windows - this is where you get the time. It's the only trusted time source on-chain.

Example Scenario

Query Timestamp.Now() returns 1704067200000 (Jan 1, 2024 00:00:00 UTC in milliseconds). Your smart contract checks if now > auction_end_time to determine if bidding has closed.

Common Questions

Is this always accurate?
Reasonably accurate, within seconds of real time. Validators use their local clocks, and MinimumPeriod prevents manipulation. Don't rely on millisecond precision.
Can I query historical timestamps?
Yes, query the storage at a specific block number to get the timestamp that was set in that block. Useful for time-correlating historical events.
Why milliseconds instead of seconds?
Milliseconds provide finer granularity for applications that need it, while still fitting in a u64. Divide by 1000 to get seconds.

Use Cases

  • Get current on-chain time for smart contracts
  • Calculate time elapsed since an event
  • Implement time-locked functionality
  • Validate that operations occurred within time windows
  • Correlate block numbers with real-world timestamps

From Chain Metadata

Current time for the current block.

Purpose & Usage

Purpose

Provides the canonical on-chain time reference for all time-based operations.

Common Query Patterns

  • Single value query for current block time
  • Historical queries to find timestamp at specific blocks

Stored Value

Current Unix timestamp in milliseconds

RAO -> TAO (/ 10^9)

Relationships

Modified By

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 Now storage (no keys - plain value)
const result = await api.query
  [stringCamelCase("Timestamp")]
  [stringCamelCase("Now")]();
console.log("Now:", result.toHuman());

On-Chain Activity

Write Source Runtime Hook

Modified by runtime hooks (e.g., epoch transitions), not directly by user extrinsics

As of block 7,429,232

Runtime Info

Pallet
Timestamp
Storage Kind
Plain
First Version
v101
Current Version
v393