KasBonds is a reference implementation of the Kaspa Service Bond Protocol (KSB).
KSB is a Kaspa-native bond primitive for trust-minimized service commitments:
- a provider stakes KAS against a promise
- proof is submitted and verified
- the bond is either released or slashed based on outcome
- slash routing is policy-driven and protocol-aware
This repo currently combines:
- a TN12 covenant proof harness
- a Next.js reference app
- an evolving
/api/v1KSB protocol surface - canonical schema and protocol planning docs
The KSB plan runs in ten phases (see PLAN.md).
| Phase | Scope | Status |
|---|---|---|
| 1 | Toccata testnet covenant proof | Complete - TN12 release and slash paths confirmed |
| 2 | Data layer | Complete - canonical KSB schema |
| 3 | Protocol layer API | Complete - versioned /api/v1 surface |
| 4 | Verifier hub | Complete - built-in rule catalog, hub dispatch, composable AND/OR rule sets, custom verifier registration |
| 5 | Cron resolvers | Complete - resolve-expired, auto-verify, dispatch-verifiers, rebuild-party-history |
| 6 | SDK | Complete - published to npm as ksb-sdk |
| 7 | Reputation layer | Complete - ERC-8004 aligned reputation profiles |
| 8 | Reference integrations | Complete - agent SLA, bug bounty, personal commitment |
| 9 | Testnet end-to-end | In progress - e2e/ harness built, awaiting a live testnet 12 run |
| 10 | Mainnet launch | Not started - gated; runbook prepared in MAINNET_LAUNCH.md |
- TN12 release-path and slash-path covenant proofs
- canonical KSB schema and the versioned
/api/v1protocol surface - app registration, canonical bond create/list/detail, status polling
- proof submission and contest routes
- built-in verifier rule catalog (http, content, time, signature, oracle)
- verifier hub dispatch (protocol-computed rule execution)
- composable AND/OR verifier rule sets
- custom verifier registration (app-owned signed webhooks)
- resolver and maintenance cron routes
- party history, score, and ERC-8004 aligned reputation profiles
- OpenAPI spec and the published
ksb-sdkpackage - three reference integrations and the Phase 9 verification harness
- Phase 9 needs a live testnet 12 deployment to run
e2e/and the on-chain release and slash steps; results land inTESTNET_VERIFICATION.md - Phase 10 is blocked on three hard gates: Toccata mainnet activation confirmed, the external security audit complete, and Phase 9 green
See also:
STATUS.mdPLAN.mdGAP_ANALYSIS.mdTESTNET_VERIFICATION.mdMAINNET_LAUNCH.mddocs/KSB_API_V1.md
app/- Next.js app and API routeslib/ksb/- canonical KSB repository + protocol helperslib/bonds/- legacy BondClaw-era reference flow still kept during transitionschema/- raw SQL schema and rebaseline docscontracts/- SilverScript bond contractsartifacts/- compiled covenant artifactsscripts/- TN12 and schema utility scriptsreferences/- standalone reference integrations built onksb-sdke2e/- Phase 9 end-to-end verification harnessdocs/- operator and protocol docsvendor/- vendored dependencies used by the proof harness
npm install
npm run typecheck
npm run buildFor local app work:
npm run devFor schema application:
npm run db:applyFor TN12 proof work, start with:
docs/TN12_HARNESS.mddocs/OPERATOR_WORKFLOW.mdCOVENANT_SPEC.md
Copy the example env file and fill in the required values:
cp .env.example .env.localMain values used in this repo include:
TURSO_DATABASE_URLTURSO_AUTH_TOKENTN12_WRPC_URLTN12_NETWORKTN12_PRIVATE_KEY- verifier/slash/operator destination addresses
The recommended way to integrate is the published TypeScript SDK,
ksb-sdk. It wraps the whole
/api/v1 surface with typed methods, so reach for it before calling the
HTTP API directly.
npm install ksb-sdkimport { KsbClient } from 'ksb-sdk';
const ksb = new KsbClient({ baseUrl: 'https://ksb.example', apiKey: '...' });
const bond = await ksb.getBond('bond_...');Runnable examples live in sdk/examples/, and references/ holds full
standalone reference integrations for the agent SLA, bug bounty, and
personal commitment use cases. The raw routes below are the surface the SDK
is built on.
Current KSB protocol routes:
POST /api/v1/apps/registerGET /api/v1/bondsPOST /api/v1/bondsGET /api/v1/bonds/:bondIdGET /api/v1/bonds/:bondId/statusPOST /api/v1/bonds/:bondId/submitPOST /api/v1/bonds/:bondId/dispatchPOST /api/v1/bonds/:bondId/contestPOST /api/v1/bonds/:bondId/releasePOST /api/v1/bonds/:bondId/slashGET /api/v1/parties/:addrGET /api/v1/parties/:addr/scoreGET /api/v1/parties/:addr/reputationPOST /api/v1/cron/resolve-expiredPOST /api/v1/cron/auto-verifyPOST /api/v1/cron/dispatch-verifiersPOST /api/v1/cron/rebuild-party-historyGET /api/v1/verifier-rulesPOST /api/v1/verifier-rules
Details live in docs/KSB_API_V1.md.
Protocol artifacts:
- OpenAPI:
docs/openapi/ksb-v1.openapi.yaml - SDK source:
sdk/(published asksb-sdk)
SDK helpers:
npm run sdk:typechecknpm run sdk:buildnpm run sdk:examples:typecheck
SDK examples live in sdk/examples/:
quickstart.ts- operator app bootstrap, bond creation, status readagent-sla.ts- agent-to-agent SLA bond verified byhttp_status_checkbug-bounty.ts- bug bounty escrow with a composed AND/OR rule set, including the contest pathcustom-verifier.ts- register an app-owned signed webhook verifier and dispatch it inside a bond
- The repo is mid-transition from an earlier BondClaw proof app into a cleaner KSB protocol reference implementation.
- Raw SQL is used through
(db as any).$client.execute()by design. - The vendored dependencies make the repo larger, but keep the proof harness self-contained.