On-chain protocols for developers
eMPP, RANK, ENTY, SLP, ALP, BLOB and the POOL record on one page: envelopes, byte layouts with checked examples, the gotchas that leave an output unindexed, test vectors.
Applications write data into OP_RETURN outputs; nodes index it. None of it is consensus: a malformed payload is a valid transaction that is simply not indexed. That makes mistakes silent, so check what you write with the node's dry-run routes before you sign (POST /api/v1/social/decode for RANK and ENTY, POST /api/v1/txs/token-check for tokens).
The full specification of each protocol is its own page in the protocol section; this page is the map, with the parts people get wrong.
The protocols #
| Protocol | LOKAD id | Transport | Indexed by | Spec |
|---|---|---|---|---|
| eMPP | none (carries the others) | OP_RETURN OP_RESERVED (6a 50) + pushes | empp | eMPP |
| RANK votes | RANK 52414e4b | bare OP_RETURN (Format A or B) or eMPP | rank | RANK |
| ENTY entity registry | ENTY 454e5459 | eMPP only | rank | Entities |
| SLP v1 tokens | SLP\0 534c5000 | bare OP_RETURN at output 0, or eMPP | slp | SLP |
| ALP tokens | SLP2 534c5032 | eMPP at output 0 only | alp | ALP |
| BLOB files | BLOB 424c4f42 | bare OP_RETURN or eMPP | blob | BLOB |
| POKR poker events | POKR 504f4b52 | bare OP_RETURN or eMPP | pokr | POKR |
| POOL mining record | POOL 504f4f4c | eMPP in the coinbase | pool | below and The pool |
| UTXO commitment | UTXO 5554584f | eMPP in the coinbase, from Napoleon (consensus) | validation | UTXO commitment |
| VOIX, BOOK | VOIX 564f4958 | bare OP_RETURN or eMPP | voix, book | VOIX (off on mainnet) |
GET /api/v1/modules says which modules a node runs and their versions; a module left out answers 503 module_disabled.
Size and count of OP_RETURN outputs #
| Rule | Lotus (this node) |
|---|---|
Size of one OP_RETURN script | 8,005 bytes, for relay and for block transactions (MAX_OP_RETURN_RELAY, -datacarriersize lowers it for relay) |
OP_RETURN outputs per transaction | at most 3 before Napoleon (multi-op-return); no limit from Napoleon |
Upstream nodes (the 12.0.x line) refuse a block transaction whose OP_RETURN script is longer than 223 bytes. A transaction with a longer one is valid on Lotus and not on the upstream chain. RANK votes and most records are far below 223 bytes; BLOB chunks and long VOIX messages are not. See Napoleon for integrators.
eMPP in one paragraph #
6a 50, then one or more pushes; each push is a segment, LOKAD id (4 bytes) || payload. Pushes must be canonical: a direct push 01..4b for 1 to 75 bytes, 4c (PUSHDATA1) only for 76 to 255, 4d only for 256 to 65,535, 4e only above that. OP_0, OP_1..OP_16 or any other opcode make the whole output invalid. Any output of any transaction is scanned, the coinbase included, and several protocols can share one output.
RANK #
Three layouts carry the same vote: platform, profile, optional post, optional display name, sentiment.
Format A (multi-push): 6a, push RANK, OP_0 (negative) or OP_1 (positive) as a bare opcode, push of 1 platform byte, push profile, optional push post, optional push display name.
6a 04 52414e4b 51 01 01 05 616c696365 08 0102030405060708
"RANK" + twitter "alice" post id 72623859790382856 (big-endian uint64)Format B (one push): 6a, one push of RANK || 01 (version) || sentiment (00/01) || lp platform name || lp profile || lp post || lp display name, lp being a 1-byte length:
6a 3b 52414e4b 01 01 0d 6c6f63616c627573696e657373 15 736972656e652d3132333435363738393031323334 00 0f 4c6520546f6e6e6561752064274f72
"RANK" v1 + "localbusiness" "sirene-12345678901234" no post "Le Tonneau d'Or"eMPP: a segment RANK + the Format B body from the version byte on.
Both examples decode on a 12.5.9 node with POST /api/v1/social/decode (transports format_a, format_b).
| Platform byte | Name | Profile id | Post id |
|---|---|---|---|
0x00 | lotusia (12.5.9) | a Lotus address: 20-byte key hash or 33-byte Taproot commitment, raw bytes; REST shows lowercase hex and profileAddress | 32-byte hash |
0x01 | twitter | handle | tweet id (Format A: 8-byte big-endian) |
0x02 | nostr | npub | note id |
0x03 | telegram | numeric id or handle | message id |
0x04 | poker | user UUID | event UUID |
0x05 | localbusiness | establishment id, e.g. sirene-<SIRET> | |
0x06 | entity (12.5.9) | eid, 26 characters | collection id (8 bytes in Format A, decimal string in Format B and eMPP) |
0x07..0xff | platform_<n> | Format A only |
Gotchas:
- Format A strips every
0x00byte from the profile id, except for platformlotusia, where the bytes are a hash. Do not zero-pad ids. - Format B and eMPP name the platform by its name and reject unknown names; only Format A can carry
platform_<n>. - The weight is the value of the
OP_RETURNoutput. A vote below a node's-rankminburn(default 1 sat) is not indexed by that node. - Only the first decodable
RANKsegment of an output is a vote.
ENTY: the entity registry #
An entity id is computed, not claimed: eid = base32lower(SHA-256("lotus-entity-v1" || 0x00 || key)[0..16]), 26 characters. A vote on an entity is a RANK vote with platform entity and the eid as profile. The ENTY segment publishes the key behind an eid:
6a 50 0f 454e5459 01 01 07 77643a51323433 02
push 15 "ENTY" v1 REG len 7 "wd:Q243" kind 2 (place)| Key | eid |
|---|---|
wd:Q243 | 35wicsrcclf4w33gvcrhn2k64i |
wd:Q90 | awcgivxwvgt2bwvxj3k7g3mjlq |
fr-siret:73282932000074 | ygb3sggbc33laaqhji4bzxfwke |
dns:example.com | 2wdfizeo7qbypvkv6lp25a4p74 |
A REG counts when the same output carries a RANK vote of at least 1 sat (the vote is the stake), or when the output burns at least 1,000 sats (REG_MIN_BURN). The standalone example above with a value of 0 registers nothing: social/decode answers below_reg_min_burn. Put the RANK segment first and the ENTY segments after it in the same eMPP output.
SLP and ALP #
Tokens as eCash specifies them (SLP v1 types 1, NFT1 group and child; ALP over eMPP at output 0 with value 0). The node validates every token transaction against its inputs and indexes balances, history and holders (/api/v1/slp/..., /api/v1/alp/...). A transaction that spends token outputs without a valid token payload burns them: broadcast through POST /api/v1/txs/broadcast-checked, or check first with POST /api/v1/txs/token-check. The Chronik API leaves the SLP fields empty (Chronik).
BLOB #
A file is split into chunks, one OP_RETURN output per chunk, and named by the SHA-256 of the whole file. Native chunk: exactly six pushes, integers big-endian:
6a 04 424c4f42 20 <blob_id, 32 bytes> 04 <chunk_index u32 BE> 04 <total_chunks u32 BE> 01 <content type> <push payload>Every field is a data push, even a one-byte one. The content type 0x01 (JSON) is written 01 01: push of one byte, then the byte. Script libraries that "minimally encode" small numbers turn it into OP_1 (0x51), and the BLOB decoder refuses OP_0, OP_1..OP_16 and OP_1NEGATE anywhere in the output: the whole chunk is then not indexed, silently. Build the pushes by hand. The same holds for the PUSHDATA forms: 4c only from 76 bytes, 4d only from 256.
Content types: 01 JSON, 02 SVG, 03 WebP, 04 gzipped JSON, 05 PNG, 06 JPEG, 07 text, 08 bytes. A chunk carries up to 7,951 bytes of payload in an 8,005-byte script. The file is served once every chunk is in and the SHA-256 matches (GET /api/v1/blob/<id>/chunks, GET /api/v1/blob/tx/<txid>).
POOL record #
A block mined by a Lotus pool node describes its payout in extra OP_RETURN outputs of the coinbase, in eMPP, LOKAD POOL. Addresses and amounts are not repeated: they are the coinbase outputs. Each segment is POOL || 01 (version) || lp section type || body, integers little-endian, like ALP.
| Section | Body |
|---|---|
H (head) | u8 flags (bit 0 fallback, 1 payee list truncated, 2 continued) · lp pool_id · u8 finder_node · 8 bytes window_commit · u32 window_shares · u64 window_weight · u16 pool_hashrate · u16 payee_total · u16 fee_bps · u16 burn_bps |
P (payees) | u16 first_vout · u8 n · n × (u16 share, u16 hashrate) |
B, C | u64: satoshis burnt for work without a Lotus address, and rounding burnt instead of overpaying |
S | a ledger settlement (pool operators only) |
share is floor(65535 × weight / total); hashrates are 2^(v / 1024) H/s. Unknown section types are kept, never rejected: skip them. Mainnet block 00000000014254ebc30bcda4defc8ebd1d37e8688627c16f0ae97083a24c9445, coinbase output 18:
6a 50 2f 504f4f4c 01 01 48 00 09 4652454e4348425443 7d 781e17bf7014bb53 33040000 e366b3d9a7020000 5381 1000 0000 0100
"POOL" v1 "H" flags "FRENCHBTC" 125 window commit 1075 shares weight 2919935207139 hashrate 33107 16 payees fee 0 burn 1 bps
4a 504f4f4c 01 01 50 0100 10 3533 5f78 5031 1b78 ...
"POOL" v1 "P" vout 1, 16 payees: (13109, 30815), (12624, 30747), ...GET /api/v1/pool-public/record/<block hash> and decodepoolrecord give the decoded record.
Test vectors #
In the lotusd source tree, generated by the code that the node and the JavaScript encoders are tested against:
| File | Content |
|---|---|
src/test/data/entity_vectors.json | Keys, eids, cids, key refusals with their reason, ENTY records, outputs, votes |
src/test/data/rank_vote_vectors.json | RANK votes in every layout |
src/test/data/rank_score_vectors.json | score_v1 |
doc/voix/vectors/*.json | VOIX records, names, sealing, onion packets |
