# X1MAPS art rule v1.5

How a block's map is drawn. Once maps are claimed under v1.5 it never changes: a different answer to any case below
is a new rule (v2), never an edit. v1.5 supersedes v1.4 (https://www.x1inscriptions.io/art-rule/v1.4.md, kept
unchanged). v1.5 draws no map differently and changes no leaf: every map's bytes and every leaf are exactly as under
v1.4. It states which blocks have a map at all — the supply cap — which shortens the last epoch's root by one map.

## Supply
- The collection is maps 0 to 69,420: 69,421 maps. Height 69,420 covers slots 149,947,200 to 149,949,359.
- No block above height 69,420 has a map. None is drawn, committed or claimed, and none ever will be. X1 keeps
  producing blocks after it; they are simply not maps.
- The cap is enforced by the program, not only by this document: a claim above height 69,420 is refused, and no
  epoch commitment can exist past it.

## The block
- One block = absolute X1 slots N×2,160 … N×2,160+2,159 (height N, anchored at slot 0; 100 blocks per epoch after
  the warm-up). Produced slots come from `getBlocks` on a full-history node; each is read with `getBlock`
  (commitment finalized, transactionDetails `full`, maxSupportedTransactionVersion 0). A slot that X1 skipped (not
  listed by `getBlocks`) is void. A slot `getBlocks` lists must be read: a node answering that it has no block
  (-32004, -32007, -32009) is re-read from a full-history node, three times; only if that also has no block is the
  slot void, and the count is recorded in the block's story as voidSlots.
- All amounts are exact integers. Lamport balances above 2^53 must be read without floating-point loss.
- Frame, not mosaic: block-height range, produced and skipped slots, time, fees, transactions and the busiest wallet
  are the block's certificate and story, never squares.

## What the ledger serves
- A map draws what the public ledger serves for its slots. The rule reads the ledger; it does not judge which run of
  the chain a served block belongs to.
- First chain: X1's public archive mixes two runs. Slots 0 to 15,742 and slots 674,084 onward are the current chain.
  Slots 15,743 to 674,083 are an older run that does not connect to the current chain, except 153 current-chain
  blocks; the other current-chain blocks of that stretch cannot be read. Blocks 8 to 311 (304 maps) lie wholly in
  that stretch and are First chain maps. Blocks 7 and 312 lie partly in it. Their map bytes are drawn by this rule
  from what is served, like any other map.
- Holes: no node reached serves slots 848,987 to 1,081,904, 1,081,968 to 1,082,708, 1,082,772 to 1,082,893, or
  1,082,957 to 1,083,080. Those slots are void for the map.
- Lost maps: blocks 394 to 499 have no slot in the served ledger and are Lost, with 0 map bytes. Blocks 393, 500 and
  501 are Partly lost: they draw the slots that are served.

Small extra branches also exist: slots 1,294 to 1,863 hold short runs from branches other than the two named here, and 153 slots inside 15,743 to 674,083 belong to the current chain. A slot still has exactly one stored block: heights repeat across slots, slots do not. These short runs carry no squares.

## Which transactions
- Skipped: any transaction with `Vote111111111111111111111111111111111111111` among its account keys; any failed
  transaction (meta.err set); any transaction without meta. Account keys = message.accountKeys followed by meta.loadedAddresses.writable, then .readonly.
- Everything else is read in canonical block order (slot, then position in the block).

## Value moved (per transaction)
- **XNT** = the sum of native balance gains of every non-payer account (key index ≥ 1) that already existed
  (pre-balance > 0) and is not a token account (not named in pre/postTokenBalances), plus the sum of wrapped-XNT
  (So11111111111111111111111111111111111111112) token balance increases. Counted only if ≥ 1,000,000 lamports
  (0.001 XNT); below that it is 0.
- **Token** = for each other mint, the sum of its balance increases (per token account: post − pre, counted when > 0).
  The mint whose sum has the most decimal digits wins. A tie goes to the mint that appears first in
  meta.postTokenBalances among the mints that increased (a mint listed earlier whose balances only fell or stayed
  the same is not a candidate).
