Commit graph

16 commits

Author SHA1 Message Date
walerikus
5ffb76cd0e feat(scripts): product1 rewards-coin + chipnet address-derivation utilities
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 22:16:31 +02:00
walerikus
0398d7481b feat(football-tote): pari-mutuel tote demo on chipnet + web platform + wiki
Real WC2026-fixture bet placed and settled on chipnet; deployable web platform in design/football-tote plus the chipnet test and tote server; the oracle-result-publish path for third-party totes. Snapshot 0176.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 22:16:29 +02:00
walerikus
bc363a85df feat(sim): USDm historical back-test from real CoinGecko price data
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 22:16:27 +02:00
walerikus
e8a861d76a feat(dashboard): chipnet dashboard server + static dashboard.html
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 22:12:31 +02:00
walerikus
40d19386d3 feat(t6): BCH channel-board HTLC contract + LN to T6 routing script
Adds the BchChannelBoardHTLC covenant and a chipnet LN-to-T6 routing test; pulls in bitcoinjs-lib/ecpair/tiny-secp256k1 for BTC-side channel work and registers the chipnet:dashboard npm script.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 22:12:30 +02:00
walerikus
c4abcbf9b7 docs(t6): record requirements vs LN + LN↔T6 interop; multi-channel scale test
- scripts/chipnet-channel-board-multi.mjs — T6 scale test: 3 concurrent channels = 8
  addresses (6 sign-only/unfunded parties + 1 permissionless watchtower + 1 operator),
  validated on chipnet. The board side scales freely; parties only sign.
