simplebond is a TypeScript toolkit (the original sketch mentioned Python; this repo is TS-only) for modelling programmable fixed-income (“digital bond”) issuance and settlement on Bitcoin-aligned rails. It aligns with covenant-without-soft-fork research (PIPEs v2: witness encryption for conditional signing, IACR 2026/186, Delving Bitcoin; PRECOP: Simplicity-style templates + atomic swaps, BitcoinWorldTrustFoundation/precop, press overview)—but only ships logic that belongs in audited TypeScript today. See Project brief ↔ this repository (below) for the exact exports.
Treat this as an education / integration sketch: not a production wallet, indexer, or audited Elements deployment.
Simplicity roadmap context (developer tooling & interpreter evolution) stays authoritative at docs.simplicity-lang.org/resources/roadmap; behavioural nuance belongs in Simplicity execution model.
Secondary reporting on PIPEs v2 (plain-language summaries) occasionally appears via outlets such as Blockspace—defer to primary sources (eprint/Delving Bitcoin) for protocol detail.
| Idea-doc requirement | Implemented as |
|---|---|
| Bond terms → programmable UTXO / Simplicity-aligned plan | buildBondCovenantIr (JSON covenant IR) + compileBondToTaproot (CLTV Taproot leaf scripts + bcrt1p; no shipped .simp/bytecode). |
| Client-side validation without broadcasting | validateSettlementTrace, buildCouponSchedule / couponAmountForPeriodSats (bigint). |
| Atomic settlement (HTLC + adaptor-style hooks) | htlcSha256, htlcHash160, randomPreimage32, adaptorCommitmentPointXOnly (wallet/MuSig2/PSBT wiring out of scope). |
| ~30 day bond: issue, pay coupons, redeem principal | simulateThirtyDayRegtestLifecycle, npm run demo (offline JSON narration; npm run demo:run if dist/ already built). |
Requires Node ≥ 18.
npm install
npm run ci # vitest + `rm -rf dist && tsc`
npm run demo # offline 30‑day narration (rebuilds dist)
npm run demo:run # optional: rerun demo only when dist/ is fresh| API | Ship status |
|---|---|
buildCouponSchedule, couponAmountForPeriodSats, buildBondCovenantIr |
Stable TypeScript. Bigint APR math + covenant manifest. |
compileBondToTaproot, payments.p2tr |
Regtest/demo Script. Mirrors IR branch count one-for-one against Taproot leaf cardinality. |
validateSettlementTrace |
Pure logic. Suitable for dashboards & bondholder proofs without broadcasting. |
| Atomic settlement primitives | Scaffolding. Hash/link + curve point derivation only—still need PSBT/MuSig2 choreography from your wallet stack. |
| Full Simplicity→UTXO codegen | Out of repo scope unless you bolt on hal-simplicity/Liquid infra; IR exists to interoperate instead of pretending we emit bytecode. |
Issue + validate + narrate programmatically:
import {
simulateThirtyDayRegtestLifecycle,
summarizeRegtestLifecycleJson,
} from 'simplebond';
const run = simulateThirtyDayRegtestLifecycle(/* optional issuanceHeight */);
console.assert(run.clientValidation.ok);
console.log(JSON.stringify(run.covenantIr, (_, v) => (typeof v === 'bigint' ? v.toString() : v)));
console.log(summarizeRegtestLifecycleJson());BLOCKS_PER_DAY defaults to 144 (~10 min blocks) purely for exposition; tweak couponPeriodBlocks/gracePeriodBlocksAfterCouponDue for your simulator cadence.
- Demo fixture private keys (
src/demo/thirtyDayDemonstration.ts) are textbook placeholders—never mainnet funds. - Choose an internal Taproot key whose discrete log stays unknown if you insist on disabling key spends; blindly reusing signer pubkeys defeats that property.
- PIPEs v2 is early-stage cryptography: follow the ePrint discussion and Delving Bitcoin design thread for witness-encryption assumptions, verifier economics, and evolving ciphertext footprints (public summaries sometimes cite coarse storage estimates that are meant to tighten over time—not modeled in this repo).
| Script | Behaviour |
|---|---|
npm test |
vitest (compiler/IR parity, validators, hashing, adaptor determinism, lifecycle JSON). |
npm run ci |
npm test then npm run build (one-shot green check). |
npm run build |
Cleans dist/, emits ESM+CJS-compatible library output (tsc). |
npm run demo |
Rebuild (rm -rf dist && tsc) then runs dist/demo/regtestLifecycle.js. |
npm run demo:run |
Runs the demo CLI against existing dist/ only (fail-fast if not built). |
MIT.
Telegram: @AuraTerminal