Commit graph

23 commits

Author SHA1 Message Date
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
60b2140432 feat(build-b): B1 TronHTLC primitive validated on Nile + DGB in landscape
B1 (Build B milestone 1): TRC20 hashed-timelock contract on Tron, the
Tron leg of the BCH<->Tron atomic swap. Validated on Nile testnet, all 6
checks PASS:
- claim with correct preimage succeeds, credits receiver
- wrong preimage reverts at the sha256 guard ("bad preimage")
- refund reverts before timelock ("not expired"), succeeds after

Uses SHA-256 (matches AtomicSwapHTLC.cash) so one preimage spans both legs
in B2. Compiled solc 0.8.35 evmVersion=istanbul for TVM; swap id computed
client-side via keccak256(abi.encodePacked(...)) to mirror the contract.

  contracts/tron/TronHTLC.sol, TestTRC20.sol
  scripts/tron-htlc-b1.mjs (harness), tron-balance.mjs (Nile balance util)

Also folds DigiByte (DGB) into the chain landscape: List A native-Script
HTLC (reuses BTC P2WSH HTLC code, ~15s blocks) + dgbDGB row in List B2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 20:28:07 +02:00
walerikus
2823e1f1a6 docs(asm-dex): scope Build B (USDT-Tron <-> BCH rail) + Tron address gen
Build B scope: both flavors (trustless swap + lock-and-mint tUSDt), a
6-milestone test program (B1 Tron HTLC -> B6 bonded trust floor), deps,
locked decisions (sha256 both legs, oracle witness v1, USDm swap counterpart),
and honest trust-minimized caveat for the bridge. Adds reusable
tron-gen-address.mjs (Nile keypair, gitignored).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 08:53:07 +02:00
walerikus
4d04e347ed docs(asm-dex): cross-chain send/receive chain & asset landscape
Two-list landscape for the multichain taxonomy cells:
- List A (DEX-Atomic): trustless swap, value leaves source; grouped by
  primitive (native Script HTLC / contract HTLC / XRPL crypto-condition /
  Monero adaptor-sig).
- List B (ASM-Multichain): lock-and-mint IOU onto BCH, value stays;
  backend pipeline + two peg types (stablecoin-backed vs native-coin 1:1)
  + B1 stablecoin sources and B2 native L1 coins (BTC/ETH/SOL/BNB/TRX/...).

Adds 2026 stablecoin distribution data, build priorities (USDT-Tron first),
and positioning: BCH as a decentralized, no-KYC interchain settlement hub
(honest trust-minimized caveat for the List B bridge). README cross-linked.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 03:30:02 +02:00
walerikus
6f115c08a0 docs(t6): mechanics, economics & topology deep-dive
Captures the conceptual material from the latest discussion (not in the existing T6 docs):
- enforcement: BTC never compares states; staleness = revocation-key handover; the victim
  delivers the revocation sig in their own penalty tx; the watchtower bot is a relayer, not
  an oracle (no trust); CSV window ~1 day; an honest close can't become stale.
- receive model: LN sign-to-receive = "be present" (like cash) -> can't receive offline;
  T6 inherits it; native BCH receives while offline (the digital ideal restored).
- topology: chain-as-backbone + light clients vs LN's node-mesh-with-hubs; the chain carries
  the always-on burden, not nodes; custodial services can run T6 without a node.
- multi-party: N-of-N funding easy, N-party live operation hard (all must sign); channel
  factories; the BCH board extends to N trivially.
- tokens: T6 uses an NFT only (no fungible token); value stays BTC, BCH holds only the record.
- economics: custodial-LN fees vs BCH (sourced) — spread is a fiat markup not an LN haircut;
  entry/exit is on-chain (WoS 1.95% / Cash App up to $20 vs BCH <$0.001); real cost is custody.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 02:13:43 +02:00
walerikus
7d0e95801e docs(asm): ASM DEX category taxonomy + Agora asm-panel mock
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 22:12:05 +02:00
walerikus
20f83a59bd docs(fiatm): expand design+synthesis, add sovereign-asset note, exchange demo & AncientGreekCoins; MBA status tick
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 22:12:04 +02:00
walerikus
cdb598daee docs(coinspectrum): design record for the CoinSpectrum aggregator
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 22:12:03 +02:00
walerikus
c0a06149b7 docs(t6): the reasoning — why demonstration, not argument
Standalone "why" companion to the technical T6 docs. Captures the reasoning thread:
- the epistemics (finite-time expertise -> specialized truth doesn't travel by consensus;
  lacks-expertise != wrong, but deferral propagates error in a captured environment; the
  honest form is the derivation, not a borrowed "90%");
- the information environment (Vol.13/14: the cash->"digital gold" reframe + the protocol
  track; Bezmenov four-stage lens; the demoralization finding that facts don't move a
  conditioned mind, grounded in motivated reasoning; Alinsky tactics; media capture);
- why BTC users feel insecure (HODL/digital-gold conditioning makes holding feel safe and
  use/swap feel like loss/heresy -> they accept lock-and-wait models like LN);
- the conclusion: reasoning fails on a conditioned mind, so demonstrate -- show don't accuse,
  meet them in their experience (Model 3 / T6 keep-your-BTC on-ramps), demos are
  uncounterattackable because they need no intentionality claim;
