RANK: burn-weighted social votes
Protocol and consensus12.4.15+

RANK: burn-weighted social votes

Burn-weighted votes on social profiles and posts: byte layout, rules, storage and REST routes.

RANK is an OP_RETURN protocol for on-chain reputation. A vote names a platform (Twitter, Nostr, Telegram, poker, local business), a profile on that platform, optionally a post or a display name, and a sentiment (positive or negative). The weight of the vote is the number of satoshis attached to the OP_RETURN output: those sats are unspendable by consensus, so they are burnt. The node decodes votes from bare OP_RETURN outputs (two layouts, "Format A" and "Format B") and from eMPP segments with LOKAD id RANK, keeps a per-vote table plus running per-profile and per-post scores in SQLite, and serves them under /api/v1/social/* and in the dashboard RANK tab. Nothing here is consensus: an invalid RANK payload is simply not indexed.

Status in this node #

ItemValue
Module classCRankModule (src/modules/rank/rank_module.h:118)
Module name (/api/v1/modules)rank, version 1.1.0, schema version 2 (src/modules/rank/rank_module.h:43-44)
EnabledAlways. Registered unconditionally by RegisterBuiltinModules (src/modules/builtin_modules.cpp:32), second after eMPP, which must run first because RANK reads empp_segments in its own ConnectBlock. There is no flag to disable it.
Data file<datadir>/modules/rank.sqlite (src/modules/rank/rank_module.cpp:562, directory from src/modules/module_registry.cpp:196)
Option-rankminburn=<sats> (default 1), defined at src/init.cpp:877. Applies to every vote, native and eMPP, on connect and on rescan (rule 20).
LOKAD id52 41 4e 4b = ASCII RANK (src/modules/rank/rank_module.cpp:35)
MempoolNot indexed. RANK has no mempool hook (only SLP and ALP do, src/modules/builtin_modules.cpp:43-53); a vote appears once its block is connected.

Envelope #

Three transports are accepted. All three need the vote to sit in an output whose script starts with OP_RETURN (0x6a).

TransportScript shapeDecoder
Format A (multi-push, "RankService")OP_RETURN <push "RANK"> OP_0 or OP_1 <push platform byte> <push profile> [<push post id>] [<push display name>]DecodeRankFormatA, src/modules/rank/rank_module.cpp:207
Format B (single push, "SimplifiedVotingService")OP_RETURN <one push: "RANK" + version + fields>DecodeRankFormatB, src/modules/rank/rank_module.cpp:295
eMPPOP_RETURN OP_RESERVED <push "RANK" + Format B body>; see eMPP envelopeDecodeRankPayload, src/modules/rank/rank_module.cpp:418

The names "RankService" and "SimplifiedVotingService" come from the comments in our decoder; they refer to the upstream encoders that produce each format.

The dispatcher DecodeRankOutput (src/modules/rank/rank_module.cpp:375) first tokenises everything after OP_RETURN with a strict push reader, then picks Format A if the first element is a 4-byte push equal to RANK and more elements follow (:396-399), Format B if there is exactly one element longer than 4 bytes starting with RANK (:403-405), and rejects anything else. The eMPP path never goes through DecodeRankOutput: the eMPP module has already split the segment and stripped the 4-byte LOKAD id.

Byte layout #

Format A #

Each row is one script element after OP_RETURN. Pushes must be canonical (see rule 3).

ElementEncodingSizeTypeFieldNotes
004 + 4 bytes4bytesLOKADMust be 52 41 4e 4b
1bare opcode0opcodesentimentOP_0 (0x00) = negative, OP_1 (0x51) = positive. A data push is rejected.
201 + 1 byte1uint8platform idAny value 0..255 accepted; see the platform table
3push N1..Nbytesprofile idEvery 0x00 byte is removed (encoders zero-pad fixed 16-byte slots); empty after removal = reject
4 (optional)08 + 8 bytes8uint64, big-endianpost idStored as its decimal string, e.g. 72623859790382856
4 or 5 (optional)push N1..48UTF-8 bytesdisplay nameNo 0x00 byte allowed

Element-count cases (4 to 6 elements, src/modules/rank/rank_module.cpp:209):

ElementsMeaning
4LOKAD, sentiment, platform, profile
5+ one trailing push: exactly 8 bytes = post id; any other length 1..48 = display name (:256-262). A display name of exactly 8 bytes cannot be expressed in this form: it is read as a post id.
6+ post id (must be 8 bytes) + display name (1..48 bytes) (:263-266)

Format A has no version byte; the decoder sets version = 0x01 (:268).

Format B (single push) #

The whole payload is one canonical push after OP_RETURN. Offsets are inside that push.

OffsetSizeTypeEndiannessFieldNotes
04bytesn/aLOKAD52 41 4e 4b
41uint8n/aversionMust be 0x01
51uint8n/asentiment0x00 negative, 0x01 positive; anything else rejects
61uint8n/aplatform_len (P)Must be 1..255
7PASCIIn/aplatform nameMust equal a name in the platform table exactly (case-sensitive)
7+P1uint8n/aprofile_len (R)
8+PRbytesn/aprofile idMust be non-empty; stored verbatim (no 0x00 stripping, no UTF-8 check)
8+P+R1uint8n/apost_len (S), optionalAbsent or 0 = no post
9+P+RSbytesn/apost idStored verbatim as text
next1uint8n/aname_len (D), optional0 = no name; must be 0..48
nextDUTF-8n/adisplay nameNo 0x00 byte allowed

After the last field present, the payload must end exactly (src/modules/rank/rank_module.cpp:365). The display-name field can only be present if the post_len byte is present (write 00 for "no post").

eMPP body #

Identical to Format B from offset 4: byte 0 is the version, byte 1 the sentiment, then the length-prefixed platform, profile, optional post and optional display name (src/modules/rank/rank_module.cpp:418-483). The LOKAD id is carried by the eMPP segment itself.

Platform ids #

From PLATFORM_NAMES (src/modules/rank/rank_module.cpp:53-72).

IdNameProfile idPost id
0x00unknownfreefree
0x01twitterX/Twitter handletweet id
0x02nostre.g. npubnote id
0x03telegramTelegram handlemessage id
0x04pokerpoker user UUIDpoker event or order UUID; see POKR
0x05localbusinessestablishment id, e.g. sirene-12345678901234unused at present
0x06..0xffplatform_<n>Format A onlyFormat A only

In Format A any platform byte decodes; ids 6 and above are reported as platform_6, platform_7, and so on (:75-78). Format B and eMPP carry the platform as a name and reject unknown names (:328, :445), so they can only express ids 0 to 5. The REST filters platform= and excludePlatform= also accept only the six names (PlatformId, :80-85).

Sentiment #

Format A opcodeFormat B / eMPP byteStored sentimentREST valueEffect on ranking
OP_0 (0x00)0x000negativeminus sats
OP_1 (0x51)0x011positiveplus sats

Validation rules #

Rules as implemented; line numbers are in src/modules/rank/rank_module.cpp unless stated. A failure means the output is ignored by the RANK indexer, nothing more.

Script-level (Format A and B):

  1. The script must be at least 2 bytes and start with OP_RETURN (:376).
  2. Every element after OP_RETURN must parse as a strict push or a small-number opcode; any other opcode rejects the whole output (:384-390, :182).
  3. Canonical pushes only (ReadStrictPush, :115): 1..75 bytes must use the direct opcode (:132-138); OP_PUSHDATA1 must carry 76..255 bytes (:146); OP_PUSHDATA2 256..65535 (:160); OP_PUSHDATA4 at least 65536 (:175). A push longer than the remaining script rejects.
  4. OP_0, OP_1NEGATE and OP_1..OP_16 are read as opcode-only elements with no data (:126-130). Only OP_0/OP_1 in the sentiment slot are meaningful; elsewhere they count as an empty element and make the slot fail.
  5. At least one element after OP_RETURN (:392).

Format A:

  1. 4 to 6 elements (:209).
  2. Element 0 is exactly the 4 bytes RANK (:211-214).
  3. Element 1 is the bare opcode OP_0 or OP_1 (:216-222).
  4. Element 2 is a 1-byte push (:224).
  5. Element 3 is non-empty, and still non-empty after removing every 0x00 byte (:227-232).
  6. A post id is exactly 8 bytes, read big-endian into a uint64 and stored as a decimal string (:246-254).
  7. A display name is 1..48 bytes (RANK_DISPLAY_NAME_MAX_BYTES, src/modules/rank/rank_decoder.h:69) with no 0x00 byte (:238-245).
  8. 5 elements: 8-byte trailer = post id, otherwise display name (:256-262). 6 elements: post id then display name (:263-266).

Format B (DecodeRankFormatB) and eMPP (DecodeRankPayload):

  1. Format B: exactly one element (:297), at least 8 bytes (:300), starting with RANK (:301). eMPP body: at least 4 bytes (:419).
  2. Version byte is 0x01 (:307, eMPP :423).
  3. Sentiment byte is 0x00 or 0x01 (:311, eMPP :427).
  4. Platform length is non-zero, fits in the payload (:316-317), and the name matches a known platform exactly (:321-329; eMPP :432-446).
  5. Profile length fits and the profile is non-empty (:333-336; eMPP :450-454). The post field is optional and must fit if its length is non-zero (:339-346).
  6. Display-name length is at most 48, must fit, and the name has no 0x00 byte (:352-362); no byte may follow the last field (:365; eMPP :481).

Indexing-level:

  1. Minimum burn. -rankminburn (default 1 sat, read once and cached, GetRankMinBurnSats) applies to every vote: ExtractVotesFromBlock, the one extraction used by both ConnectBlock and RescanRange, skips a native or eMPP vote whose output burns less. Before 12.4.6 only the rescan path checked it, so a zero-sat vote connected normally was indexed with weight 0 (rank_module_tests/connect_applies_min_burn_native, connect_applies_min_burn_empp).
  2. Every block is passed to ExtractVotesFromBlock (native outputs decoded by DecodeRankOutput, which rejects a non-OP_RETURN script at its first byte, then the eMPP RANK segments of the height). A block without votes only advances the tip marker.
  3. One vote per output: rank_votes has primary key (txid, vout) and inserts are INSERT OR IGNORE. Aggregates are updated only when the insert created a row (ApplyVotesLocked), on connect and on rescan alike, so reconnecting a block or rescanning an indexed range changes nothing. For eMPP, only the first decodable RANK segment of an output is a vote; it weighs the output value (EmppRow::output_sats, see eMPP).

Indexing #

Tables (CreateSchema, src/modules/rank/rank_module.cpp) #

rank_votes, one row per indexed vote:

ColumnTypeNotes
txidTEXT NOT NULLhex txid
voutINTEGER NOT NULLoutput index
block_heightINTEGER NOT NULL
block_timeINTEGER NOT NULLblock header time (unix seconds)
platformINTEGER NOT NULLplatform id
profile_idTEXT NOT NULL
post_idTEXT NOT NULL DEFAULT '''' = profile vote
sentimentINTEGER NOT NULL1 positive, 0 negative
satsINTEGER NOT NULLvalue of the OP_RETURN output, in sats (eMPP: output_sats of the segment)
sourceTEXT NOT NULL DEFAULT 'native'native or empp (added by migration :691-704)
display_nameTEXT NOT NULL DEFAULT ''as carried by this vote
primary key(txid, vout)

Indexes: idx_rv_profile (platform, profile_id, block_height DESC), idx_rv_post (platform, profile_id, post_id) WHERE post_id != '', idx_rv_time (block_height DESC, vout ASC), idx_rv_platform_time (platform, block_height DESC, vout ASC).

rank_profiles, running score per profile:

ColumnTypeNotes
platform, profile_idINTEGER, TEXTprimary key
rankingINTEGER DEFAULT 0sum of signed sats
votes_positive, votes_negativeINTEGER DEFAULT 0vote counts
last_vote_heightINTEGER DEFAULT 0max height seen
display_nameTEXT DEFAULT ''most recent non-empty name
display_name_heightINTEGER DEFAULT 0height of that name

Indexes: idx_rp_ranking (ranking DESC), idx_rp_sitemap (ranking DESC, platform, profile_id), idx_rp_platform_ranking (platform, ranking DESC, profile_id).

rank_posts: platform, profile_id, post_id (primary key), ranking, votes_positive, votes_negative; indexes idx_rpost_ranking (ranking DESC), idx_rpost_profile_rank (platform, profile_id, ranking DESC).

rank_daily_stats: date (TEXT YYYY-MM-DD, UTC of block time), platform, profile_id (primary key), delta (signed sats that day).

rank_meta: key/value; keys tip_height, tip_hash, last_indexed_height, data_version (2 since 12.4.6).

Ranking formula #

For each newly inserted vote: signed = +sats if positive, -sats if negative (ApplyVotesLocked). Then rank_profiles.ranking += signed, the matching vote counter += 1, last_vote_height = MAX(...); if the vote has a post id, the same deltas go to rank_posts; rank_daily_stats.delta += signed for the block's UTC date. There is no decay or time weighting: ranking is the all-time net burn.

Display name: the profile keeps the incoming non-empty name if the vote's height is greater than or equal to the stored display_name_height. Within one block, the last vote processed wins (native outputs in block order, then eMPP rows ordered by txid, vout, segment); rank_votes rows are inserted in that order, so the rowid records it.

Connect, disconnect, reorgs #

  • ConnectBlock: ExtractVotesFromBlock (native outputs first, then eMPP RANK segments from g_empp_module->SegmentsForBlock, -rankminburn on both), then one SQLite transaction holding the votes, their aggregates and the tip marker (tip_height, tip_hash, last_indexed_height), also for blocks without votes.
  • DisconnectBlock: in one transaction, collects the profiles, posts and daily rows the block's votes touched, deletes the votes, then rebuilds each touched row from the votes that remain (RecomputeProfileLocked, RecomputePostLocked, RecomputeDailyLocked): ranking, counters, last_vote_height = MAX(block_height), and the display name of the highest remaining vote carrying one (ties within a height: highest rowid, i.e. the last indexed); a row left without votes is deleted, a daily row whose votes add up to 0 is kept (as a direct connect keeps it). Connecting N blocks then disconnecting the last K equals connecting Nāˆ’K, on every table (rank_module_tests/connect_disconnect_symmetry_all_depths). Before 12.4.6 a disconnect subtracted the counts but left display_name, display_name_height and last_vote_height of the disconnected block, and deleted every zero-delta daily row of the database.
  • Startup reconciliation (src/modules/module_registry.cpp): if the stored tip is on the active chain and at most 200,000 blocks behind (kGapReindexThreshold, src/modules/module_registry.h:166), the missing blocks are replayed; on a fork or a larger gap, ResetForReindex empties all RANK tables, keeps the schema and replays from genesis.
  • Upgrade (12.4.6). A database written before data version 2 may hold double-counted aggregates (rescans over indexed blocks), 0-sat votes, stale display names after reorgs, and miss the eMPP votes of ranges built by a rescan. At Init, a database with indexed state and no data_version 2 is emptied (ResetForReindex) and its tip set to the genesis block, so the startup reconcile replays the whole chain into it (eMPP first in each block, itself rebuilt in the same walk). Log: RANK: indexed data version 1 < 2: rebuilding the index from the blocks. Tests: rank_module_tests/upgrade_from_v1_rebuilds_from_genesis, feature_module_indexers.py (upgrade phase).
  • Rescan (RescanRange, RPC rescanmodule rank, a background job): reads blocks in chunks of 5,000 with up to 16 threads, extracts with the same ExtractVotesFromBlock as ConnectBlock (eMPP votes, source, -rankminburn) and inserts with InsertExtractedVotes, which updates the aggregates only for votes not indexed yet. Each chunk is written under cs_main and the module mutex, only if its last block is still on the active chain (otherwise the rescan stops, state aborted). last_indexed_height only moves forward, and only if the range starts at or below it + 1. A rescan of an indexed range changes nothing; a rescan over a gap fills it exactly as connecting the blocks would (rank_module_tests/rescan_matches_connect, rescan_twice_equals_once, rescan_partial_range_fills_gap_like_connect). The eMPP rows of the range must be indexed (they are, eMPP connects every block). Before 12.4.6 the rescan added every vote to the aggregates again, never read eMPP and stored every vote as native.

REST API #

All routes are registered by CRankModule::RegisterRoutes (src/modules/rank/rank_module.cpp:1550-1574) through AddModuleRoute (src/api/api_server.cpp:345), which passes no TTL: none of these responses is cached by the API cache. Errors use the standard envelope {"error": "<code>", "message": "...", "status": <http>}. Paths are relative to /api/v1/.

MethodPathParametersResponse
GETsocial/activitypage (1), pageSize (25, max 100), platform, excludePlatform (ignored if platform is set), before=<height>:<vout>{votes:[{txid, firstSeen, platform, profileId, sentiment, sats, postId, source, displayName}], numPages, nextCursor?}
GETsocial/profilespage (1), pageSize (25, max 200), platform, after=<ranking>:<profileId>{profiles:[{platform, id, ranking, votesPositive, votesNegative, displayName}], numPages, nextCursor?}
GETsocial/searchq (required, at most 64 bytes), platform, limit (25, max 100){query, platform?, profiles:[same as above], numResults}
GETsocial/{platform}/{profileId}none{platform, id, ranking, votesPositive, votesNegative, displayName}; zeros and "" when unknown
GETsocial/{platform}/{profileId}/postspage, pageSize (10, max 100){posts:[{id, ranking, votesPositive, votesNegative}], numPages}
GETsocial/{platform}/{profileId}/votespage, pageSize (10, max 100){votes:[{txid, timestamp, sentiment, sats, post:{id}, source}], numPages}
GETsocial/{platform}/{profileId}/post/{postId}page, pageSize (25, max 100){summary:{platform, profileId, postId, ranking, votesPositive, votesNegative}, votes:[{txid, timestamp, sentiment, sats, source}], numPages, totalVotes}
GETsocial/stats/{profiles or posts}/{top or bottom}none (top-ranked and lowest-ranked are aliases)Array of 10: profiles {platform, profileId, ranking, displayName}, posts {platform, profileId, postId, ranking}
GETsocial/tx/{txid}none{txid, voteCount, totalSats, votes:[{vout, platform, profileId, sentiment, sats, postId, blockHeight, blockTime}]}
GETsocial/block/{height}/summarynone{height, voteCount, positive, negative, totalBurnSats}
GET or POSTsocial/rescannone403 rescan_moved. A rescan is an operator action on the authenticated RPC: rescanmodule rank [start] [end] (see module rescans).

Notes on the responses:

  • sentiment is the string positive or negative; platform is the name (platform_<n> for ids 6 and above).
  • In social/activity, firstSeen is the block time, not a mempool time. displayName is the vote's own name, or the profile's current name if the vote carried none (:1728). numPages is always 1 in cursor mode (no COUNT is run). nextCursor is returned in both modes whenever another page exists.
  • Unknown platform/excludePlatform names answer 400 invalid_platform; bad cursors 400 invalid_cursor; q missing 400 missing_query, too long 400 query_too_long.
  • social/search matches profile_id or display_name with LIKE '%q%', with %, _ and \ escaped (:1973-1982); SQLite LIKE is case-insensitive for ASCII only.
  • social/{platform}/... with an unknown platform name does not return 404: the lookup uses id -1 and returns an empty profile with HTTP 200.
  • The stats endpoints sort rank_profiles/rank_posts by all-time ranking; rank_daily_stats is written but not read by any endpoint.
  • social/rescan answers 403 rescan_moved since 12.4.6. Every handler runs holding the module mutex.
  • doc/api-v1.md lists a GET /api/v1/social/<address> route ("RANK score for an address"); no such route exists in the code, social/<x>/<y> is the profile route above.
  • OpenAPI entries for these routes are in src/api/openapi_handler.cpp:815-1001, schemas at :1432-1643.

Search and handles #

The dashboard search box (doSearch, share/www/dashboard/js/dashboard.js:348) resolves handles client-side, in this order:

InputRegexGoes to
@name^@([A-Za-z0-9_]{1,32})$/dashboard/social/twitter/name
business:id, biz:id, localbusiness:id^(?:business or biz or localbusiness):(.+)$, case-insensitive/dashboard/social/localbusiness/id
platform:handleplatform in twitter, nostr, telegram, poker, localbusiness, unknown, case-insensitive/dashboard/social/<platform>/<handle> (so nostr:npub1... opens a Nostr profile)
digits^\d+$block
64 hextransaction
anything elseaddress

Handles are not checked against the index before navigating: an unknown profile opens a profile page with zero votes. Light wallets use GET /api/v1/social/search for substring search instead.

Dashboard #

  • Nav tab RANK (data-tab="social", share/www/dashboard/index.html:30), shown only if /api/v1/modules reports rank loaded.
  • Sub-tabs: Hub, Activity, Trending, Profiles; routes /dashboard/social, /dashboard/social/activity, /dashboard/social/trending, /dashboard/social/profiles.
  • Detail routes: /dashboard/social/{platform}/{profileId} (profile, posts, votes), /dashboard/social/{platform}/{profileId}/post/{postId}, /dashboard/socialtx/{txid} (RANK summary of one transaction). The transaction page also calls social/tx/{txid} to show the votes it contains.
  • SEO: HandleGetDashboard injects per-route title, description, canonical URL, OpenGraph and JSON-LD (src/api/dashboard_handler.cpp:477-600). For profile and post pages it reads rank.sqlite directly (LookupRankProfile, LookupRankPost) to put the score and the display name in the metadata; localbusiness profiles get a French description and a cross-link to https://domesticus.fr/etab/<profileId>, Twitter and Telegram profiles a link to x.com / t.me. Its platform map (SeoPlatformId, src/api/dashboard_handler.cpp:93-100) must match PLATFORM_NAMES.
  • Sitemap: /dashboard/social* hub pages plus profile shards ordered by ranking (src/api/sitemap_handler.cpp:315), read from rank.sqlite.

Limits and edge cases #

  • Display name: at most 48 bytes, byte limit only (no UTF-8 validation in the decoder; encoders are expected to cut on a codepoint boundary).
  • Profile and post ids have no length cap beyond the push and the 1-byte length fields of Format B (255 bytes each). The after cursor of social/profiles refuses profile ids over 520 bytes.
  • Format A strips every 0x00 byte from the profile id, not only trailing padding: a\0b is indexed as ab.
  • Format A cannot carry an 8-byte display name without a post id (read as a post id). Format A post ids are numbers; Format B and eMPP post ids are free text.
  • Platform ids 6..255 exist only through Format A and cannot be used in REST filters.
  • eMPP: the vote weight is the value of the whole OP_RETURN output. If one eMPP output carries several RANK segments, they all share (txid, vout), so only the first decodable one is indexed; the others are silently dropped by INSERT OR IGNORE.
  • Several RANK outputs in one transaction are all indexed (one row per vout).
  • Votes below -rankminburn (default: zero-sat votes) are not indexed (rule 20).

Differences from upstream #

Unverified: the upstream RANK specification (LotusiaStewardship rank-lib / lotus-lib, RankService) was not available offline and was not read. What our code says about itself:

  • The decoder comments state that strict canonical pushes and the hard rejection of unknown Format B platform names are our additions: unknown names used to map silently to unknown (src/modules/rank/rank_module.cpp:288-293).
  • The display-name field (Format A trailing push, Format B/eMPP length-prefixed field), platform ids poker (0x04) and localbusiness (0x05), and the eMPP transport are fork features (listed in doc/FORK.md).
  • doc/pokr.md mentions a -rankmaxburn option; no such option exists in this tree, only -rankminburn.

Worked example #

Unverified: no mainnet transaction is decoded here. The only production source allowed for this document (https://lotus-127.givelotus.org/api/v1/...) answered every request on 2026-11-14 with HTTP 503 node_warming_up ("Rebuilding module indices from genesis"). The two examples below are built with the same encoders as src/test/rank_decoder_tests.cpp (tests format_b_with_post_and_display_name and format_a_with_post_decodes_uint64) and decode as shown under the rules above.

Format B, local business with a display name #

Script (61 bytes):

Text
6a3b52414e4b01010d6c6f63616c627573696e65737315736972656e652d3132333435363738393031323334000f4c6520546f6e6e6561752064274f72
BytesFieldValue
6aOP_RETURN
3bdirect push59 bytes
52414e4bLOKADRANK
01version1
01sentimentpositive
0dplatform_len13
6c6f63616c627573696e657373platformlocalbusiness (id 5)
15profile_len21
736972656e652d3132333435363738393031323334profile idsirene-12345678901234
00post_lenno post
0fname_len15
4c6520546f6e6e6561752064274f72display nameLe Tonneau d'Or

If this output carries 1,000,000 sats, the node adds a rank_votes row (source = native, sentiment = 1, sats = 1000000), adds 1,000,000 to rank_profiles.ranking for (5, sirene-12345678901234), increments votes_positive, and sets display_name to Le Tonneau d'Or. GET /api/v1/social/localbusiness/sirene-12345678901234 then returns {"platform":"localbusiness","id":"sirene-12345678901234","ranking":1000000,"votesPositive":1,"votesNegative":0,"displayName":"Le Tonneau d'Or"} (for a profile with no earlier votes).

Format A, Twitter profile with a post id #

Text
6a0452414e4b51010105616c696365080102030405060708
BytesElementValue
6aOP_RETURN
04 52414e4b0, LOKADRANK
511, sentimentOP_1 = positive
01 012, platform0x01 = twitter
05 616c6963653, profilealice
08 01020304050607084, post idbig-endian uint64 = 72623859790382856

The vote is stored with post_id = "72623859790382856" and also updates rank_posts for (1, alice, 72623859790382856); it appears at /dashboard/social/twitter/alice/post/72623859790382856.

Source files #

  • src/modules/rank/rank_module.cpp: decoders (Format A, B, eMPP), schema, connect/disconnect, rescan, REST handlers
  • src/modules/rank/rank_module.h: module class, schema version, handler docs
  • src/modules/rank/rank_decoder.h: RankVote, RANK_DISPLAY_NAME_MAX_BYTES, decoder declarations
  • src/modules/builtin_modules.cpp: registration order (eMPP before RANK)
  • src/modules/module_registry.cpp, src/modules/module_registry.h: init, reconciliation, gap replay
  • src/modules/empp/empp_module.cpp: SegmentsForBlock, source of eMPP-wrapped votes
  • src/init.cpp: -rankminburn
  • src/api/dashboard_handler.cpp: SEO lookups in rank.sqlite
  • src/api/sitemap_handler.cpp: profile sitemaps
  • src/api/openapi_handler.cpp: OpenAPI entries for /social/*
  • share/www/dashboard/js/dashboard.js: search resolver (doSearch), RANK tab
  • src/test/rank_decoder_tests.cpp: decoder unit tests
Source doc/protocols/rank.md in the lotusd repository