Mimir is a one-page, offline builder for a deliberately small Bitcoin Script
policy. Register up to five compressed public keys, then describe up to five
alternative spending clauses by choosing keyholders, a K-of-N signature
threshold, and an optional absolute UTC date. Mimir emits the exact native
SegWit v0 P2WSH Bitcoin Script, address, script bytes, and recovery metadata.
Mimir does not generate arbitrary Bitcoin Script and does not use Miniscript. The complete policy language is:
POLICY = CLAUSE 1 OR CLAUSE 2 OR ... OR CLAUSE 5
CLAUSE = [optional absolute CLTV date] AND [one key or K-of-N multisig]
The compiler emits this as a literal, right-nested conditional:
OP_IF
CLAUSE 1
OP_ELSE
OP_IF
CLAUSE 2
OP_ELSE
CLAUSE 3
OP_ENDIF
OP_ENDIF
There is no Boolean rewriting, key factoring, or hidden policy optimization. Every authored clause becomes one Script branch. If a public key is selected in several clauses, it appears several times in the Script. The formatted ASM is therefore intended to remain directly auditable against the clause editor.
Single-key clauses use OP_CHECKSIG. Threshold clauses use the standard
K <keys...> N OP_CHECKMULTISIG form. Delayed clauses prepend the
Core-signable sequence <timestamp> OP_CHECKLOCKTIMEVERIFY OP_VERIFY.
Alternative branches use minimal 0 and 1 witness selectors documented in
the exported manifest.
The implemented surface provides:
- one to five valid compressed secp256k1 public keys;
- one to five alternative clauses;
- one signature threshold and at most one absolute date per clause;
- deliberate reuse of keys across any clauses;
- live, formatted Bitcoin Script ASM and exact witness-script hex;
- Mainnet, Testnet, Signet, and Regtest P2WSH addresses;
- branch-selector, signature-order, and
CHECKMULTISIGdummy metadata; - deterministic canonical JSON export; and
- no private-key, seed, xpub, derivation, signing, persistence, or network input.
The concise implementation contract is
mimir_v8_spec.md. The former
mimir_v7_spec.md remains available as the historical
contract for the incompatible mimir-direct-p2wsh-v1 byte layout.
Node.js 22.13 or newer is required.
npm install
npm run devOpen http://localhost:3000. If your system still uses Node 20:
npm exec --yes --package=node@22 -- npm run devAll application code and assets are local. Policy state stays in volatile page memory, and the production content security policy disables outbound network connections.
npm testThe tests build and render the application, enumerate all 160 possible single-clause key-set/threshold/timing shapes through five keys, and interpret the generated bytes symbolically for every signer subset and relevant time boundary. Multi-clause tests cover repeated and partially overlapping key sets.
The planned independent execution matrix is documented in BITCOIN_CORE_REGTEST_TEST_PLAN.md.
Mimir emits native P2WSH, not Taproot. For OP_CHECKMULTISIG, the spending
witness must include the consensus-required empty dummy item and signatures in
public-key order. A delayed branch requires transaction nLockTime at least
equal to its timestamp and a non-final nSequence on the spending input.
The default npm test suite provides strong compiler and offline transaction
checks; it does not start or mutate Bitcoin Core. The opt-in
test:regtest:quick campaign executes 100 funded
policies and 400 positive/negative outcomes against a Bitcoin Core Regtest
node. Before mainnet use, complete the independent exhaustive matrix, reproduce
the witness-script bytes and address with independent tooling, and retain the
policy JSON with the recovery setup.
The planned Bitcoin Core funding/recovery command, OP_RETURN metadata, and dust
transaction workflow are not implemented yet.