XMR721
Market

Build on XMR721

Records and signed texts

Every XMR721 action is a record: a short byte string that decodes exactly, signed with a wallet's Sign message or proven by payments, and carried in the extra field of an ordinary Monero transaction.

This page summarises the format. The rules in full, with every check, are RULES.md, and rules/tests/fixtures.json holds test cases any implementation can replay.

#Layout

Text
record  = "MD1" 0xfe  op(u8)  body  [proof or signature]
address = kind(u8: 0 standard, 1 subaddress)  spend key(32)  view key(32)
numbers are little-endian: u32 = block or counter, u64 = piconero, u16 = basis points
OpRecordBody
1claimreg32 ownerTx32 to proof(u8) … and the proof
2movereg32 seq(u32) from to
3listreg32 seq(u32) until(u32) price(u64) seller
4cancellot32 seller
5reservelot32 payBy(u32) buyer rate(u16) [market when rate > 0]
6buylot32 n(u8: 2 or 3) then n × txid32 out(u8) D32 c32 s32 (no signature)
7collectioncreator max(u32) flags(u8: 0) name(len u8, 1–64)
8mintcollection32 edition(u32) creator flags(u8) [to] name(len u8, 0–64) type(u8) content(len u16) [origin]
9burnnft32 seq(u32) owner

Signed records end with variant(u8) c32 r32: the wallet signature, and which line ending the wallet signed (0 none, 1 line feed, 2 carriage return and line feed).

An NFT is named by 32 bytes: a Mordinal by the transaction that inscribed it, a minted NFT by the id of its mint record. Move, list, cancel, reserve and buy work the same for both.

#Ids

Text
id   = SHA-256("MORDINALS-RECORD-v1" 0x00 ‖ domain ‖ "MD1" 0xfe ‖ op ‖ body)
code = the first 16 bytes of the id, as 32 hex characters
lot  = the id of a list record

The id does not cover the signature, so one action has one id however it was signed. A record whose id is already on the ledger is ignored.

#How records travel

Text
tx_extra = 01 <transaction public key 32>  [02 09 01 <payment id 8>]
           then per chunk: 02 <length> 7f <chunk>
  • The record is cut into chunks of 254 bytes; only the last may be shorter.
  • A transaction carries a record only if its whole extra field parses exactly this way, is at most 1,060 bytes, and the joined chunks start with MD1 0xfe and are at most 1,000 bytes. Anything else is skipped.
  • One transaction carries one record. Who made it and what it pays do not matter.
  • Records are applied in chain order: by block, then by position in the block. A record that fails any check changes nothing.
  • When blocks are replaced, their records are undone and the new blocks' records applied.

#Signatures

Every signed record is a wallet Sign message signature (wallet2 SigV2) with the spend key, over one line of text that the record's bytes fully decide. A signature with the view key is refused. The reader rebuilds the text from the record, so what a person read in their wallet is exactly what the ledger applies.

#The signed texts

Mordinals:

Text
Mordinals move: send Mordinal #N to <to>; move <seq>; code <code>
Mordinals list: sell Mordinal #N for P XMR (<P − fee> XMR to <seller>, <fee> XMR protocol fee); valid until block <until>; code <code>
Mordinals cancel: stop selling Mordinal #N; listing <lot code>; code <code>
Mordinals reserve: buy Mordinal #N for P XMR; pay exactly <a> XMR to <seller> and exactly <b> XMR to <fee address>[ and exactly <c> XMR to <market>] by block <payBy>; Mordinal to <buyer>; code <code>
Mordinals claim: Mordinal #N (inscription <reg>), held by output 0 of <ownerTx> and spent in <spendTx>, now belongs to <to>; code <code>

New NFTs:

Text
XMR721 collection: create "<name>" with <max> editions, minted only by <creator>; code <code>
XMR721 mint: edition <n> of "<collection name>" [named "<name>"]; <size> bytes of type <type>, SHA-256 <hash>[; from <kind>:<ref hex>]; first owner <address>; code <code>
XMR721 mint: one NFT in no collection [named "<name>"]; …
XMR721 burn: destroy <NFT> for good; burn <seq>; code <code>

In move, list, cancel and reserve texts a minted NFT is written "<collection name>" #<edition> (NFT <code>), or NFT <code> when it has no collection, where a Mordinal is written Mordinal #<number>. A reservation of a minted NFT ends ; NFT to <buyer>; code <code>.

#The counter

Each NFT has a counter (seq) that starts at 0 after the claim or mint and goes up by one on every move, sale and cancel. A move, list or burn must carry the current value, so a signed record can be used once and never replayed, even after the NFT returns to an earlier owner.

#Sizes

RecordBytes
claim by a spent coin489
move236
list183
reserve238
cancel167
buy296, or 425 with a marketplace fee
mintat most 1,000, of which 824 for name and content (759 with to)

#Purchase proofs

A buy record carries, for each payee, the payment's transaction id, the output number, the shared secret D = r·V and a proof made with the payment's transaction key r: the proof Monero wallets make as an OutProofV2 for one key, with the message mordinals-payment:<domain>:<listing id>. The key itself is never in the record. See RULES.md section 5.