BRC-514: MAP State Resolution over a 1Sat Chain - #4
Open
rohenaz wants to merge 1 commit into
Open
Conversation
Specifies how a MAP key's value is resolved across a record's revisions. MAP has no ownership model and its only context mechanism addresses a transaction; BRC-160 declines the question twice. Implementations have resolved it the same way for years - merge each revision in chain order, last write wins - but it was written down nowhere, so 'the value in effect' had no normative definition and BRC-515 had to carry an interim rule. Defines the revision order (chain order origin to tip, then script order, then ::: order, then push order), an ordered-set state model, and how each of MAP's six commands folds. Authorization is explicitly out of scope: the document resolves state given a set of authorized writes and leaves the choice of ownership model to the asset - 1Sat spend authority, an AIP or Sigma signature, or something a system defines itself. Section 8 separates what is deployed from what is new. The resolver in 1sat-stack implements the chain-order merge, link-output-only revisions and seq-addressed history, but folds SET alone; the other five commands, the ordered-set model and ::: ordering are specified here for the first time. Drafted by Fable 5.
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request:
Proposes a new standard by creating a new markdown file in the appropriate directory and requests discussion and assignment of a BRC number.
Drafted by Fable 5 in an advisory capacity, at the owner's direction.
What it specifies
How a MAP key's value is resolved across a record's revisions. MAP has no ownership model and its only context mechanism (
SELECT <txid>) addresses a transaction. BRC-160 declines the question twice — "full MAP encoding: specified separately", and "latest vs origin … is an application concern".Implementations have resolved it the same way for years: merge each revision in chain order, last write wins. It was written down nowhere, so "the value in effect at the tip" had no normative definition, and BRC-515 had to carry an interim rule it could not conform to.
The document defines:
:::order, then push order. Repeated key in oneSET: last pair wins.SETgives a single member,ADDappends with byte-equality dedup.CLEAR's per-transaction voiding, which is the only command not expressible as an operation on accumulated state.Authorization is out of scope, deliberately
Ownership and permissioning belong to whatever system owns the asset. This document resolves state given a set of authorized writes; it does not decide which writes are authorized. Two rules only: fold nothing unauthorized, and document your model. 1Sat spend authority and AIP/Sigma identity signatures are named as available models, and a system using neither is free to define its own.
The 1Sat chain is described as the canonical sequencing substrate, because that is what supplies the ordering — a revision is the chain-link output's own MAP data and nothing else in the transaction. Other substrates must supply their own total order.
Deployed versus new
§8 separates the two, verified against
1sat-stack/pkg/ordfs. Deployed: the chain-order last-write-wins merge, link-output-only revisions, seq-addressed history, piped-segment ordering, and the partial-SETrule. FoldsSETalone —map.gomatchesMapCmdSetand nothing else. The other five commands' fold, the ordered-set model and:::ordering are specified here for the first time. Deployed practice is incomplete rather than divergent.Numbering
514, below 515 because 515 depends on it and the corpus convention is that every numbered cross-reference points to an earlier document.
Open questions for review
ADDdedup versus duplicates. The draft models keys as ordered sets, warranted by MAP's own JSSetanalogy. A plain list with duplicates is closer to "append" but makesDELETEambiguous — remove one occurrence or all?REMOVE/DELETEin-chain. BRC-503 says both are "used withSELECT"; the draft makesSELECToptional inside a chain, where the revision's own record is the obvious context. Defensible, but an extension of 503's letter.SELECTtarget breadth. 514 allowsSELECTto name any earlier revision; BRC-515 binds writers to the spent tip's txid. Compatible — 515 writers are 514-conforming — but a reviewer should confirm what a 515 indexer does with aSELECTnaming the origin.SET-only resolvers get a named conformance subset, since that is what is deployed today.Follow-ups this surfaced
CLEARgloss said the command erases a record's entire state, where MAP voids only the named transaction's writes. Its interim resolution paragraph is now a citation to this document.opldotdev/MAPREADME defects: theDELETEexample omits<key>(BRC-503 has it right), andSELECT's command list reads "SET | REMOVE | ADD | REMOVE". Worth a small PR.