Evolution SDK
Time

Slots

Cardano slot numbers and time conversion

Slots

Cardano measures time in slots. Each slot has a fixed duration determined by the network's configuration. The transaction builder converts between Unix timestamps and slots using the slot config.

Slot Configuration

NetworkSlot LengthStart Time
Mainnet1000ms (1 second)Shelley era start
Preprod1000ms (1 second)Network genesis
Preview1000ms (1 second)Network genesis
DevnetConfigurable (20-100ms typical)Cluster creation

How Conversion Works

The slot config defines three values:

  • zeroTime — Unix timestamp of the network's start
  • zeroSlot — First slot number (Shelley era)
  • slotLength — Milliseconds per slot

The builder uses these to convert: slot = zeroSlot + (unixTime - zeroTime) / slotLength

Custom Slot Config

For devnet or custom networks, you can override the slot config in build options:

import { , , ,  } from "@evolution-sdk/evolution"

const  = .()
  .({
    : "https://cardano-preprod.blockfrost.io/api/v0",
    : ..!
  })
  .({ : ..!, : 0 })

const  = await 
  .()
  .({
    : .("addr_test1vrm9x2dgvdau8vckj4duc89m638t8djmluqw5pdrFollw8qd9k63"),
    : .(2_000_000n)
  })
  .({
    : {
      : 1666656000000n,
      : 0n,
      : 1000
    }
  })

Manual Slot Conversion

The builder handles slot conversion automatically, but you can also convert manually using Time.unixTimeToSlot and Time.slotToUnixTime:

import { Time, SlotConfig } from "@evolution-sdk/evolution"

// Use built-in network configs
const preprodConfig = SlotConfig.SLOT_CONFIG_NETWORK.Preprod
const mainnetConfig = SlotConfig.SLOT_CONFIG_NETWORK.Mainnet

// Unix time → slot
const now = BigInt(Date.now())
const currentSlot = Time.unixTimeToSlot(now, preprodConfig)
console.log("Current slot:", currentSlot)

// Slot → Unix time
const targetSlot = 50000000n
const targetTime = Time.slotToUnixTime(targetSlot, preprodConfig)
console.log("Slot 50M is at:", new Date(Number(targetTime)))

Available Network Configs

NetworkSlotConfig.SLOT_CONFIG_NETWORK.XZero TimeZero SlotSlot Length
Mainnet.Mainnet1596059091000 (Shelley start)44928001000ms
Preprod.Preprod165576960000001000ms
Preview.Preview166665600000001000ms

Next Steps

On this page