Entity: RANK votes on anything, and the ENTY key registry
Votes on anything named by a canonical key: keys, entity ids, the ENTY registry and the node's entity REST routes.
An entity is anything people can rank (a place, a business, a person with a Wikidata item, a website, a product, a collection) named by a canonical key such as wd:Q243 or fr-siret:73282932000074. This page extends RANK and uses its vocabulary: an entity is a RANK platform, entity (id 6), whose profile id is the entity id (eid) derived from the key. Votes on entities are plain RANK votes, indexed, summed and scored exactly like votes on a Twitter profile. The only new on-chain element is the ENTY registry segment, which publishes the key behind an eid so that indexers and pages can show it and check it. Nothing here is consensus: an invalid vote or record is not indexed, never rejected.
Status: implemented in lotusd 12.5.9 (the RANK module indexes entities, RANK data version 4). This page is the ruleset 1 specification. It is frozen with that release: after it ships, a change is a new ENTY version or a new ruleset with an activation height, never an edit of this page. The machine-readable vectors are src/test/data/entity_vectors.json, generated by contrib/rank/gen_rank_vectors.py, which is the executable form of this page. The C++ indexer and the shared JS encoder (share/www/shared/rank/) are both tested against that file. The score shown for entities is the RANK score of every platform, score_v1.
1. Summary #
| Item | Value |
|---|---|
| Votes | RANK, platform entity = 0x06, profile id = eid (26 ASCII bytes), optional post id = collection id; see RANK byte layout |
| Registry | eMPP segment, LOKAD ENTY = 45 4e 54 59, version 0x01, record type 0x01 REG (the only type of ruleset 1) |
| Entity id | eid = base32lower(SHA-256("lotus-entity-v1" ‖ 0x00 ‖ key)[0..16]), 26 characters |
| Collection id | cid = first 8 bytes of the same SHA-256 of a coll: key, big-endian uint64 |
| Ruleset-1 schemes | wd, fr-siret, fr-siren, dns, coll |
| Index | rank.sqlite (the RANK module): votes in the existing RANK tables, registrations in entity tables of the same database, same tip history, rollback and rescan |
| Score | score_v1, the same for every platform |
2. Entity id and collection id #
key = scheme ":" value ; normal form (section 3), ASCII, 1..200 bytes
digest = SHA-256( "lotus-entity-v1" || 0x00 || key )
eid = base32lower( digest[0..16] ) ; RFC 4648 alphabet a-z 2-7, no padding, 26 chars
cid = uint64_be( digest[0..8] ) ; only meaningful for coll: keys"lotus-entity-v1"is the 15 ASCII bytes of that string, followed by one zero byte, then the key bytes. No length prefix.- 16 bytes are 128 bits; base32 writes 26 characters, the last carrying 3 padding bits that are always zero. A canonical eid therefore matches
[a-z2-7]{25}[aeimquy4]. Wherever an eid is parsed from text (thecoll:key, pool payee strings), a non-canonical one is invalid. - Nobody owns an eid. Anyone can compute it offline from the key, so there is nothing to squat or front-run: every valid registration of a key is identical.
- The eid is used as the RANK profile id verbatim (26 bytes, no zero padding). Format A strips 0x00 bytes from profile ids; an eid contains none.
Examples (all in the vectors file):
| Key | eid | cid |
|---|---|---|
wd:Q243 | 35wicsrcclf4w33gvcrhn2k64i | |
wd:Q90 | awcgivxwvgt2bwvxj3k7g3mjlq | |
fr-siret:73282932000074 | ygb3sggbc33laaqhji4bzxfwke | |
fr-siren:732829320 | p5fi2xzl7aweqg7qgd4ni25dtm | |
dns:example.com | 2wdfizeo7qbypvkv6lp25a4p74 | |
coll:raq4r7uz4jkkjjvzevcrbcggxm:softness | keksbdzslth77hjpktnhws5jgm | 5842611890980442111 |
3. Canonical keys (ruleset 1) #
A key is valid only in its normal form. An indexer never normalises a key it reads from the chain: it checks it, and ignores the record if the check fails. Clients normalise user input (trim, case, separators) before building a record. Grammar:
key = scheme ":" value
scheme = "wd" / "fr-siret" / "fr-siren" / "dns" / "coll" ; case-sensitiveCommon rules: the whole key is 1..200 bytes of printable ASCII (0x21..0x7e, so no space and no UTF-8); the first : separates the scheme; an unknown scheme is invalid (and stays invalid for ever, it is never reinterpreted by a later ruleset).
| Scheme | Value | Check | Examples |
|---|---|---|---|
wd | Q[1-9][0-9]{0,18} (Wikidata item, no leading zero, at most 19 digits) | syntax | wd:Q243 valid; wd:Q0243, wd:q243, wd:Q0 invalid |
fr-siret | 14 digits | Luhn over the 14 digits; exception: a value starting with 356000000 (La Poste establishments) is valid when the sum of its digits is a multiple of 5 | fr-siret:73282932000074 valid; …75 invalid |
fr-siren | 9 digits | Luhn | fr-siren:732829320, fr-siren:356000000 |
dns | 2 or more labels separated by .; each label [a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?; value at most 253 bytes; the last label not all digits; no trailing dot | syntax only (internationalised names in their xn-- A-label form; no Public Suffix List check in ruleset 1, so subdomains are valid keys) | dns:example.com, dns:xn--caf-dma.fr; dns:Example.com, dns:example.com., dns:192.168.1.1 invalid |
coll | <eid>:<criterion>: a canonical eid (the category), :, then a criterion matching [a-z0-9]+(-[a-z0-9]+)*, 1..64 bytes | syntax; the category eid does not have to be registered | coll:raq4r7uz4jkkjjvzevcrbcggxm:softness |
Reason codes used by the vectors (key_rejects[].reason): scheme (missing or unknown scheme), syntax, check_digit, too_long (over 200 bytes).
Schemes of later rulesets (gtin, isbn, lei, doi, mbid, isni, orcid, account schemes, osm/gers alias-only, free) are invalid in ruleset 1.
Legacy rule (localbusiness). A RANK vote on platform 5 (localbusiness) whose profile id is exactly sirene- followed by 14 digits forming a valid SIRET belongs to the same entity as fr-siret:<those digits>: the votes of (5, sirene-<siret>) and (6, eid(fr-siret:<siret>)) are summed for that entity's page and score. Nothing is written on-chain for this and no vote is re-issued. Any other platform-5 profile id (wrong case, wrong length, bad check digit, extra characters) is not mapped. Vectors: legacy.
4. Kinds and the person rule #
A registration carries one kind byte:
| Value | Kind | Value | Kind |
|---|---|---|---|
| 0 | other | 6 | work |
| 1 | person | 7 | event |
| 2 | place | 8 | idea |
| 3 | organisation | 9 | category |
| 4 | brand | 10 | collection |
| 5 | product | 11..255 | invalid |
Allowed combinations (ruleset 1):
collection(10) only with acoll:key, and acoll:key only withcollection.- Person rule:
person(1) only with awdkey or adnskey (a self-claimed page). Any other combination is invalid for every indexer. category(9) only with awdkey.- Every other kind with every other scheme.
The result per scheme is the vectors' kinds_by_scheme: wd 0..9, fr-siret and fr-siren 0, 2..8, dns 0..8, coll 10.
5. ENTY segment (frozen in ruleset 1) #
ENTY exists because RANK has no field that can publish a key: an indexer must learn the key behind an eid to show and check it. Every other part of the product reuses RANK.
eMPP output : OP_RETURN OP_RESERVED <push seg 1> ... <push seg n> (see eMPP)
ENTY segment: "ENTY" (45 4e 54 59) | version u8 | type u8 | body| Offset in segment | Size | Field | Rule |
|---|---|---|---|
| 0 | 4 | LOKAD | 45 4e 54 59 |
| 4 | 1 | version | must be 0x01; any other value: segment ignored |
| 5 | 1 | type | 0x01 REG in ruleset 1; 0x02..0x0b are ruleset-2 types (ALIAS, UNALIAS, LINK, BACK, CHALLENGE, CLAIM, FLAG, PROFILE, reserved 0x0a, UNLINK), ignored for ever when mined before the ruleset-2 activation height; every other value is reserved and ignored for ever |
| 6 | var | body | per type |
REG (type 0x01) #
| Offset in segment | Size | Type | Field | Rule |
|---|---|---|---|---|
| 6 | 1 | uint8 | key_len (N) | 1..200 |
| 7 | N | ASCII | key | normal form for a ruleset-1 scheme (section 3) |
| 7+N | 1 | uint8 | kind | 0..10 and allowed for the scheme (section 4) |
The segment must end exactly after the kind byte. Total size of a REG segment: 8 + N bytes.
Example, REG wd:Q243 kind 2 (place) as a standalone output (17 bytes of script):
6a 50 0f 454e5459 01 01 07 77643a51323433 02| Bytes | Field |
|---|---|
6a 50 | OP_RETURN OP_RESERVED (eMPP) |
0f | push of 15 bytes |
454e5459 | ENTY |
01 01 | version 1, type REG |
07 77643a51323433 | key_len 7, wd:Q243 |
02 | kind place |
Decode failure reasons used by the vectors (enty_records[].reason): short, version, type_not_in_ruleset, key_len, trailing, key:<key reason>, kind (11..255), kind_for_scheme.
Rules (ruleset 1) #
- Transport.
ENTYexists only inside eMPP (OP_RETURN OP_RESERVED), in any output of any transaction, the coinbase included. There is no bareOP_RETURN "ENTY"form. EveryENTYsegment of an output is read (unlike RANK, where only the first decodableRANKsegment of an output is a vote). - Validity is a property of the segment alone (sections 3 to 5) plus the collision rules (rule 5). It never depends on the order of blocks other than for "first registration".
- Stake carried. An output carries a vote when it has a
RANKsegment that decodes as a vote (RANK rules 14 to 19, the first decodableRANKsegment of the output) and its value is at least 1 sat. This test is fixed by the ruleset: it does not follow the node's-rankminburnoption, so every indexer agrees on the registry whatever its local vote threshold (a vote filtered out by a higher-rankminburnstill carries the REGs of its output). In an output that carries a vote, the value is that vote's weight (RANK rule 22) and the REG segments carry no stake: they are valid whatever the value ("register and vote" in one output, the normal wallet path). Any other output must burn at leastREG_MIN_BURNsats, or its REG segments are ignored. A zero-value output with aRANKand a REG segment therefore registers nothing (vectors:outputs). - Order and idempotence. Valid REGs are taken in the order (
block_height,txidas lower-case hex,vout, segment index in the output), ascending: within a block the lowest txid comes first, whatever the transaction's position in the block (the coinbase included). This order is derivable from the eMPP rows alone, so an index can be rebuilt from them. The first valid REG of a key registers it: it sets the entity'skind,first_heightandfirst_txid. A later valid REG of the same key with the same kind incrementsreg_count; one with a different kind is valid but changes nothing (not counted, the first kind stays). - Collisions. A REG of a key whose eid is already registered for a different key (a 2^-64 event) is not registered. A REG of a
coll:key whose cid is already held by a different registeredcoll:key is not registered either. "Already" follows the order of rule 4. - Unregistered entities. Votes on an eid count whether or not a REG for it exists. A page can show an unregistered eid; front ends do not list unregistered entities in rankings.
- Reorgs. A disconnected block's registrations are removed exactly; the next valid REG of that key becomes the first.
Where the records go #
Placement relative to tokens is unchanged from RANK: SLP data stays at vout 0; ALP's eMPP output stays at vout 0 with value 0. RANK and ENTY outputs go after the last token-receiving output and never share an output with BLOB, POKR, POOL or SLP2 segments. The canonical encoder puts the RANK segment first and the ENTY segment(s) after it in the same output; an indexer accepts any segment order.
6. Votes on entities #
Votes are RANK votes on platform entity (0x06); see RANK byte layout for every field. display_name is never written by the encoder on platform entity, and indexers ignore it there (anyone could overwrite it).
| Form | Script | Size |
|---|---|---|
| Format A | 6a 04 52414e4b 51|00 01 06 1a <eid 26 bytes> | 36 bytes |
| Format A in a collection | as above + 08 <cid, 8 bytes big-endian> | 45 bytes |
| eMPP | 6a 50 <push: 52414e4b 01 <sent> 06 656e74697479 1a <eid> 00> | 44 bytes |
| eMPP in a collection | … 1a <eid> <len> <cid as decimal ASCII> | 45..64 bytes |
| Format B | 6a <push: 52414e4b 01 <sent> 06 656e74697479 1a <eid> 00> | 43 bytes |
- Collection post id. Format A carries the cid as 8 bytes big-endian, which the RANK indexer stores as its decimal string (e.g.
5842611890980442111). Format B and eMPP carry post ids as text, stored verbatim, so a vote inside a collection carries the decimal string of the cid, without leading zeros. Both forms then give the same storedpost_id. A raw 8-byte post in Format B or eMPP would be stored as those bytes and would not match. - Canonical encoder form. Format B and eMPP bodies always include the post-length byte (
00when there is no post), as the wallet's encoder already does for every platform. - Weight. The value of the output, at least
-rankminburn. One vote per output. - Multi-target. A transaction may carry several vote outputs, each with its own value. Before Napoleon (2026-12-21) at most 3 OP_RETURN outputs per transaction are standard and allowed in blocks; from Napoleon, as many as fit (see RANK, several votes per transaction and
opreturn_uncap_tests). Coinbase outputs vote the same way, under the same activation rule. - Node versions. Format A on byte 6 decodes on every node (reported as
platform_6before 12.5.9,entityfrom 12.5.9). Format B and eMPP votes namingentityare rejected by nodes older than 12.5.9: clients build them only once the node reports the platform.
7. Pool payees (D3, informative) #
The pool protocol owns the final payee rules and the MAX_PAYOUT_SCRIPT limit (today 40 bytes in src/pool/messages.h, being raised to at least 48). The shared encoder builds every vote or stake payee script through one function and asserts its length against MAX_PAYOUT_SCRIPT_RANK3 (48 in the vectors), so a change of limit is one constant.
| Authorise string | Script | Size |
|---|---|---|
v1:<eid>:+ / v1:<eid>:- | Format A entity vote | 36 |
v1:<eid>:+:<cid> | Format A entity vote in a collection (cid decimal, no leading zeros, < 2^64) | 45 |
s1:<txid>:<vout>:back / …:challenge | Draft, ruleset 2 (R3-30): eMPP ENTY 0x05 BACK / 0x06 CHALLENGE, body = txid (32 bytes, internal byte order) + vout (uint16 little-endian) | 43 |
8. Constants #
| Name | Value | Status |
|---|---|---|
ENTITY_DOMAIN | lotus-entity-v1 | frozen |
ENTY_VERSION | 0x01 | frozen |
KEY_MAX_BYTES | 200 | frozen |
REG_MIN_BURN | 1,000 sats | OD8 open, architect's recommendation |
MAX_PAYOUT_SCRIPT_RANK3 | 48 | pool protocol owner, at least 48 |
platform id of entity | 6 | frozen |
9. Vectors #
src/test/data/entity_vectors.json sections:
| Section | Content |
|---|---|
constants | everything in section 8, platform names, kinds, schemes |
keys | valid keys with SHA-256, eid, and cid for coll: keys (includes the spike's vectors unchanged) |
key_rejects | invalid keys with their reason code |
kinds_by_scheme | section 4 |
legacy | platform-5 profile ids and their entity, or null |
enty_records | ENTY segments and standalone eMPP scripts, valid with key/kind/eid or invalid with a reason |
outputs | whole outputs with a value: register-and-vote, segment order, REG_MIN_BURN boundary, several REGs, vote plus invalid REG |
votes | vote scripts for every platform with their decoded fields; the twitter, nostr and localbusiness entries pin today's wallet encoding byte for byte |
payees | authorise strings and their payee scripts, valid and invalid |
Regenerate with python3 -I contrib/rank/gen_rank_vectors.py; --check fails if the committed files differ.
10. Node REST (informative, lotusd 12.5.9) #
Not part of the frozen ruleset: how a lotusd node serves what this page defines. Routes under /api/v1/ (details and shapes: rank.md, Entities; OpenAPI at /api/v1/openapi.json):
| Route | Answer |
|---|---|
GET entity/ruleset | ruleset, constants, schemes, kinds |
GET entity/{eid} | key, kind, first REG, class members, totals, score (score_v1), display, wikidata (wd keys with a loaded snapshot) |
GET entity/by-key?key= | the same for eid(key); 400 for a key not in normal form |
GET entity/search?q= | exact eid / key / legacy id, key substrings, snapshot labels |
GET entity/{eid}/votes, /history, /window | votes (keyset cursor), REG records, daily sums |
POST entity/batch | {"eids": [...]}, at most 100: one item per eid |
GET social/entity/post/{cid}/leaders | the entities of a collection, ranked |
display applies the mechanical display rules of doc/research/RANK3-2026-11-revival.md section 5.1 (a person is listed when registered on a wd key whose integrity-checked Wikidata record says human) under the node's policy. Facts about an item are Wikidata's (factsSource: correct them on Wikidata). Nothing indexed, and no vote's weight, depends on them. Unregistered eids keep their votes but are left out of lists (display.reason = unregistered).
