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 #
| Item | Value |
|---|---|
| Module class | CRankModule (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) |
| Enabled | Always. 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 id | 52 41 4e 4b = ASCII RANK (src/modules/rank/rank_module.cpp:35) |
| Mempool | Not 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).
| Transport | Script shape | Decoder |
|---|---|---|
| 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 |
| eMPP | OP_RETURN OP_RESERVED <push "RANK" + Format B body>; see eMPP envelope | DecodeRankPayload, 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).
| Element | Encoding | Size | Type | Field | Notes |
|---|---|---|---|---|---|
| 0 | 04 + 4 bytes | 4 | bytes | LOKAD | Must be 52 41 4e 4b |
| 1 | bare opcode | 0 | opcode | sentiment | OP_0 (0x00) = negative, OP_1 (0x51) = positive. A data push is rejected. |
| 2 | 01 + 1 byte | 1 | uint8 | platform id | Any value 0..255 accepted; see the platform table |
| 3 | push N | 1..N | bytes | profile id | Every 0x00 byte is removed (encoders zero-pad fixed 16-byte slots); empty after removal = reject |
| 4 (optional) | 08 + 8 bytes | 8 | uint64, big-endian | post id | Stored as its decimal string, e.g. 72623859790382856 |
| 4 or 5 (optional) | push N | 1..48 | UTF-8 bytes | display name | No 0x00 byte allowed |
Element-count cases (4 to 6 elements, src/modules/rank/rank_module.cpp:209):
| Elements | Meaning |
|---|---|
| 4 | LOKAD, 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.
| Offset | Size | Type | Endianness | Field | Notes |
|---|---|---|---|---|---|
| 0 | 4 | bytes | n/a | LOKAD | 52 41 4e 4b |
| 4 | 1 | uint8 | n/a | version | Must be 0x01 |
| 5 | 1 | uint8 | n/a | sentiment | 0x00 negative, 0x01 positive; anything else rejects |
| 6 | 1 | uint8 | n/a | platform_len (P) | Must be 1..255 |
| 7 | P | ASCII | n/a | platform name | Must equal a name in the platform table exactly (case-sensitive) |
| 7+P | 1 | uint8 | n/a | profile_len (R) | |
| 8+P | R | bytes | n/a | profile id | Must be non-empty; stored verbatim (no 0x00 stripping, no UTF-8 check) |
| 8+P+R | 1 | uint8 | n/a | post_len (S), optional | Absent or 0 = no post |
| 9+P+R | S | bytes | n/a | post id | Stored verbatim as text |
| next | 1 | uint8 | n/a | name_len (D), optional | 0 = no name; must be 0..48 |
| next | D | UTF-8 | n/a | display name | No 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).
| Id | Name | Profile id | Post id |
|---|---|---|---|
| 0x00 | unknown | free | free |
| 0x01 | twitter | X/Twitter handle | tweet id |
| 0x02 | nostr | e.g. npub | note id |
| 0x03 | telegram | Telegram handle | message id |
| 0x04 | poker | poker user UUID | poker event or order UUID; see POKR |
| 0x05 | localbusiness | establishment id, e.g. sirene-12345678901234 | unused at present |
| 0x06..0xff | platform_<n> | Format A only | Format 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 opcode | Format B / eMPP byte | Stored sentiment | REST value | Effect on ranking |
|---|---|---|---|---|
OP_0 (0x00) | 0x00 | 0 | negative | minus sats |
OP_1 (0x51) | 0x01 | 1 | positive | plus 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):
- The script must be at least 2 bytes and start with
OP_RETURN(:376). - Every element after
OP_RETURNmust parse as a strict push or a small-number opcode; any other opcode rejects the whole output (:384-390,:182). - Canonical pushes only (
ReadStrictPush,:115): 1..75 bytes must use the direct opcode (:132-138);OP_PUSHDATA1must carry 76..255 bytes (:146);OP_PUSHDATA2256..65535 (:160);OP_PUSHDATA4at least 65536 (:175). A push longer than the remaining script rejects. OP_0,OP_1NEGATEandOP_1..OP_16are read as opcode-only elements with no data (:126-130). OnlyOP_0/OP_1in the sentiment slot are meaningful; elsewhere they count as an empty element and make the slot fail.- At least one element after
OP_RETURN(:392).
Format A:
- 4 to 6 elements (
:209). - Element 0 is exactly the 4 bytes
RANK(:211-214). - Element 1 is the bare opcode
OP_0orOP_1(:216-222). - Element 2 is a 1-byte push (
:224). - Element 3 is non-empty, and still non-empty after removing every 0x00 byte (
:227-232). - A post id is exactly 8 bytes, read big-endian into a uint64 and stored as a decimal string (
:246-254). - 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). - 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):
- Format B: exactly one element (
:297), at least 8 bytes (:300), starting withRANK(:301). eMPP body: at least 4 bytes (:419). - Version byte is
0x01(:307, eMPP:423). - Sentiment byte is
0x00or0x01(:311, eMPP:427). - Platform length is non-zero, fits in the payload (
:316-317), and the name matches a known platform exactly (:321-329; eMPP:432-446). - 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). - 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:
- Minimum burn.
-rankminburn(default 1 sat, read once and cached,GetRankMinBurnSats) applies to every vote:ExtractVotesFromBlock, the one extraction used by bothConnectBlockandRescanRange, 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). - Every block is passed to
ExtractVotesFromBlock(native outputs decoded byDecodeRankOutput, which rejects a non-OP_RETURNscript at its first byte, then the eMPPRANKsegments of the height). A block without votes only advances the tip marker. - One vote per output:
rank_voteshas primary key(txid, vout)and inserts areINSERT 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 decodableRANKsegment 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:
| Column | Type | Notes |
|---|---|---|
txid | TEXT NOT NULL | hex txid |
vout | INTEGER NOT NULL | output index |
block_height | INTEGER NOT NULL | |
block_time | INTEGER NOT NULL | block header time (unix seconds) |
platform | INTEGER NOT NULL | platform id |
profile_id | TEXT NOT NULL | |
post_id | TEXT NOT NULL DEFAULT '' | '' = profile vote |
sentiment | INTEGER NOT NULL | 1 positive, 0 negative |
sats | INTEGER NOT NULL | value of the OP_RETURN output, in sats (eMPP: output_sats of the segment) |
source | TEXT NOT NULL DEFAULT 'native' | native or empp (added by migration :691-704) |
display_name | TEXT 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:
| Column | Type | Notes |
|---|---|---|
platform, profile_id | INTEGER, TEXT | primary key |
ranking | INTEGER DEFAULT 0 | sum of signed sats |
votes_positive, votes_negative | INTEGER DEFAULT 0 | vote counts |
last_vote_height | INTEGER DEFAULT 0 | max height seen |
display_name | TEXT DEFAULT '' | most recent non-empty name |
display_name_height | INTEGER DEFAULT 0 | height 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 eMPPRANKsegments fromg_empp_module->SegmentsForBlock,-rankminburnon 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 leftdisplay_name,display_name_heightandlast_vote_heightof 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,ResetForReindexempties 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 nodata_version2 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, RPCrescanmodule rank, a background job): reads blocks in chunks of 5,000 with up to 16 threads, extracts with the sameExtractVotesFromBlockasConnectBlock(eMPP votes,source,-rankminburn) and inserts withInsertExtractedVotes, which updates the aggregates only for votes not indexed yet. Each chunk is written undercs_mainand the module mutex, only if its last block is still on the active chain (otherwise the rescan stops, stateaborted).last_indexed_heightonly 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 asnative.
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/.
| Method | Path | Parameters | Response |
|---|---|---|---|
| GET | social/activity | page (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?} |
| GET | social/profiles | page (1), pageSize (25, max 200), platform, after=<ranking>:<profileId> | {profiles:[{platform, id, ranking, votesPositive, votesNegative, displayName}], numPages, nextCursor?} |
| GET | social/search | q (required, at most 64 bytes), platform, limit (25, max 100) | {query, platform?, profiles:[same as above], numResults} |
| GET | social/{platform}/{profileId} | none | {platform, id, ranking, votesPositive, votesNegative, displayName}; zeros and "" when unknown |
| GET | social/{platform}/{profileId}/posts | page, pageSize (10, max 100) | {posts:[{id, ranking, votesPositive, votesNegative}], numPages} |
| GET | social/{platform}/{profileId}/votes | page, pageSize (10, max 100) | {votes:[{txid, timestamp, sentiment, sats, post:{id}, source}], numPages} |
| GET | social/{platform}/{profileId}/post/{postId} | page, pageSize (25, max 100) | {summary:{platform, profileId, postId, ranking, votesPositive, votesNegative}, votes:[{txid, timestamp, sentiment, sats, source}], numPages, totalVotes} |
| GET | social/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} |
| GET | social/tx/{txid} | none | {txid, voteCount, totalSats, votes:[{vout, platform, profileId, sentiment, sats, postId, blockHeight, blockTime}]} |
| GET | social/block/{height}/summary | none | {height, voteCount, positive, negative, totalBurnSats} |
| GET or POST | social/rescan | none | 403 rescan_moved. A rescan is an operator action on the authenticated RPC: rescanmodule rank [start] [end] (see module rescans). |
Notes on the responses:
sentimentis the stringpositiveornegative;platformis the name (platform_<n>for ids 6 and above).- In
social/activity,firstSeenis the block time, not a mempool time.displayNameis the vote's own name, or the profile's current name if the vote carried none (:1728).numPagesis always 1 in cursor mode (no COUNT is run).nextCursoris returned in both modes whenever another page exists. - Unknown
platform/excludePlatformnames answer 400invalid_platform; bad cursors 400invalid_cursor;qmissing 400missing_query, too long 400query_too_long. social/searchmatchesprofile_idordisplay_namewithLIKE '%q%', with%,_and\escaped (:1973-1982); SQLiteLIKEis 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_postsby all-timeranking;rank_daily_statsis written but not read by any endpoint. social/rescananswers403 rescan_movedsince 12.4.6. Every handler runs holding the module mutex.doc/api-v1.mdlists aGET /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:
| Input | Regex | Goes 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:handle | platform in twitter, nostr, telegram, poker, localbusiness, unknown, case-insensitive | /dashboard/social/<platform>/<handle> (so nostr:npub1... opens a Nostr profile) |
| digits | ^\d+$ | block |
| 64 hex | transaction | |
| anything else | address |
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/modulesreportsrankloaded. - 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 callssocial/tx/{txid}to show the votes it contains. - SEO:
HandleGetDashboardinjects per-route title, description, canonical URL, OpenGraph and JSON-LD (src/api/dashboard_handler.cpp:477-600). For profile and post pages it readsrank.sqlitedirectly (LookupRankProfile,LookupRankPost) to put the score and the display name in the metadata;localbusinessprofiles get a French description and a cross-link tohttps://domesticus.fr/etab/<profileId>, Twitter and Telegram profiles a link tox.com/t.me. Its platform map (SeoPlatformId,src/api/dashboard_handler.cpp:93-100) must matchPLATFORM_NAMES. - Sitemap:
/dashboard/social*hub pages plus profile shards ordered by ranking (src/api/sitemap_handler.cpp:315), read fromrank.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
aftercursor ofsocial/profilesrefuses profile ids over 520 bytes. - Format A strips every 0x00 byte from the profile id, not only trailing padding:
a\0bis indexed asab. - 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
RANKsegments, they all share(txid, vout), so only the first decodable one is indexed; the others are silently dropped byINSERT 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) andlocalbusiness(0x05), and the eMPP transport are fork features (listed indoc/FORK.md). doc/pokr.mdmentions a-rankmaxburnoption; 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):
6a3b52414e4b01010d6c6f63616c627573696e65737315736972656e652d3132333435363738393031323334000f4c6520546f6e6e6561752064274f72| Bytes | Field | Value |
|---|---|---|
6a | OP_RETURN | |
3b | direct push | 59 bytes |
52414e4b | LOKAD | RANK |
01 | version | 1 |
01 | sentiment | positive |
0d | platform_len | 13 |
6c6f63616c627573696e657373 | platform | localbusiness (id 5) |
15 | profile_len | 21 |
736972656e652d3132333435363738393031323334 | profile id | sirene-12345678901234 |
00 | post_len | no post |
0f | name_len | 15 |
4c6520546f6e6e6561752064274f72 | display name | Le 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 #
6a0452414e4b51010105616c696365080102030405060708| Bytes | Element | Value |
|---|---|---|
6a | OP_RETURN | |
04 52414e4b | 0, LOKAD | RANK |
51 | 1, sentiment | OP_1 = positive |
01 01 | 2, platform | 0x01 = twitter |
05 616c696365 | 3, profile | alice |
08 0102030405060708 | 4, post id | big-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 handlerssrc/modules/rank/rank_module.h: module class, schema version, handler docssrc/modules/rank/rank_decoder.h:RankVote,RANK_DISPLAY_NAME_MAX_BYTES, decoder declarationssrc/modules/builtin_modules.cpp: registration order (eMPP before RANK)src/modules/module_registry.cpp,src/modules/module_registry.h: init, reconciliation, gap replaysrc/modules/empp/empp_module.cpp:SegmentsForBlock, source of eMPP-wrapped votessrc/init.cpp:-rankminburnsrc/api/dashboard_handler.cpp: SEO lookups inrank.sqlitesrc/api/sitemap_handler.cpp: profile sitemapssrc/api/openapi_handler.cpp: OpenAPI entries for/social/*share/www/dashboard/js/dashboard.js: search resolver (doSearch), RANK tabsrc/test/rank_decoder_tests.cpp: decoder unit tests
