
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
U256ID is a 256-bit identifier (uint256) with strict, interoperable encoding and validation rules.
packages/contractspackages/sdkQuick start:
forge buildforge testdeno test packages/sdkpackages/examples contains runnable scriptspackages/examples (moved out of runtime)This document defines the strict usage specification for U256ID. Implementations that follow this specification ensure interoperability.
We follow [RFC 2119]; MUST / MUST NOT / SHOULD / SHOULD NOT / MAY are used as normative words.
0x + 64 lowercase
hex digits.u2:).u2s:<head8>…<tail8>). Not acceptable
as input.vvvv = 0000b).vvvv = 0001b) with the field layout described
below.Note: Generation MUST always happen off‑chain. On‑chain random generation is unsafe.
| Bit position (MSB→LSB) | Len | Name | Description |
|---|---|---|---|
| 255..252 | 4 | version | Top 4 bits. 0x0 = v0, 0x1 = v1. |
| 251..0 | 252 | payload | Version‑specific fields. |
| Field | Pos | Len | Value/Meaning |
|---|---|---|---|
| version | 255..252 | 4 | 0000b |
| R | 251..0 | 252 | 252‑bit randomness from a CSPRNG |
| Field | Pos | Len | Value/Meaning |
|---|---|---|---|
| version | 255..252 | 4 | 0001b |
| T | 251..204 | 48 | Unix time (ms), range [0, 2^48-1] |
| N | 203..172 | 32 | NodeID. Fixed per process/node (randomized at start or configured) |
| C | 171..156 | 16 | Monotonic counter within the same ms (+1); wrapping at 0xffff is allowed |
| R | 155..0 | 156 | Additional randomness (CSPRNG) to reduce collision risk in distributed gen |
0x + 64 lowercase hex digits.^0x[0-9a-f]{64}$
u2: + Base58 (Bitcoin alphabet).123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyzu2: prefix.u2s:<head8>…<tail8> (e.g., u2s:3fa85f64…a9d3f6bc).crypto.getRandomValuescrypto.webcrypto.getRandomValuesMath.random()0000b and fill the remaining 252 bits with CSPRNG
randomness (MUST).version = 0001b and fill fields as follows (MUST):
T = Date.now() in ms, masked to 48 bits.N = node‑specific 32‑bit value (fixed at startup or via config).C = monotonically increasing within the same ms (wrapping allowed).R = 156 bits from a CSPRNG.T SHOULD be monotonic non‑decreasing. If the system clock moves backward, it
is desirable to compensate ordering with C (SHOULD).| Step | Condition | Action |
|---|---|---|
| 1 | String matches ^0x[0-9a-f]{64}$ | If not, error INVALID_FORMAT |
| 2 | Interpretable as uint256 | If not, error INVALID_VALUE |
| 3 | version = (id >> 252) & 0xF | If unsupported version, error UNSUPPORTED_VERSION |
| Step | Condition | Action |
|---|---|---|
| 1 | Prefix u2: optional | Remove if present |
| 2 | Only Base58 alphabet characters | Otherwise error INVALID_BASE58 |
| 3 | Decode Base58 to integer | On failure, INVALID_BASE58 |
| 4 | Left‑pad to 256 bits | Convert to 0x+64hex |
| 5 | Perform Canonical validation 5.1 | Propagate errors |
Implementations MUST store input by normalizing HR → Canonical.
uuidToU256: Place UUID (16B) into the lower 128 bits and produce a Canonical
with upper 128 bits = 0 (MUST).u256ToUuid: Only convert back to a UUID string when upper 128 bits = 0
(MAY).T
(information located elsewhere).| Item | Rule |
|---|---|
| Input | MAY accept Canonical or HR; after acceptance, normalize to Canonical (MUST). Reject Short (MUST NOT). |
| Output | Return Canonical (MUST). UI‑facing endpoints MAY also include HR. |
| Error | Prefer returning the error codes defined in Section 8 (SHOULD). |
| Item | Recommendation |
|---|---|
| Type | Fixed‑length CHAR(66) (0x+64hex). Validate via regex CHECK |
| Primary | Use Canonical as PK. B‑Tree benefits from v1’s temporal locality. |
| Secondary | Create derived columns such as ts_ms (v1 T) as needed and index. |
| Code | Meaning | Condition |
|---|---|---|
INVALID_FORMAT | Format error | Regex mismatch (Canonical) / invalid length |
INVALID_VALUE | Value error | Not interpretable as uint256 |
UNSUPPORTED_VERSION | Unsupported ver. | version not supported by implementation |
INVALID_BASE58 | Base58 error | HR alphabet violation / decode failure |
DISALLOWED_SHORT | Short input | Reject u2s: input |
UPPER128_NOT_ZERO | Upper‑zero violation | On reverse conversion in UUID bridge |
0x0f97c2a48e7f5e09f417f2c4e833d78d8e214ad64d6cfbb7a50f62ebd7138a4f
Version = 0
u2:3r5w3iBq7G8fYQkz8x5f7J6NRcQ1k3Qkq1S5G5if9PjT
0x0f97c2a48e7f5e09f417f2c4e833d78d8e214ad64d6cfbb7a50f62ebd7138a4f
0x1a00017c5d53a4f100012abbd61ff8349817dcaa47b9e2e8941f2395dc3c4b71
Version = 1
T(ms) = (id >> 204) & ((1<<48)-1)
N = (id >> 172) & 0xffffffff
C = (id >> 156) & 0xffff
T, which may leak generation time; if
secrecy is needed prefer v0 (SHOULD).function toBase58(u256):
n := u256 (bigint)
if n == 0: return "u2:1"
s := ""
while n > 0:
(n, rem) := divmod(n, 58)
s := ALPHABET[rem] + s
return "u2:" + s
function fromBase58(hr):
s := hr.startsWith("u2:") ? hr[3:] : hr
assert(all(c in ALPHABET for c in s))
x := 0
for c in s:
x := x * 58 + indexOf(ALPHABET, c)
return toCanonical256Hex(x) // 0x + 64 hex (lowercase)
tokenId is uint256, U256ID Canonical can be used as
is.Strings.toHexString(tokenId, 32) yields 0x+64hex.uuidToU256 (always verify upper 128 bits = 0).An implementation is considered conformant when all of the following are met:
^0x[0-9a-f]{64}$ (MUST).^0x[0-9a-f]{64}$
^(?:u2:)?[1-9A-HJ-NP-Za-km-z]+$
canonical = "0x" 64HEXDIG-LC
64HEXDIG-LC = 64*64( %x30-39 / %x61-66 ) ; 0-9, a-f
hr = ["u2:"] 1*base58char
base58char = %x31-39 / %x41-48 / %x4A-4E / %x50-5A / %x61-6B / %x6D-7A
; 1-9 A-H J-N P-Z a-k m-z
short = "u2s:" 8HEXDIG-LC "…" 8HEXDIG-LC
8HEXDIG-LC = 8*8( %x30-39 / %x61-66 )
u2:) → normalize to Canonical (MUST).^0x[0-9a-f]{64}$, return INVALID_FORMAT (MUST).INVALID_VALUE (MUST).UNSUPPORTED_VERSION (MUST).INVALID_BASE58 (MUST).0000b, remaining 252 bits random (MUST).T 48‑bit, N 32‑bit, C 16‑bit, R 156‑bit; T non‑decreasing
(SHOULD).DISALLOWED_SHORT (MUST).uuidToU256: produce Canonical with upper 128 bits = 0 (MUST).u256ToUuid: allow only if upper 128 bits = 0; otherwise
UPPER128_NOT_ZERO (MUST).CHAR(66) with CHECK constraint (SHOULD).— Reference: RFC 2119 (interpretation of normative words)
FAQs
U256ID v2 (canonical: 0x + 64 hex; HR: Base58; versions: v0, v1)
We found that u256id demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.