- A transaction that moved XNT is an XNT square. Otherwise, if a token moved, a token square. Otherwise nothing.
- Cases: new-account rent is not a payment · multi-recipient = sum · wrapped XNT counted once · Token-2022 transfer
  fee → the net received · self-transfer to an existing account counts (ownership isn't knowable) · burns move
  nothing · dust < 0.001 XNT is nothing.

## Squares
- One square per value-moving transaction, in block order. No fee or "coinbase" square: a block where nothing moved
  has zero squares and its stored map is 0 bytes.
- XNT square: blue, size = ceil(log10(lamports)) − 7, clamped 1–9, computed with integers only:
  ceil(log10(x)) = the number of decimal digits of x, minus 1 when x is exactly a power of ten.
  0.001 XNT → 1, 1 XNT → 2, 2 XNT → 3, 5,400 XNT → 6, 10^15 lamports → 8, 10^15+1 lamports → 9.
- Token square: gray. Let d = the number of decimal digits of the transaction's winning-mint sum. Size 2 if d is
  greater than the median d of that mint's token squares in the same block, else 1. The median of a mint's d values
  sorted ascending is element ⌊(n−1)/2⌋; a mint with a single token square in the block has no median, and that
  square is size 2.
- Shade, 5 levels: brightness = the transaction's computeUnitsConsumed compared with the other squares of the same
  block. t = (ln cu − ln min) / (ln max − ln min), where min and max are taken over the block's squares whose compute
  is known; level = min(4, ⌊5t⌋); dark = 4 − level (dark 0 = the block's heaviest work). ln is the natural logarithm and
  every step is computed in IEEE-754 double precision (JavaScript Math.log, subtraction, division, Math.floor), in that
  order. A square whose computeUnitsConsumed is missing or 0 has unknown compute: dark = 0. If every known square did
  the same work, all are dark 0.
- Storage: 1 byte per square: size in bits 0–3, kind in bit 4 (0 XNT, 1 token), dark in bits 5–7.

## Layout (normative: which square sits where)
- Squares are placed one at a time in storage order on a grid of unit cells.
- W = max(1, ⌈√(Σ size²)⌉). Each square of side s goes to the first free position (x, y) found by scanning rows
  y = 0, 1, 2, … and, within a row, x = 0, 1, 2, … where x + s ≤ W and none of its s×s cells is taken. The grid is
  unbounded downward. That scan order is the tie-break: lowest y first, then lowest x.
- Parcels are numbered by storage order (parcel n = the n-th square, n from 1), so a parcel never depends on how the
  picture is drawn.

## Display (not committed)
- The drawing is centred in a square frame; each square is drawn inset by a quarter of a unit cell on every side when
  a cell is at least 4 pixels wide. XNT blue #0088FF, token gray #8A8A92, each multiplied by 1, 0.905, 0.81, 0.715,
  0.62 for dark 0–4.
- An empty block is drawn as its heartbeat (display only: the slot data comes from the block's story, it is not part
  of the map bytes and is not committed): its 2,160 slots as a 48 × 45 grid of dots, #1C1D21 where X1 produced the
  slot, #4A4D55 where that slot held any successful non-vote transaction, nothing where the slot was skipped.
- The display looks are presentation, not map data. A Lost map is drawn as red static made from its height. A First
  chain map keeps its squares or heartbeat and is drawn in gold on black. Neither changes the map's bytes, its leaf
  or its parcels, and these looks are not committed.

## Commitments
- Per epoch, a Merkle root over its blocks' maps in height order. Leaf = sha256(0x00 ‖ height as u64 little-endian ‖
  map length in bytes as u32 little-endian ‖ sha256(map bytes)). The tree is dense: one leaf for every height from
  the first to the last, an empty block's map being 0 bytes (length 0). Internal node = sha256(0x01 ‖ left ‖
  right). An odd last node at any level is promoted unchanged, never paired with itself (avoids the Bitcoin
  CVE-2012-2459 duplicate-leaf ambiguity; domain separation stops a leaf posing as a node). A proof is the siblings
  along the block's path (none at a promoted level); its index = height − first height of the epoch.
- Each commitment stores its explicit first and last height, computed from absolute slots, never from the epoch
  counter: X1's warm-up epochs e = 0…12 are 32·2^e slots long (262,112 slots in total), then every epoch is 216,000
  slots from slot 262,112. A block belongs to the epoch of its first slot. An epoch with no blocks (the warm-up epochs
  that fall inside block 0) has no commitment.
- A commitment's last height is also capped at 69,420 (see Supply). The epoch holding map 69,420 is therefore
  committed one map short of its slots — its root covers 69,322 to 69,420, 99 leaves — and an epoch whose first
  height is above 69,420 has no commitment and never will. The tree is dense between the stored first and last
  height either way.
- Only maps drawn by the history pass (not provisional maps of the newest blocks) are committed.
- This document's sha256 is anchored on chain in the program account ["artrule", "v1.5"] before any mainnet map is
  claimed under it.

## Frozen
- Served byte-identical forever at https://www.x1inscriptions.io/art-rule/v1.5.md. Any change, even a typo, means a
  new rule; this file is never edited.
- Test vectors, unchanged from v1.3 — the cap changes no leaf (value moved incl. the tie-break cases, square sizes, bytes, shades incl. unknown
  compute, layout rectangles, real mainnet maps for heights 0 to 7, leaves, an epoch root and a proof):
  https://www.x1inscriptions.io/art-rule/v1.3-vectors.json