- complete record §7: signing is NOT an on-chain event (LN carries signed-but-unbroadcast
  BTC txs); T6 = two light self-custodial wallets vs LN = light wallet + a persistent node
  (BCH absorbs the node's state-keeping + watchtower jobs); LN↔T6 interop — an HTLC-capable
  T6 channel is an LN channel with a BCH watchtower, so LN payments route in off-chain;
  funding from LN funds crosses via on-chain BTC (submarine swap preferred).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 01:43:14 +02:00
walerikus
8dd2c558bb feat(t6): trustless unilateral-exit penalty on signet — T6 is the complete LN replacement
T6c: the no-cooperation Lightning-faithful layer. The commitment pays the closer to a
revocation output [ OP_IF <revPub> CHECKSIG OP_ELSE <CSV> CSV DROP <closerPub> CHECKSIG
OP_ENDIF ]. Honest close = ELSE after the CSV delay; a STALE broadcast = the counterparty
sweeps via the revocation key (IF branch), immediately — the penalty.

Validated on real signet (scripts/btc-signet-penalty.mjs): funded 2-of-2 (6163...), Alice
broadcast a revoked commitment (b76d17..., her 4500 to the revocation output), Bob penalised
it (b35186..., seized the 4500). Cheating costs the whole balance -> unilateral exit is
trustless. BTC enforces the penalty (it holds the funds); the BCH board says WHEN to act.

So T6 is complete: BCH records state, BTC locks/settles/penalises. Only the honest CSV-
delayed self-close (liveness mirror) is unrun. Record + tracker updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 00:27:33 +02:00
walerikus
8a11193004 feat(t6): BCH-as-LN-board + real BTC 2-of-2 channel on signet — "better LN" validated
T6 ("Bitcoin Cash as a better Lightning", for LN users): keep LN's model, replace LN's
private must-not-lose must-stay-online node with a public on-chain BCH record.

- contracts/BchChannelBoard.cash + scripts/chipnet-channel-board-test.mjs — the BCH board:
  both-signed, strictly-monotonic on-chain state record; stale update rejected; anyone reads
  it; impossible to lose. Validated on chipnet (state 0->1->2).
- scripts/btc-signet-channel.mjs — the BTC leg on REAL signet (bitcoinjs-lib v7): funded a
  2-of-2 (764238..., 10000 sat), cooperative close (af4db7..., Alice 5700 / Bob 3800).
  Chained off the unconfirmed funding — open->settle in one pass. BCH records, BTC settles.

Complete design record: Parameters/T6_BitcoinCash_LN/T6_BTC-BCH_complete-record.md
(the full BTC<->BCH spine, the 3-model menu, every T-model with results). Tracker updated
(T5/round-trip/Model-3/T6 all validated).

Pending: T6c trustless unilateral-exit (penalty/revocation on BTC) — the no-cooperation
Lightning-faithful layer. package.json left uncommitted (BTC deps mixed with another session).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 00:20:01 +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
4b785d8323 feat(crosschain): BTC↔BCH test program — HTLC swap, native channel, on-chain rails, BTC-IOU
Validated on chipnet — the "BCH as BTC's L2" program (three models, ship all):
- T1 AtomicSwapHTLC — HTLC hashlock+timelock primitive (claim/reveal/refund + guards).
- T2 BchPaymentChannel + BchChannelClose — native-BCH payment channel: 2-of-2/covenant
  funding, off-chain commitments, cooperative close, covenant-enforced penalty-on-stale,
  finalize-after-CSV. BCH is judge + memory (BTC can't — no ANYPREVOUT).
- T5 + round-trip — swap into BCH, transact on-chain to brand-new recipients (0-conf,
  offline-receive, no channel), swap back. Model 2 (swap) end to end.
- Model 3 BTC-IOU — reuse DeviantWrapMintIOU: mint a BTC-IOU, transact it on-chain, no
  off-chain/LN/node/hub, publicly-verifiable backing. The captured-audience on-ramp.

Snapshots 0172/0173/0174 + program tracker + cross-chain design record §11.
Covenants compile under cashc 0.12.1; all chipnet runs PASS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 22:28:34 +02:00
walerikus
a71841fc29 feat(crosschain): SafeERC20 refund fix + robustness suite + naming model
Hardening pass on the USDt→τUSDt wrap (builds on 0170's end-to-end validation).

Security fix — found via robustness testing:
- UsdtLockNile used require(token.transfer(...)) assuming a bool return; real
  Tether-style USDt returns nothing → the refund path reverted, which would
  STRAND the locker's funds. Fixed with SafeERC20 handling (no-data or true) on
  both transfer/transferFrom; redeployed to Nile (TVahBUBqUDLqVjDn77Yav…Vnn2o).
- scripts/tron-wrap-robustness.cjs: R2 (too-early) and R3 (consumed) revert for
  the right reason (decoded on-chain revert). R1 (self-refund) validated against
  a clean standard token — contracts/tron/MockUsdt.sol + tron-refund-validate.cjs
  — since the Nile faucet USDT has a non-standard transfer that reverts for
  contract senders.

Naming model (revises the prefix-primary stance):
- identity = CashToken category; human name = USDt + a network badge (the "BIC");
  the ε/τ prefix is a text-only fallback. Applied to the mockup (ASM·Multichain:
  name+badge, prefix in button/stepper, synced selectors, new source-chain
  dropdown Ethereum/Tron→ε/τ) and to ASM-Multichain.md / README.md, plus the
  cross-chain-redemption non-goal (per-chain IOUs + AMM swap, not a universal IOU).

Design record:
- Parameters/ASM DEX/cross-chain-asm-concept-and-state.md — concept, the
  trustless-vs-authority analysis, oracle vs light-client vs zk, the VM wall, the
  reference hacks, the trust ladder, and the 48-hour build state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 23:05:48 +02:00
walerikus
f32c28ed84 feat(chipnet): USDm/PUSD AMM + real cross-chain wrap USDt→τUSDt
Build A — DEX, validated on chipnet:
- scripts/chipnet-amm-usdm-pusd.mjs: USDm/PUSD constant-product swap on the
  first-party SharePairAMM (ADR-0030); price discovery 1.000→1.440 PUSD/USDm,
  constant product held. No Cauldron needed (it's mainnet-only).

Build B — cross-chain wrap, validated end-to-end across Tron Nile + chipnet:
- contracts/DeviantWrapMintIOU.cash: mint-on-attestation IOU covenant —
  checkDataSig oracle gate, NO BCH backing (dust only; value is the source
  lock, ADR-0035), replay-bound to the reservoir outpoint.
- scripts/chipnet-wrapmint-iou.mjs: BCH leg — genesis reservoir into the
  covenant, oracle-attested mint of τUSDt, replay rejected by the covenant.
- contracts/tron/UsdtLockNile.sol + scripts/tron-deploy-lock.cjs: Nile lock
  contract (lock/markConsumed/refund), deployed at TXmMRnau9Ct…ZintH.
- scripts/tron-bch-wrap.mjs: the oracle watcher — locked 0.5 real USDt on
  Nile → minted 500000 τUSDt on chipnet → markConsumed. Genuine USDt→τUSDt.

Docs (Parameters/ASM DEX/ASM-Multichain.md): which source chains qualify,
reverse unwrap, three-tier trust model, source-chain prefix marker, and the
cross-chain-redemption design decision (universal IOU = non-goal; per-chain
IOUs + BCH AMM swap = the answer; CCTP does not cover BCH).

Deps: tronweb ^6.3.0, solc ^0.8.35. Keys/state gitignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 22:07:58 +02:00
walerikus
599202a721 chore: checkpoint working tree — shell Tier-B retirement + accumulated WIP
Snapshot of accumulated work-in-progress on top of the baseline commit.

This session — retire Tier B from the wallet shell (single-tier model, glossary
"Tiers & trust"):
- SendFlow.tsx: BCH-only; removed the non-functional Tier-B send path, the D-4/D-5
  raw-BCH co-display, and the ADR-0013 friction ladder.
- ArtemisionScreen.tsx: Create wizard collapsed to a single 5-step on-chain genesis
  flow; tier-selection step + Tier-B branch (prepareTierBImport) deleted.
- QuickActions.tsx / SettingsScreen.tsx: receive note reworded; "Send friction
  thresholds" + "Tier explainer" rows removed; registry-trust note reworded.
- Verified: tsc clean, vitest 74/74, full preview walkthrough, no console errors.

Pre-existing uncommitted work also folded in:
- USDm -> FIATm family rename/reorg (Parameters/FIATm/, design records)
- ~130 chipnet + sim-fiatm scripts (catalytic-converter, hyperinflation backtests)
- snapshots 0153-0168; wiki updates (glossary, decisions, index); ADR-0044/0045
- mockups + additional shell screens (Agora, Apps, MainScreen, AssetDetail, ...)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 01:01:37 +02:00
walerikus
e7f867f263 refactor: retire legacy OP_RETURN-era swap files
Remove the pre-CashTokens swap stack superseded by the native-CashTokens
path (ADR-0006/0007): src/swapMath.ts, src/swapBuilder.ts,
contracts/OpenMintToken.cash, and their tests. De-reference the remaining
consumers (src/index.ts re-exports, src/oracleUsdm.ts, scripts/chipnet-swap.mjs
+ classify-tests.mjs comments) and update the "known divergence" note in
wiki/index.md (this was its last outstanding item). Snapshot 0154.

Build clean; full suite 489 pass / 0 fail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 21:20:40 +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
walerikus
3148c05119 feat(onramp): SideShift Tier-3 in-wallet shift (ADR-0036 amendment)
Add Level-B for SideShift: the server creates a SideShift variable shift
via the authenticated API and shows the deposit address in-wallet; BCH
settles to the user's OWN address, so self-custody is preserved end-to-end
(funds never touch the wallet operator). Other providers stay link-out.

- src/onramp/sideshift-shift.ts: createVariableShift / getShiftStatus /
  verifySideShiftSecret (injected fetch, typed errors). Endpoints verified
  against docs.sideshift.ai; live secret check passes GET /v2/account.
- web: OnrampContext.sideshiftSecret/affiliate from SIDESHIFT_SECRET /
  SIDESHIFT_AFFILIATE env; handlers + routes GET /api/onramp/config,
  POST /api/onramp/shift, GET /api/onramp/shift?id=. Secret stays
  server-side (a test asserts it never appears in the response).
- ui: SideShift card gets "Swap in wallet" (deposit address + range +
  6s status poll) when shiftEnabled, with an "Open site" link-out fallback.
- guard: mainnet-only — a bchtest:/bchreg: settle address is rejected with
  a switch-to-mainnet message (SideShift settles mainnet BCH).
- scripts/deviant-web.mjs auto-loads .env; .env.example documents the keys.
- ADR-0036 amended: Tier-3 admitted narrowly for non-custodial API swap
  providers only.

Full suite 478 pass / 0 fail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 20:57:31 +02:00