SNOWFLAKE 64-BIT

Distributed Unique ID Generator

Coordination-free 64-bit integer packing: 1-bit sign | 41-bit epoch ms | 10-bit node | 12-bit sequence
01 / 10
64-bit Snowflake Binary Packing Map Generate an ID to light the fields
0 sign (1b) 41-bit timestamp (ms since custom epoch) 10-bit identity (DC+W) 12-bit sequence
41b timestamp (~69 yrs) 10b datacenter + worker (1,024 nodes) 12b per-ms sequence (4,096 IDs/ms)
1. Timestamp41 BITS
current ms—
epoch delta—
custom epoch2024-01-01
in: clock (IN:1)out: <<22 (OUT:2)
2. Node identity10 BITS
datacenter07 / 31
worker12 / 31
packed bits00111 01100
in: lease (IN:2)out: <<12 (OUT:2)
3. Sequence12 BITS
counter0
capacity0 / 4096
next millisecondresets to 0
in: 10b node (IN:1)out: 12b seq (OUT:1)
4. Assembled ID64 BITS
decimal—
statuswaiting for request
Decoded bit segments
timestamp: — datacenter: 07 worker: 12 sequence: 0
in: OR pipe (IN:1)out: int64 (OUT:1)
Identity allocationSTARTUP
registry leaseDC-07 / W-12
runtime locknone
Unique node bits are assigned before requests arrive.
in: boot (IN:1)out: lease (OUT:1)
Clock guardSAFETY
last accepted—
rollback policyreject / wait
Never reuse a prior millisecond on this worker.
in: ntp (IN:1)out: guard (OUT:1)
Ready — Generate an ID first to enable same-millisecond, capacity, and rollback scenarios.