- strategy and integrity align (lenses, not accusations).

Discipline: documented mechanism vs interpretation kept separate throughout.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 02:04:47 +02:00
walerikus
48cc3ea808 docs(t6): standalone T6 model explainer
Self-contained explainer of the T6 model: what it is (a BTC channel whose state record
lives on the BCH chain instead of an LN node), how it works (clerk/bailiff — BCH records,
BTC settles), the step-by-step mechanics (open / transact / cooperative close / unilateral
exit + revocation penalty), how it differs from LN (state-record location → no node, no
lost-state, permissionless watchtower, two light wallets), the trust model (penalty as a
"BTC tax"; denial > penalty on BCH-native), LN interop (HTLC-capable T6 = LN channel with a
BCH watchtower; submarine swap to fund), what's validated on real coins, and why it matters.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 01:52:20 +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
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
995fc6c8a7 design: ASM/DEX swap taxonomy docs + interactive mockup
Add Parameters/ASM DEX/ — the 2×2 swap taxonomy (counterparty × chain):
- README: ASM (single-party, zero counterparty) vs DEX (P2P); automation
  ladder (CLOB/AMM same species, ASM off-ladder); exchange = function, not
  a P2P market.
- ASM-Orbital-Swap-native, ASM-Multichain, DEX-native-Order-book,
  DEX-Multichain-Atomic-Swaps — one doc per cell.
- ASM-Multichain: source-chain qualification (VM-script vs Monero fallback),
  wrapped-IOU source-chain prefix marker (εUSDT / τUSDT), reverse unwrap
  (burn→unlock), and three-tier trust model (custodial vs oracle vs trustless).

Add design/mockups/bch-dex.html — interactive, testable mockup of all four
cells: ASM Orbital Swap (FIATm/MBA types, size-independent rate), ASM
Multichain Swap (ETH/USDT/USDC, ε prefix badge, Wrap⇄Unwrap flip), DEX order
book (CLOB + two-sided AMM LP), DEX atomic swap (HTLC stepper).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 18:22:09 +02:00
walerikus
27b43f9cf0 design: fiat ramp is a standalone product, not a wallet feature
Record the decision: the fiat on/off-ramp is built as an independent product
(own repo/deployment/brand); the Deviant wallet is one consumer via API/SDK,
alongside third-party embedders. Follows the established split-out + white-label
pattern (CoinSpectrum, Deviant Labs co-brand). ADR-0036 on-ramp aggregator
becomes a client of the product.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 22:39:28 +02:00
walerikus
2cac4d512a design: fiat on/off-ramp product definition (catalogue + escrow + two counterparty classes)
Adds Parameters/DEX_P2P/fiat-ramp-product.md — the product layer over the
settlement engine in p2p-fiat-crypto-exchange.md:

- Non-custodial infrastructure: catalogue + escrow + oracle + reputation;
  platform holds nothing and converts nothing (light-touch posture).
- Two counterparty classes on one backend: individuals (pure P2P, non-KYC,
  self-proved zkTLS) and specialized operators (licensed/vetted, automated,
  carry own compliance) — with class + jurisdiction disclosure.
- Trade flows for each lane; regulatory posture (operators carry compliance;
  regulation follows operator AND customer; geo-controls + disclosure).
- Positioning: "BestChange's network + reach, but escrow- and oracle-protected";
  micro-swap wedge; Telegram + web distribution.
- Scope: fiat↔crypto only; crypto↔crypto is the separate multichain DEX.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 22:16:01 +02:00
walerikus
9b9c2b9dca design: DEX + P2P architecture records (native book, HTLC ramp, fiat oracle)
Capture the DEX/P2P design worked out this session under Parameters/DEX_P2P/:

- dex-architecture.md — the exchange model (AMM is an order type, not a venue);
  one infrastructure with two entry ramps + two skins; THORChain-insolvency
  note validating the no-protocol-vaults thesis.
- bch-dex-development.md — native BCH order-book engineering spec (order
  covenants, multi-input taker settlement, the 100KB tx cap, indexer/matcher).
- cross-chain-htlc-ramp.md — HTLC entry-ramp spec (two-leg atomic swap,
  T_B<T_A timelock ordering, BCH covenant, BTC/EVM counterparty legs).
- p2p-fiat-crypto-exchange.md — fiat-leg payment oracle + settlement covenant;
  receipt-vs-sender-proof decision resolved to sender-proof (2b) via the
  three-adversary test (new §4a), refund-default victim mislabel fixed.

Design records only; no code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 04:43:05 +02:00
walerikus
6551e6c074 docs: repoint stale references to renamed FIATm design record
Follow-up cleanup to the USDm -> FIATm reorg: update the remaining cross-references
that still pointed at Parameters/usdm_complete-design_FOR-design-record.md to its
new path Parameters/FIATm/fiatm_complete-design_FOR-design-record.md.

Touched: src/oracleUsdm.ts, wiki/decisions.md, wiki/sound-money-primer.md, and the
FIATm/MBA-Shares design records. Adds Parameters/FIATm/fiatm-comparisons.html.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 02:10:36 +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
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