Commit graph

9 commits

Author SHA1 Message Date
Local Dev
a623aae040 feat(keystore): master-password encryption for Keys/chipnet-keystore.json
Adds AES-256-GCM + PBKDF2-SHA256 (200,000 iterations) encryption for the
consolidated chipnet keystore. Loader auto-detects the encrypted format
(`chipnet-keystore/2-encrypted`) and prompts for the master password on
first use — or reads CHIPNET_KEYSTORE_PASSWORD env for scripted/CI runs.
Password cached in-process only.

- scripts/chipnet-keystore-encrypt.mjs — one-shot encrypt in place;
  backs up plaintext to Keys/chipnet-keystore.plain.bak (also gitignored)
- scripts/chipnet-keystore-decrypt.mjs — --check, --in-place, --stdout,
  --out=<path> modes for verification and one-time exports (bulk import
  into a wallet UI, migration, key rotation)
- scripts/lib/chipnet-keystore.mjs — adds loadAllAsync(),
  getEntryAsync(), ensureKeystoreUnlocked(); sync API still works on
  plain keystores and throws a clear "call *Async instead" on encrypted
  ones until unlocked once at boot

Test coverage: round-trip encrypt+verify+load-async validated end-to-end;
plain-keystore path still loads all 12 wallets unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-09-01 23:58:47 +02:00
Local Dev
6130c0cab1 feat(asm): Potidaea swap-relay + tally refresh to 52,998
Prove the Potidaea platform-fee revenue model live on chipnet with two
end-to-end swap-relay tests, then sweep the cumulative chipnet-swap tally
from "17,000+" to the exact figure 52,998 across every referencing doc.

Snapshot 0239 (four revisions) captures the full arc — GMX Potidaea
(9,296 swaps · 5.47 M platform bits) → OpenMint Potidaea (26,599 swaps ·
15.02 M platform bits · 30.03 M founder bits · 44 swaps/sec peak · 2:1
founder/platform ratio matching ADR-0053 spec exactly). Client-added
platform-fee output at tx.outputs[3] — no covenant change required.

Ships the multi-source connectivity layer used throughout:
scripts/lib/chipnet-multisource.mjs (race local Fulcrum + BCHN RPC +
public electrums, chipnet-only endpoint list, wrong-network tip-guard,
belt-and-braces broadcast) and scripts/lib/chipnet-keystore.mjs (single
Keys/chipnet-keystore.json for all wallets, legacy per-file fallback).
Keys/ added to .gitignore.

Also: GMX/Game.X zero-bet-fee policy — chipnet-gmx-game-loop-test.mjs
now returns 0n from escrowFee() by default (feeAmount=0 on the escrow
covenant; already covered by the "if feeAmount > 0" gate at
GamePoolEscrowFlat.cash:54, no covenant change needed). Old formula
kept behind ARBITER_FEE_LEGACY=1 env flag.

Canonical tally table lives in
Parameters/ASM_Native/ASM-single-asset-throughput.md §4a; update it
first when the next throughput runs land, then grep-replace the exact
number across dependent files.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-14 01:39:41 +02:00
Local Dev
debd6a6fbb chore: sweep in-flight work across all domains
Snapshot commit rolling up ~255 files of coherent-but-multi-domain in-flight
work that had accumulated on this branch. Split by area:

Contracts + covenants
- New: AsmFxSwap, DeviantOpenMintNBA, DeviantTieredMintOracleFT,
  TermCouponVault, UniformReserve, UniformReserveAggregate.
