Entity: RANK votes on anything, and the ENTY key registry
Protocol and consensus12.5.9+

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 #

ItemValue
VotesRANK, platform entity = 0x06, profile id = eid (26 ASCII bytes), optional post id = collection id; see RANK byte layout
RegistryeMPP segment, LOKAD ENTY = 45 4e 54 59, version 0x01, record type 0x01 REG (the only type of ruleset 1)
Entity ideid = base32lower(SHA-256("lotus-entity-v1" ‖ 0x00 ‖ key)[0..16]), 26 characters
Collection idcid = first 8 bytes of the same SHA-256 of a coll: key, big-endian uint64
Ruleset-1 schemeswd, fr-siret, fr-siren, dns, coll
Indexrank.sqlite (the RANK module): votes in the existing RANK tables, registrations in entity tables of the same database, same tip history, rollback and rescan
Scorescore_v1, the same for every platform

2. Entity id and collection id #

Text
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 (the coll: 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):

Keyeidcid
wd:Q24335wicsrcclf4w33gvcrhn2k64i
wd:Q90awcgivxwvgt2bwvxj3k7g3mjlq
fr-siret:73282932000074ygb3sggbc33laaqhji4bzxfwke
fr-siren:732829320p5fi2xzl7aweqg7qgd4ni25dtm
dns:example.com2wdfizeo7qbypvkv6lp25a4p74
coll:raq4r7uz4jkkjjvzevcrbcggxm:softnesskeksbdzslth77hjpktnhws5jgm5842611890980442111

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:

Text
key        = scheme ":" value
scheme     = "wd" / "fr-siret" / "fr-siren" / "dns" / "coll"      ; case-sensitive

Common 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).

SchemeValueCheckExamples
wdQ[1-9][0-9]{0,18} (Wikidata item, no leading zero, at most 19 digits)syntaxwd:Q243 valid; wd:Q0243, wd:q243, wd:Q0 invalid
fr-siret14 digitsLuhn 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 5fr-siret:73282932000074 valid; …75 invalid
fr-siren9 digitsLuhnfr-siren:732829320, fr-siren:356000000
dns2 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 dotsyntax 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 bytessyntax; the category eid does not have to be registeredcoll: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:

ValueKindValueKind
0other6work
1person7event
2place8idea
3organisation9category
4brand10collection
5product11..255invalid

Allowed combinations (ruleset 1):

  • collection (10) only with a coll: key, and a coll: key only with collection.
  • Person rule: person (1) only with a wd key or a dns key (a self-claimed page). Any other combination is invalid for every indexer.
  • category (9) only with a wd key.
  • 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.

Text
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 segmentSizeFieldRule
04LOKAD45 4e 54 59
41versionmust be 0x01; any other value: segment ignored
51type0x01 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
6varbodyper type

REG (type 0x01) #

Offset in segmentSizeTypeFieldRule
61uint8key_len (N)1..200
7NASCIIkeynormal form for a ruleset-1 scheme (section 3)
7+N1uint8kind0..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):

Text
6a 50 0f 454e5459 01 01 07 77643a51323433 02
BytesField
6a 50OP_RETURN OP_RESERVED (eMPP)
0fpush of 15 bytes
454e5459ENTY
01 01version 1, type REG
07 77643a51323433key_len 7, wd:Q243
02kind 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) #

  1. Transport. ENTY exists only inside eMPP (OP_RETURN OP_RESERVED), in any output of any transaction, the coinbase included. There is no bare OP_RETURN "ENTY" form. Every ENTY segment of an output is read (unlike RANK, where only the first decodable RANK segment of an output is a vote).
  2. 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".
  3. Stake carried. An output carries a vote when it has a RANK segment that decodes as a vote (RANK rules 14 to 19, the first decodable RANK segment 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 -rankminburn option, so every indexer agrees on the registry whatever its local vote threshold (a vote filtered out by a higher -rankminburn still 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 least REG_MIN_BURN sats, or its REG segments are ignored. A zero-value output with a RANK and a REG segment therefore registers nothing (vectors: outputs).
  4. Order and idempotence. Valid REGs are taken in the order (block_height, txid as 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's kind, first_height and first_txid. A later valid REG of the same key with the same kind increments reg_count; one with a different kind is valid but changes nothing (not counted, the first kind stays).
  5. 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 registered coll: key is not registered either. "Already" follows the order of rule 4.
  6. 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.
  7. 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).

FormScriptSize
Format A6a 04 52414e4b 51|00 01 06 1a <eid 26 bytes>36 bytes
Format A in a collectionas above + 08 <cid, 8 bytes big-endian>45 bytes
eMPP6a 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 B6a <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 stored post_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 (00 when 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_6 before 12.5.9, entity from 12.5.9). Format B and eMPP votes naming entity are 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 stringScriptSize
v1:<eid>:+ / v1:<eid>:-Format A entity vote36
v1:<eid>:+:<cid>Format A entity vote in a collection (cid decimal, no leading zeros, < 2^64)45
s1:<txid>:<vout>:back / …:challengeDraft, ruleset 2 (R3-30): eMPP ENTY 0x05 BACK / 0x06 CHALLENGE, body = txid (32 bytes, internal byte order) + vout (uint16 little-endian)43

8. Constants #

NameValueStatus
ENTITY_DOMAINlotus-entity-v1frozen
ENTY_VERSION0x01frozen
KEY_MAX_BYTES200frozen
REG_MIN_BURN1,000 satsOD8 open, architect's recommendation
MAX_PAYOUT_SCRIPT_RANK348pool protocol owner, at least 48
platform id of entity6frozen

9. Vectors #

src/test/data/entity_vectors.json sections:

SectionContent
constantseverything in section 8, platform names, kinds, schemes
keysvalid keys with SHA-256, eid, and cid for coll: keys (includes the spike's vectors unchanged)
key_rejectsinvalid keys with their reason code
kinds_by_schemesection 4
legacyplatform-5 profile ids and their entity, or null
enty_recordsENTY segments and standalone eMPP scripts, valid with key/kind/eid or invalid with a reason
outputswhole outputs with a value: register-and-vote, segment order, REG_MIN_BURN boundary, several REGs, vote plus invalid REG
votesvote scripts for every platform with their decoded fields; the twitter, nostr and localbusiness entries pin today's wallet encoding byte for byte
payeesauthorise 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):

RouteAnswer
GET entity/rulesetruleset, 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, /windowvotes (keyset cursor), REG records, daily sums
POST entity/batch{"eids": [...]}, at most 100: one item per eid
GET social/entity/post/{cid}/leadersthe 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).

Source doc/protocols/entity.md in the lotusd repository