Kaspa-native compiler + programmability kernel

Source-gated contract packages for Kaspa's next upgrade cycle.

KaspaScript compiles a verified V1 contract subset into deterministic Kaspa txscript artifacts, then packages each contract with a capability profile, wallet previews, indexer schema, fee estimates, and a readiness report.

  • schema v0
  • verified TN12
  • Toccata-aware
  • mainnet guarded
Compiler
Verified TN12
Kernel
Package CLI
Mainnet
Activation Guarded
Package
Golden Tested
01 Compiler gated

Unsupported or unpinned protocol surfaces fail before bytecode emission.

02 Package native

Bytecode, ASM, capability profile, wallet preview, schema, fee, and readiness travel together.

03 Kaspa shaped

Contracts are modeled as UTXO transitions with explicit state, signers, outputs, and lineage.

04 Upgrade aware

Targets separate verified TN12, TN10 Toccata, preview, and future mainnet posture.

What it is

A compiler plus the first slice of a Kaspa-native programmability kernel.

The compiler answers whether source can become deterministic Kaspa txscript. The kernel answers whether a builder can ship the app shape safely: what a wallet should show, what an indexer should track, what the fee assumptions are, and what evidence supports the target network.

Architecture

A compiler pipeline with a package kernel on top.

The repo is built as a Rust workspace so each stage has a clear job: parse source, lower to typed IR, emit source-grounded txscript, and attach package metadata that app builders can inspect.

source.ks Lexer + parser

Position-tagged syntax for contracts, params, spends, expressions, and builtins.

typed ir Semantic lowering

Scope, type, finality, builtin, and target-safety checks before backend work begins.

txscript Backend gates

Verified targets emit deterministic Kaspa bytes; preview surfaces warn or block explicitly.

kernel.json Capability package

Wallet previews, indexer schema, fee policy, readiness, source snapshots, and transition profiles.

Kernel

Smart-contract-like, Kaspa-shaped.

KaspaScript models contracts as UTXO state machines instead of an Ethereum-style global account runtime. State is consumed, a transition is validated, and successor outputs preserve lineage.

Capability Profile

Summarizes execution model, feature evidence, spend-path signers, wallet duties, indexer duties, and policy limits for SDKs and automation agents.

Wallet Preview

Emits transition labels, consumed state, created outputs, signers, proof hints, and signing warnings so wallets do not render covenant transitions as ordinary payments.

Indexer Schema

Ships covenant lineage, transition, and wallet preview audit table suggestions with required fields for network, DAA context, status, and outpoints.

Readiness Report

Checks each transition requirement against source evidence. Mainnet packages stay blocked until final activation evidence is pinned.

Package Output

One artifact for bytecode, app metadata, and review.

schema_version

Current package version: kaspascript.kernel.package.v0.

source_snapshots

Pinned Rusty Kaspa tags, commits, and audit dates used for evidence.

artifact

Backend, target, compiler version, finality depth, KIPs, contracts, spends.

bytecode_hex

Compiled txscript bytes in deterministic hex form.

bytecode_asm

Human-readable txscript assembly for code review.

kernel

Blueprint, capabilities, wallet previews, indexer schema, readiness, and fee policy.

kernel.capabilities

Execution model, feature evidence, transition profiles, wallet duties, and policy limits.

fee_estimate

Toccata minimum-standard-fee estimate with explicit assumptions.

{
  "schema_version": "kaspascript.kernel.package.v0",
  "package_target": "verified-tn12",
  "source_snapshots": ["v2.0.0", "v1.3.0-toc.5", "tn10-toc3"],
  "artifact": {
    "backend": "kaspa-txscript",
    "target": "verified-tn12",
    "kip_requirements": [10]
  },
  "kernel": {
    "readiness": {
      "level": "verified",
      "ready": true
    },
    "capabilities": {
      "execution_model": "kaspa-utxo-state-machine",
      "features": ["BaseScript", "WalletPreview"],
      "transition_profiles": ["release", "refund"]
    },
    "wallet_previews": ["release", "refund"],
    "indexer_schema": "covenant_lineage"
  },
  "fee_estimate": {
    "minimum_standard_fee_sompi": 100000
  }
}

Quickstart

Compile, inspect, verify, package.

cargo test --workspace
kaspascript toccata status
kaspascript compile escrow.ks \
  --target verified-tn12
kaspascript inspect escrow.ks
kaspascript verify escrow.artifact.json
kaspascript kernel check escrow.ks \
  --target verified-tn12 \
  --compute-grams 1000 \
  --tx-bytes 400
kaspascript kernel preview escrow.ks \
  --target verified-tn12 \
  --transition release
kaspascript kernel package escrow.ks \
  --target verified-tn12 \
  --compute-grams 1000 \
  --tx-bytes 400

Upstream Watch

Learning from Rusty Kaspa as it moves.

KaspaScript tracks kaspanet/rusty-kaspa through a pinned release lane, a schema-backed CLI digest, and a moving-master watch for early architecture signals.

Pinned Tag

v2.0.0 is tracked as the mainnet Toccata release, with the tagged upgrade guide and activation DAA pinned.

Status Schema

toccata status --json emits release assets, node requirements, fee policy, v1 transaction fields, and KIP mapping.

Mainnet Guard

Production mainnet packages stay blocked until activation at DAA score 474,165,565 is independently verified.

Moving Master

The watch lane tracks storage mass, compute commits, covenant bindings, WASM txscript flags, and RPC JSON shape.

Contract Patterns

Verified examples and future-gated shapes.

Pattern Target status
Escrow Verified TN12
Timelock Verified TN12
Multisig Verified TN12
Atomic swap Verified TN12
Covenant vault Partial / gated
DAGSafeVault blueprint Kernel / TN10-gated

Completion Roadmap

The next work is concrete.

The package format is now golden-tested. The next wave turns capability profiles into deeper contract analysis and tightens CI, SDK packaging, and TN10 fixtures.

Alpha Complete

Machine-readable JSON Schema, CI checks, and package generation from the SDK.

Testnet Complete

TN10 package fixtures, transaction facade, covenant continuation, and indexer cases.

Mainnet Ready

Blocked until activation at DAA score 474,165,565 is independently verified with crate tags, support posture, and fee behavior.