SPEC.md writes lineage/v0 down as an ordinals metaprotocol: the envelope fields, chain order, authority by verified parents, every rule, ownership by sat. bin/lineage-index.mjs reads lineage events from a real ord server and folds them with the same reducer the lab uses. tools/regtest rehearses the sample on Bitcoin Core regtest with standardness on: the lab's own action code signs on a chain funded only by coins imported from regtest (LocalChain.importCoin), each beat's transactions are broadcast byte for byte and mined, ord indexes them, and --compare checks the same events in the same beats, the same metadata and parents, every inscription in the same output and the same trees. tests/indexer.test.js replays a recorded run. The first rehearsal found that reveals committed to tapscript's re-encoded tapleaf, which real Bitcoin rejects. They now commit to the exact script bytes, and the local chain checks script paths per BIP-341/342, still loading reveals made before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4upF5LVwmPDDqrhdUfnXh
33 lines
2.9 KiB
Markdown
33 lines
2.9 KiB
Markdown
# 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`, and `SPEC.md` says 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 and `SPEC.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 eight inputs and
|
|
outputs whose key-path signatures may carry 0x83, coins imported from a real chain, and BIP-341/342 checks of
|
|
reveals' script paths, all in `src/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`: the buyer pre-signs the whole transaction and the holder countersigns.
|
|
An offer is signatures kept in the lab, never chain state, and who holds an item is read off the chain, never
|
|
from metadata. Inscription metadata is public and permanent, so never put a secret in it (item notes included).
|
|
- 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. Leaves are HKDF-SHA256 (salt `lineage/v0`) and must stay byte for byte with lineage's key tree page;
|
|
`tests/keys.test.js` holds values read off that page.
|
|
- 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`.
|