API Reference / @evolu/common / Evolu/Internal / NodeId

Variable: NodeId

const NodeId: BrandType<Type<"String", string, string, StringError, string, StringError>, "NodeId", RegexError<"NodeId">, StringError>;

Defined in: packages/common/src/Evolu/Timestamp.ts:107

A NodeId uniquely identifies an owner's device. Generated once per device using cryptographic randomness.

Collision probability (birthday paradox):

  • 1,000 devices: ~0.00000000000271% (negligible).
  • 1M devices: ~0.00000271% (1 in 37M chance).
  • 135M devices: ~1% chance.
  • 4.29B devices: ~50% chance.

https://lemire.me/blog/2019/12/12/are-64-bit-random-identifiers-free-from-collision

What will happen if a different device generates the same NodeId?

If the device belongs to a different owner, nothing will happen because different owner have different owner IDs. Timestamps are partitioned by OwnerId.

If the device belongs to the same owner, the other device will return TimestampDuplicateNodeError.

Was this page helpful?