jonnify·bcs /bcs/elixir-core/the-champ-database/the-placement-hash

B2.3.2 · dive 2 of 3 · module B2.3

The contract hash is the placement.

A key’s position is decided by one function, BrandedId.hash32 — the same hash that answers placement(USR0KHTOWnGLuC) = 234878118. The same placement holds across Elixir, native, Go, and Node.

One hash from one source slices into 5-bit fragments and places the key identically everywhere. Select a part.
USR0KHTOWnGLuCBrandedId.hash32one source234878118 32-bit hash → 5-bit fragments32-way branching, depth 0 to 6 Elixir CHAMPnative tablesa Go or Node consumersame placement everywhere
readout · Select a part. hash32 from a single source decides a key’s position (placement USR0KHTOWnGLuC = 234878118); 5-bit fragments give 32-way branching; the placement is identical across runtimes.
§1

The idea

echo_data · branded_champ.ex, champ_node.ex

EchoData.BrandedChamp is a forest — one trie per namespace, dispatched on the three-byte prefix — and the position of a key within a trie is decided by one function: EchoData.BrandedId.hash32. The same hash that answers placement(USR0KHTOWnGLuC) = 234878118 places the key in the trie, and the node code computes it from a single source, never defining its own.

One hash from one source is what lets placement be a contract rather than an implementation detail. The same hash32 positions a key here, in the BEAM’s native tables, and in any Go or Node consumer reading the structure, so the tree shape is identical across runtimes. That is the reason to reach for CHAMP over the default map: when the in-trie placement itself is part of the contract, or when the shape must be instrumented, persisted, or mirrored.

Codemojex spans runtimes, so this matters. A PLR or ROM id lands in the same slot whether the Elixir room, a Go worker, or a Node view computes it; a structure mirrored from one to another agrees without a translation step. Placement is fixed by the id and the contract hash, not by which language happens to hold the map.

§4

The doors

the sibling courses
§2

References

sources · related

Sources

Related