Placement is now a rule of lineage/v0, not just how Orgchain inscribes:
an award counts only if it is inscribed on its recipient's own sat, so any
indexer can check that a belt is soulbound. The reducer compares sats
(satOf): the lab's sat numbers, ord's, or, without ord's sat index, its
satpoints, which two inscriptions share exactly when they share a sat. ord
events now carry the sat number when ord has one. Belts inscribed anywhere
else, as before v1.14, are rejected.
A promotion is another reinscription on the same sat, over the belt before
it: each badge keeps its skill's earlier belts, and Inspect shows the
ladder ("re-inscribed over white (beat 5)"). The sample's sol now goes
white, then green. An award and its recipient's own close no longer
conflict within a block, since both spend the recipient's inscription.
Rehearsed again on Bitcoin Core regtest from height 178: sixteen beats and
133 transactions; ord shows sol's sat carrying sol, its white belt and its
green belt, in order, each belt charmed reinscription and vindicated, and
the compare matches. The fixture is re-recorded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H4upF5LVwmPDDqrhdUfnXh
5.7 KiB
5.7 KiB
AGENTS.md
Orgchain is lineage's app for creating and operating lineage holdings on Super Testnet's toy chain.
- Test-only, always: no mainnet funds, no hidden signing, no custody, and nothing presented as a real key.
- Lineage semantics live in one place,
src/orgchain/lineage.js, andSPEC.mdsays the same in words. The UI never interprets events itself, and every act is vetted by that reducer before it is signed. A new op or rule means a reducer change, its tests, the README's table andSPEC.md. - Whatever signs must stay valid on real Bitcoin. After changing how transactions or envelopes are built, rerun the
regtest rehearsal and its comparison (
tools/regtest/README.md) and refresh the fixture it records. - The engine (
src/adapters,src/upstream,src/storage.js,src/miner.js) is Super Testnet's. Compose with it rather than rewriting it, and keep its tests passing. Preserve upstream licenses and provenance. Its local changes are P2WPKH payments, a coinbase split across up to 64 outputs, ordinary spends of up to 64 inputs and outputs whose key-path signatures may carry 0x83, a three-input reveal that inscribes on a sat another key holds (a belt) and returns both coins unchanged, coins imported from a real chain, and BIP-341/342 checks of reveals' script paths, all insrc/adapters/chain.js(PROVENANCE.md); keep them small and tested. - Money lives in
src/orgchain/money.js: beats pay the holdings (split by hashrate, or all to the last act; under Mainnet none mine, and the lab wallet funds them), sends spend SegWit coins only, so an inscription can never leave as change, and balances are read off the chain, never stored. Gas (src/orgchain/actions.js): every act is paid by the actor's own keys and checked before anything is signed; the lab wallet pays only for foundings and for holdings that predate lab keys. - Deals live in
src/orgchain/offers.js, both sides of the PSBT: an offer (the buyer pre-signs the whole transaction and the holder countersigns) and an ask (the holder signs the lot's input alone, SIGHASH_SINGLE|ANYONECANPAY, and any buyer completes it behind a dummy of its own). Offers and asks are signatures kept in the lab, never chain state, and who holds a lot is read off the chain, never from metadata. An org sells with its tree, and a holding whole, by its owner (the lab wallet): cash-free, and frozen with everything in it while listed or sold (actions.jscashOut, frozenWhy; a listed holding mines nothing). A tree travels as one output (bundlefor an ask; an offer merges its inputs) and splits back by the deal's layout once adopted (unbundle): one output per inscribed sat, never two sats' inscriptions left sharing a coin, or selling one would sell the other. Its buyer's keys sign the adoption and the split: never sign for the buyer at the seller's act. - Belts are soulbound (
src/orgchain/belts.js): a belt counts only when it is inscribed on its recipient's own sat (the reducer compares sats withsatOf: the lab's sat numbers, ord's, or else ord's satpoints), and the lab puts it there in one three-input reveal that the recipient's key co-signs, so it goes wherever its node goes; a promotion is another reinscription on that sat. Count and split coins by inscribed sat, never by inscription, since a node shares its sat with its belts, and never make a belt a lot. The compare checks ord's satpoints and charms (charmsOfmodels the ones lineage's inscriptions earn); keep that model in step with ord. - Moves (
join,adopt): neither half's effect may depend on their order within a block, since a miner may put them either way; the move records both halves. An old parent keeps a moved child inchildrenso its index is never reused: walk children withkidsOf. A holding that moves becomes an org: its old root stays inkeys.rootsso old keys still resolve (money.jskeyAt), and graduation roots are kept by graduation event (keys.adopted), since a node can graduate, move and graduate again. Inscription metadata is public and permanent, so never put a secret in it (item notes included), and a charter carries a hash of the filings, never the filings. - Charters (
src/orgchain/lineage.js): legal form is an attribute of a node, and whether a charter stands is derived from the tree (standing), never stored, so charters commute with graduations and closes. - Keys follow the tree (
src/orgchain/keys.js): store roots only (one per holding, one per graduated org) and derive every other key from its position. Every act is signed by whichever key holds the authorizing inscription. - A node's chain key is its account's BIP-86 Taproot key (
m/86'/1'/account'/0/0); SegWit is BIP-84 at the same account and holds its money; its Ethereum key is BIP-44 atm/44'/60'/account'/0/0(an org's, at account 0, is the key tree page's legal-control key, andtests/keyring.test.jspins that page's vector). Leaves are HKDF-SHA256 (saltlineage/v0) and must stay byte for byte with lineage's key tree page;tests/keys.test.jsholds values read off that page. - Keyrings (
src/orgchain/keyring.js): every key signs the statement with its own chain's message standard (BIP-322, EIP-191, a NIP-01 event), so real wallets can make and check the proofs. Keep those formats exact and their pinned vectors passing; a new chain's key joins only with its own standard and a vector to pin. - Secrets show only behind Reveal, reset on every selection, and match the key tree page byte for byte (the tests pin hashes of the page's own output).
- The page makes no network requests; keep it that way (the deployed CSP sets
connect-src 'none'). - Before shipping:
npm test,npm run build,npm run test:e2e.