Skip to content

Architecture

grysz edited this page Jun 5, 2026 · 1 revision

Architecture

KaspaScript is organized as a compiler pipeline with a programmability kernel on top.

Pipeline

Source.ks
  -> lexer
  -> parser
  -> AST
  -> semantic analysis
  -> typed IR
  -> Kaspa txscript backend
  -> deterministic artifact JSON
  -> kernel package JSON

Workspace Crates

Crate Purpose
compiler/lexer Position-tagged token stream.
compiler/parser Contract AST for params, spend paths, expressions, arrays, calls, and fields.
compiler/semantic Type, scope, finality, builtin, and target-safety checks.
compiler/ir Opcode-agnostic typed instruction layer.
compiler/codegen Source-grounded Kaspa txscript bytecode emission and verification.
compiler/protocol Protocol target manifests and feature gates.
kernel Contract blueprints, capability profiles, wallet previews, indexer schema, fee policy, and readiness.
sdk Compile API and testnet harness surfaces.
cli Developer commands for compile, inspect, verify, package, wallet, tx, and proof flows.

Design Principles

  • Deterministic artifacts.
  • No hidden fees or hidden spend behavior.
  • Unsupported behavior fails before bytecode emission.
  • Source-grounded protocol claims.
  • Separate targets for verified, preview, TN10 Toccata, and future mainnet.
  • Mainnet remains blocked until activation evidence is pinned.

Clone this wiki locally