- Verify-artifact refresh (src/verify/artifacts/*.json + canonical.ts).

Wallet + shell (shells/app + src/wallet)
- App.tsx, MainScreen, ArtemisionScreen, AssetDetail, AgoraScreen,
  SettingsScreen, Unlock, TokenImportModal, UniformFiat/DepositPanel,
  KatalogosPanel (renamed from PinaxPanel), shell.css.
- src/wallet: wallet.ts, runtime.ts, index.ts. Core registry/chipnetFile.
- Deleted stale hook: useAllDevBalances.ts.

Cross-chain + correspondent (services/correspondent + scripts)
- Correspondent server/bch/config updates for PYUSD Solana, EURC Sepolia,
  aggregate reserve flows.
- New scripts: PYUSD roundtrip, EURC onboarding, GMX game loop /
  genesis / mint sanity, tiered mint fee, aggregate reserve, product2
  shares dividends, product3 t-bond, uniform fiat cell tests.

Telegram order-book (P2PExchange bot)
- db.ts, index.ts, en/ru locales — updates upstream from the extracted
  standalone repo at D:/Dev/P2PExchange.

Docs — Parameters (specs), wiki, snapshots, design mockups
- Parameters: FIATm/MBA_Shares/Potidaea/Anthemus refinements +
  ASM_CrossChain/DebitCredit + UniformFiat + Anthemus DEX MVP prompt +
  Artemision + Athenae Politeia + Philosophy + SSHkeyServer runbook +
  new dApp/{Artemision,Katalogos,Pinax,Pari_escrow,SURFACES}.
- wiki: cross-chain, games-tote, glossary, governance/voting-systems,
  infra, wallet, wallet-ui-design, decisions (ADR log).
- snapshots: catch-up entries and INDEX regeneration.
- design: mockups refreshed (agora, asset-detail, assets-tab, potidaea)
  + Potidaea assets + tote deploy notes.

Housekeeping
- .gitignore: exclude the new root test/session state files
  (.sol-vault-keys.json, .football-tote-state.json,
  .tote-platform-state.json, .redeem-roundtrip-state.json,
  .eurc-onboard-state.json — some contain oracle privkeys / vault
  secretKeyBase58; NEVER commit) + the .usdm-historical-chart.html
  chart output + MS Office `~$*` lock files + scripts/bundle-surfaces
  `build/` output. Also add scripts/bundle-surfaces.mjs.
- CLAUDE.md, WALLET-COORDINATION.md, snapshots/INDEX.md, design/README.md
  refreshed.
- package.json / package-lock.json bumps.

Verified: sensitive files at repo root confirmed ignored (git check-ignore
each). No `.env`, no raw WIF/xprv/mnemonic/secretKey/oraclePriv strings in
the staged diff. MS Word autosave file (`Parameters/Philosophy/~$*.docx`)
excluded and gitignored.

The WizardConnect responder work landed separately in the previous commit
(6987591); this is everything else that had accumulated alongside it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-29 01:14:33 +02:00
walerikus
757d381776 feat(t6-mvp): wire BTC 2-of-2 lifecycle into the wallet — real open + coop close
The self-custodial agent now drives BOTH chains of a T6 channel, closing the gap
Phase 4b left open (board-only). Open funds a real BTC 2-of-2 on signet coordinated
with board state 0 (1:1 capacity); Close settles the 2-of-2 to the board's latest
split via a cooperative-close PSBT co-signed over the keyless relay — the co-signer
verifies the payout against the board before signing (verifyClose: outputs == board
split AND input spends our 2-of-2; no blind-signing). BTC pubkeys ride the hello
handshake; each agent still holds only its own keys, relay holds none.

Validated on real coins (two agent processes):
  BTC fund   c0832299 (10000 sat 2-of-2)  [signet]
  board #0   04ccc060 (6000/4000)         [chipnet]
  A→B 2000   fd3367bd (4000/6000)
  B→A 1000   d968a524 (5000/5000)
  coop close a380d0e4 → Alice 4750 / Bob 4750  [signet, 2 outputs spend the 2-of-2]

Adds t6-btc.inspectClose + agent Close flow + UI Close button/BTC panel. Finding:
bitcoinjs v7 returns witnessScript as Uint8Array — Buffer.from() before .toString('hex').
Spec §3.5/§4/§5/§6/§7 + snapshot 0189.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 00:52:39 +02:00
walerikus
b5211f0fbd feat(t6-mvp): two-party self-custodial wallet protocol (Phase 4a)
T6Wallet (scripts/lib/t6-wallet.mjs) — one party's self-custodial wallet holding only its
own key. Two wallets pay each other over a transport: payer signs the next state, peer signs
it remotely, board is updated (payUni). No shared keys, no tx co-signing; the transport carries
only a proposal + a 64-byte state signature. Validated on chipnet (t6-wallet-p2p-demo.mjs):
open + 3 payments both directions, monotonic 1->3, final Alice 40000 / Bob 60000.

The MVP functional core is now complete (engine + self-custodial board + BTC 2-of-2 PSBT +
this protocol). Remaining: Phase 4b front-end UI (relay + client-side keys). Snapshot 0187.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 18:14:52 +02:00
walerikus
0db77e154d feat(t6-mvp): self-custodial channel engine — board (checkDataSig) + BTC 2-of-2 (PSBT)
The T6 MVP core: both halves of a channel co-signed self-custodially, each party holding
only its own key. Validated on chipnet + BTC signet.

- Phase 1 — engine library (scripts/lib/t6-engine.mjs): T6Board with open/pay/settleHtlc/
  readState behind a clean API + injected per-party signers. Demo t6-engine-demo.mjs
  (open + 2 pays + read on chipnet).
- Phase 2 — self-custodial BCH board (contracts/BchChannelBoardUni.cash +
  t6-selfcustody-uni-demo.mjs): a state update is authorized by BOTH parties' checkDataSig
  over the state MESSAGE (channelId||state||balances), signed independently with each own
  key — no transaction co-signing. Sidesteps cashscript's inability to co-sign a tx across
  two key-holders (the both-signed board would need the WalletConnect signing path). channelId
  is a bytes32 constructor arg both sides control (no VM tokenCategory byte-order ambiguity;
  makes the address unique per channel = anti-replay). Validated update 932ad30d.
- Phase 3 — self-custodial BTC 2-of-2 (scripts/lib/t6-btc.mjs +
  t6-btc-selfcustody-close.mjs): real signet 2-of-2 funded + cooperatively closed to the
  board's agreed split, co-signed via bitcoinjs PSBT (Alice signs → base64 → Bob signs →
  finalize). Neither party holds the other's key. PSBT multi-party signing is native/clean,
  unlike the BCH board. Fund 98fa1d2d, close 413e52f8 (Alice 5700 / Bob 3800).

The transport carries only a PSBT (base64) or a 64-byte state signature — small, dumb, non-LN.
Remaining: Phase 4 (self-custodial wallet UI). Snapshots 0185, 0186.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 02:28:47 +02:00
walerikus
850afd651d feat(t6): validate BTC↔BCH end-to-end + bonded M-of-N + wallet UX (ADR-0046)
"Bitcoin Cash as a better Lightning" (T6) and the BTC-IOU trust floor, validated
end-to-end on BCH chipnet + BTC signet with real coins.

- LN→T6 routing: a routed payment received into a T6 channel; one preimage settles
  both chains (BCH board reveal -> BTC HTLC claim). Scripts: chipnet-ln-to-t6-routing,
  btc-signet-ln-leg, btc-claim-htlc.
- T6c unilateral exit complete: honest CSV-delayed self-close (ELSE branch) added
  alongside the penalty branch (btc-signet-honest-close).
- T4 real BTC↔BCH atomic swap: one hashlock over a signet P2WSH HTLC + chipnet
  AtomicSwapHTLC; claim + refund (btc-bch-htlc-swap). Fixes btc-htlc.mjs bigint bug.
- Model-3 bonded M-of-N redemption: BondedSignerSlash.cash (equivocation -> slash) +
  2-of-3 signet release; BTC enforces the threshold, BCH enforces the punishment
  (chipnet-bonded-signer-test, btc-signet-mofn-release).
- T6-aware wallet UX: one-tap send/receive over the validated stack, every tap a real
  on-chain BchChannelBoard update (t6-wallet-server + design/t6-wallet); fresh-provider
  + retry hardening for flaky-chipnet broadcasts.
- Docs: ADR-0046, spec §16, Observability-and-privacy companion (the auditability
  property + the three-baseline privacy framing), complete-record/model-explainer/
  tracker updates, snapshots 0177–0179.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 00:27:04 +02:00
walerikus
e779963b78 chore(crosschain): BTC-signet tooling scaffold for the real BTC leg (T4)
- scripts/lib/btc-htlc.mjs — P2WSH HTLC mirroring AtomicSwapHTLC.cash (same SHA256
  hashlock, same claim/refund split, signet via esplora). Not yet run.
- scripts/btc-signet-setup.mjs — generate/show the gitignored signet funding key.
- .gitignore — ignore .btc-*.json (signet testnet keys).

Deps (bitcoinjs-lib, ecpair, tiny-secp256k1) intentionally left in package.json's
working tree, not committed — package.json carries an unrelated uncommitted line from
another session (chipnet:dashboard); same reason a71841f kept it out.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 22:28:49 +02:00
walerikus
518a3ce174 chore: initial project baseline — full Deviant codebase under version control
Brings the whole project into git (previously only the on-ramp feature and
a few parallel files were tracked). Includes: wallet core (src/), CashScript
contracts/, the Capacitor shell (shells/), scripts/, tests, and the docs
corpus (wiki/, snapshots/, Parameters/, Archive/, KnowledgeBase text).

Excluded via .gitignore: node_modules/, dist/, .env (secrets), testnet WIF
key files (.chipnet-*.json, devWallets.ts), KnowledgeBase/RAW media (~9.6 GB),
transcripts/ (session logs), and machine-local config (.claude/*.local,
*.lock). Secret-scanned before commit — no credentials in the tree.

Note: src/swapMath.ts, src/swapBuilder.ts, contracts/OpenMintToken.cash are
legacy (OP_RETURN era) but still imported; committed as-is, flagged for a
separate removal once de-referenced.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 20:38:07 +02:00