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
| Network | Slot Length | Start Time |
|---|---|---|
| Mainnet | 1000ms (1 second) | Shelley era start |
| Preprod | 1000ms (1 second) | Network genesis |
| Preview | 1000ms (1 second) | Network genesis |
| Devnet | Configurable (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 = ({
: "preprod",
: { : "blockfrost", : "https://cardano-preprod.blockfrost.io/api/v0", : ..! },
: { : "seed", : ..!, : 0 }
})
const = await
.()
.({
: .("addr_test1vrm9x2dgvdau8vckj4duc89m638t8djmluqw5pdrFollw8qd9k63"),
: .(2_000_000n)
})
.({
: {
: 1666656000000n,
: 0n,
: 1000
}
})Next Steps
- POSIX Time — Unix timestamp utilities
- Validity Ranges — Setting time constraints