Contracts
JSON Schemas
Seven schemas, all JSON Schema 2020-12, all published in schemas/v1/ and declared in this repository's docs.manifest.json. Every one sets additionalProperties: false, so an unknown field is an error rather than a silent extension.
Context manifest
schemas/v1/context-manifest.schema.json
The optional JSON object whose RFC 8785 serialization is hashed into the marker. Structural rules only; the reference validator adds the semantic rules in section 5.
Required: protocol, version, kind, nonce, title, created, expires
protocolis the constantwitc,versionthe constant1,kindthe constantcircle.nonceis 16 bytes of lowercase hex; alias keys are 32 bytes of lowercase hex and must be unique.- Optional fields:
orbit,host,media,description,renderer,aliases(at most 16). additionalPropertiesis false: unknown fields are rejected, which keeps the hash preimage well defined.- String length limits count Unicode code points, and every string pattern forbids leading or trailing whitespace.
Decoded marker
The shape of a decoded marker, for interchange between tools that do not share a language.
Required: magic, version, network, networkId, opcode, participantCount, contextHash
magicis the constantWITC;opcodeis the constant1.networkIdis an integer 0 to 3, matchingnetworkin the enum mainnet, testnet3, signet, regtest.participantCountis 2 to 16.contextHashuses the pattern^(?!0{64})[0-9a-f]{64}$, so an all-zero hash cannot validate.
Validation prevouts
schemas/v1/prevouts.schema.json
The confirmed previous outputs a validator needs. Without these a Circle cannot be checked, because values, scripts and heights are not in the transaction.
Required: txid, vout, valueSats, scriptPubKey, blockHeight for each of 2 to 16 items
scriptPubKeymust match^5120[0-9a-fA-F]{64}$, so only native P2TR is expressible.valueSatsis a decimal string, not a JSON number, so no implementation loses precision above 2^53.voutis an integer 0 to 4294967295.
Plan request
schemas/v1/plan-request.schema.json
Input to the reference planner: what a coordinator submits to produce a frozen unsigned transaction.
Required: network, manifest, participants, feeRateSatsPerVbyte
networkis restricted to the enumsignetandregtest. The schema itself makes mainnet planning unexpressible.- Each participant carries a
maximumFeeShareSatscap, which the planner enforces withFEE_CAP_EXCEEDED. feeRateSatsPerVbyteis a positive decimal string; the planner additionally bounds it at 1,000,000.
State snapshot
schemas/v1/state-snapshot.schema.json
The exact object that is hashed to produce the authoritative state hash. This is the interoperability contract between independent indexers.
Required: protocol, version, revision, lineages, shards, circles, edges
- Four collections:
lineages,shards,circles(each withmembers), and continuationedges. - Outpoints are strings of the form
txid:voutwith a pattern that bounds vout at 4294967295 rather than allowing any digits. - Satoshi amounts are decimal strings bounded at 2100000000000000, so MAX_MONEY is enforced by the schema.
- Integers are bounded at 9007199254740991, the ECMAScript safe integer limit.
additionalPropertiesis false at every level, so no implementation-specific database field can enter the hash preimage.
Golden transaction vector
schemas/v1/golden-circle.schema.json
The shape of the golden vector file, so the fixture itself is validated in CI and cannot drift into an unparseable form.
Required: 16 fields including rawTransaction, txid, wtxid, feeSats, virtualBytes, prevouts, expectedLineageIds, stateTransition
markerScriptis constrained to^6a28[0-9a-f]{80}$, which encodes the exact 42 byte marker shape.manifestreferences the context manifest schema, andprevoutsreferences the prevouts schema.expectedLineageIdsholds 2 to 16 lowercase hex hashes.
State lifecycle vector
schemas/v1/state-lifecycle.schema.json
The shape of the lifecycle fixture: genesis reference, continuation circle, ordinary-spend closure, and exactly three rollback roots.
Required: schemaVersion, name, genesis, continuation, closure, rollbackExpectedStateHashes
genesis.sourceis the constantgolden-circle.json, binding the two fixtures together.rollbackExpectedStateHasheshasminItemsandmaxItemsof 3, matching the three applied transitions.- Local
$defsdefine the 64 character hash and the outpoint object reused across the file.
Identifiers and versioning
Each schema declares an $id under https://schemas.bitcoinuniverse.dev/witc/v1/. Those identifiers are stable names used for $ref resolution between the files; resolve them from the repository copies rather than expecting them to be dereferenceable.
Schemas are versioned by directory. A future protocol version gets schemas/v2/; the v1 files are never edited to describe new behaviour, because the published vectors and the deployed indexers depend on them meaning exactly what they meant when they were committed.
Structural validation is necessary but not sufficient. The context manifest in particular carries semantic rules the schema cannot express: real UTC calendar timestamps, expires later than created, well-formed Unicode without unpaired surrogates, and strings unchanged by the ECMAScript trim operation. Those live in src/manifest.ts and are described in section 5.