Skip to content
KasLabDevsPublic

About

Open-source development framework for Kaspa L1: CLI and TypeScript SDK, a managed rusty-kaspa simnet node, SilverScript and Toccata covenant workflows, and verifiable transaction artifacts. Testnet-10 behind an explicit opt-in; mainnet locked.

Topics

Resources

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

590 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HardKAS

Open-source development framework for Kaspa L1: CLI, TypeScript SDK and IDE. Website: hardkas.dev · Docs: hardkas.dev/docs

npm License: MIT Node.js CI Release Status

HardKAS is an open-source, local-first development framework for Kaspa L1: a CLI and a TypeScript SDK to plan, send and verify transactions and SilverScript contracts on your own simnet node. It is an independent community project, not an official Kaspa tool.

Inspired by the developer ergonomics of Ethereum tooling like Hardhat and Foundry, HardKAS provides:

  • Instant In-Memory Simulator (experimental): Plan, sign and simulate Kaspa transactions locally in seconds, with no node and no network. It is an approximate model: confirm timelock, covenant and mass behaviour on simnet (limitations).
  • Managed Docker Localnet: One-command local simnet running official rusty-kaspad v2.1.0 (pinned by image digest) with automatic CPU mining.
  • Deterministic Accounts & Funding: Pre-configured developer accounts (alice, bob, carol) for reproducible test flows.
  • SilverScript & Covenants Toolchain: Managed integration for the official silverc v1.0.0 compiler, P2SH deploy/spend, and Toccata 1:1 auth-bound covenants.
  • Cryptographic Artifacts: Every transaction plan, signed payload, and receipt is hashed into immutable JSON artifacts that can be verified offline. Simulator runs can also be replayed.
  • Visual IDE & Studio: Standalone visual developer workbench with Monaco editor, SilverScript compiler, Deploy & Run, Covenant graph and local node telemetry (HardKas IDE).

Important

Kaspa L1 is a UTXO BlockDAG, NOT an EVM. HardKAS is built from first principles for Kaspa's UTXO and Kaspa Script architecture. It provides the developer experience of Hardhat for the Kaspa ecosystem without pretending Kaspa is an EVM or executing Solidity bytecode on L1.


HardKAS vs. Ethereum Tooling (Hardhat & Foundry)

Feature / Dimension Ethereum (Hardhat / Foundry) Kaspa L1 (HardKAS)
Ledger Model Account-based global state UTXO Proof-of-Work GHOSTDAG (BlockDAG)
Smart Contracts EVM Bytecode (Solidity / Vyper) Kaspa Script & SilverScript Covenants (Toccata)
Fast Unit Testing Hardhat Network / Anvil (local EVM) HardKAS Simulator (in-memory synchronous UTXO engine)
Local Node Testing Local geth or anvil container Managed Docker rusty-kaspad on simnet with CPU miner
State Inspection Transaction traces & state diffs Verifiable JSON Artifacts (TxPlan, SignedTx, TxReceipt)
Verification & Debug Hardhat console / console.log Offline artifact verification; deterministic replay of simulator runs
Dev Server & APIs Hardhat Node / Remix HardKAS Dev Server (@hardkas/dev-server REST & SSE)

60-Second Quickstart

Requirements: Node.js 24.22.1 exactly (the version HardKAS is built, tested and pinned on: engines declares it, and hardkas doctor warns on another 24.x and fails on other major lines) and npm. Docker only for the local node.

1. Initialize a Workspace

Release note: 1.0.0 is the first stable release (see Version Guarantees). It publishes 18 packages, where the last candidate, 0.13.0-rc.3, had 22 (@hardkas/escrow is now in @hardkas/sdk, @hardkas/jobs in @hardkas/toolkit, @hardkas/node-orchestrator in @hardkas/node-runner and @hardkas/sessions in @hardkas/core). Use @latest (or @1.0.0) when installing from npm, or pnpm hardkas inside this monorepo.

# Initialize a new HardKAS workspace with deterministic accounts
npx @hardkas/cli@latest init my-kaspa-app
cd my-kaspa-app
# init writes a package.json that pins @hardkas/cli; install it so `npx hardkas` runs the project's copy
npm install

2. Fast In-Memory Simulation (No Node Required)

# Plan, verify, and simulate an in-memory transaction
npx hardkas tx plan --from alice --to bob --amount 10 --network simulated --out tx-plan.json
npx hardkas artifact verify tx-plan.json --strict
npx hardkas tx sign tx-plan.json --account alice --out tx-signed.json
npx hardkas tx send tx-signed.json --network simulated --yes

# Replay the simulator run, using the receipt ID printed by send (replay covers simulator runs only)
npx hardkas replay verify <receipt-id>

3. Managed Localnet (Real rusty-kaspad + Mining)

# Start a real local Kaspa simnet node in Docker with automated mining
npx hardkas localnet start --profile toccata-v2
npx hardkas localnet status --json
npx hardkas localnet fund alice --profile toccata-v2

To run a node of your own instead (your container, your ports) and take one payment, a SilverScript contract and a covenant all the way to artifact verify, follow Build on your own simnet.

Build on Kaspa with AI

If you are using Claude Code, Cursor, or another AI coding agent:

4. Local Dev Server & Visual IDE

# Launch the headless local developer API & telemetry daemon (http://localhost:7420)
npx hardkas dev

# For the complete visual studio & workbench (editor, compiler, covenant graph, node manager):
# Run HardKas IDE (https://github.com/KasLabDevs/HardKasIDE)

Why HardKAS

Normal apps:

request -> mutation -> hope

HardKAS:

intent -> artifact -> verification -> execution -> replay

The entire lifecycle of Kaspa UTXOs—from genesis injection to final signature submission—can be tracked, hashed, signed, processed in the simulator, receipted and indexed. Simulator runs can be replayed; real-node sends are checked with hardkas verify and hardkas tx status.

The Execution Contract

HardKAS 1.0.0 uses the strictly partitioned Execution Contract. The Execution Contract is a tuple of (mode, domain, network) that unambiguously identifies the context in which an artifact was created, an execution target is connected, or an account exists.

  • mode: The environment topology (simulator, localnet, rpc, l2-rpc)
  • domain: The ledger semantics (kaspa-l1, evm-l2)
  • network: The network identifier (simulated, simnet, testnet-10, mainnet)

Common targets:

  • Simulator: { mode: "simulator", domain: "kaspa-l1", network: "simulated" } The JS-based, in-memory, synchronous transaction simulator. Accounts, UTXOs, and funds are strictly synthetic.
  • Localnet: { mode: "localnet", domain: "kaspa-l1", network: "simnet" } A real Kaspa node (rusty-kaspad) running locally via Docker on simnet with real Proof-of-Work and local mining.
  • RPC: { mode: "rpc", domain: "kaspa-l1", network: "testnet-10" } A remote connection to a configured Kaspa node.

Compatibility Invariants:

  • artifact.execution MUST be compatible with target.execution.
  • account.network/identity MUST be compatible with target.execution.
  • receipt.execution MUST be compatible with artifact.execution AND target.execution.

Warning

Simulator != Kaspa simnet

simulated (network) = In-memory synthetic Kaspa ruleset in HardKAS simulator mode. simnet (network) = Official Kaspa network type used by HardKAS localnet mode.

Local-First Status

HardKAS 1.0.0 is local-first deterministic transaction infrastructure for Kaspa/Toccata development.

Current baseline, verified by the release checks:

  • simulator is the recommended default for fast, synchronous testing.
    • Toccata v2 Docker localnet baseline (rusty-kaspad on Kaspa simnet).
  • Real local funding by mining with the upstream kaspanet/cpuminer image in localnet.
  • Standard transaction lifecycle against the local node.
  • SilverScript through the official silverc v1.0.0: P2SH deploy/spend and 1:1 auth-bound covenants on the local node.
  • Machine-verifiable golden corpus.
  • Release gauntlet through pnpm gauntlet:toccata.
  • mainnet is blocked: nothing in HardKAS signs, sends or connects to mainnet in this release line.
  • HardKAS is not a wallet, custody system, consensus layer, or production mainnet signing environment.

Toccata v2 Localnet Baseline

The 1.0 release line includes a normalized Toccata v2 localnet flow:

  • Docker rusty-kaspad v2.1.0 localnet (pinned by digest) funding with a compatible miner companion (kaspanet/cpuminer).
  • Standard transaction lifecycle against the local node.
  • SilverScript compile, P2SH deploy/spend and a 1:1 covenant transition on the local node, each capability reported on its own by the Toccata gauntlet (simulated steps do not count).
  • Machine-verifiable golden corpus (fixtures/toccata-v2/silver), recompiled and re-derived offline by the gauntlet.

Full Kaspa VM or consensus equivalence is not claimed.

Official release claims:

  • artifactCoherence: READY_MATCH
  • runtimeOutcome: PARTIAL
  • vmConsensusEquivalence: NOT_CLAIMED
  • mainnet: BLOCKED_BY_POLICY

SDK Parity

1.0.0 includes high-level SDK surfaces for capabilities, localnet status/start/fund, and SilverScript compile and corpus verification, without changing the release claims above. It enforces strict separation of execution environments across Artifact lineage.

The SDK plans, signs and sends SilverScript deploys, spends and covenant transitions on a node through sdk.covenants (transaction v1); sdk.experimental.silver compiles, reproduces and derives P2SH addresses (simnet).

Programmability Builder Surface

1.0.0 also includes a local-only builder surface for SilverScript, ZK corpus fixtures, and vProgs artifact inspection. This is a programmability surface, not a protocol/runtime claim.

Programmability surfaces:

  • hardkas programmability capabilities --json
  • hardkas programmability corpus verify fixtures/toccata-v2 --json
  • hardkas programmability inspect <path> --kind silver|zk|vprog --json
  • hardkas programmability app plan --kind full-lab --json
  • await sdk.experimental.programmability.capabilities()
  • await sdk.experimental.programmability.corpus.verify({ path })
  • await sdk.experimental.programmability.inspect({ kind, path })

ZK corpus surfaces:

  • hardkas zk capabilities --json
  • hardkas zk proof inspect <path> --json
  • hardkas zk proof verify-local <path> --json
  • hardkas zk corpus verify fixtures/toccata-v2/zk --json
  • await sdk.experimental.zk.capabilities()
  • await sdk.experimental.zk.proof.inspect(path)
  • await sdk.experimental.zk.proof.verifyLocal(path)
  • await sdk.experimental.zk.corpus.verify(path)

vProgs inspect surfaces:

  • hardkas vprogs capabilities --json
  • hardkas vprogs status --json
  • hardkas vprogs inspect <artifact> --json
  • await sdk.experimental.vprogs.capabilities()
  • await sdk.experimental.vprogs.status()
  • await sdk.experimental.vprogs.inspect(path)

SilverScript v1 (hardkas silver): the official silverc v1.0.0 and the Kaspa SDK, with real-node evidence per capability in fixtures/toccata-v2/silver — P2SH execution, relative timelock, and a Toccata tx-v1 1:1 auth-bound covenant transition. General covenant support is not claimed.

ZK/vProgs lab claims:

  • ZK_CORPUS_SURFACE_READY and VPROGS_INSPECT_SURFACE_READY (local inspection surfaces only; no runtime or on-chain claim)
  • Groth16 corpus verification is local fixture coherence only.
  • RISC Zero Groth16 receipts are verified locally against the pinned RISC Zero key (hardkas zk toccata verify-receipt); HardKAS builds the lock scripts, and hardkas zk toccata spend sends a lock's spend through HardKAS's own send (recorded, one submission per txId; simnet and testnet-10 only, proven on simnet). The node verifies the proof: HardKAS claims no on-chain ZK verification of its own.
  • vProgs is inspect-only.
  • ZK_ONCHAIN_VERIFICATION_NOT_CLAIMED
  • VPROGS_STABLE_API_NOT_CLAIMED
  • vmConsensusEquivalence: NOT_CLAIMED
  • mainnet: BLOCKED_BY_POLICY

Release Gates

pnpm build
pnpm test
pnpm packaging:smoke
pnpm gauntlet:toccata

pnpm test is the canonical gate. CI runs it on Ubuntu, Windows and macOS from the frozen lockfile. For a release, run it hermetically:

node scripts/gate-hermetic.mjs --home <a HARDKAS_HOME with kaspa-wasm installed>

That run gives the gate a private HARDKAS_HOME, makes Docker unreachable, refuses every non-loopback connection and, by default, also refuses loopback connections to the managed localnet's ports 16210 (gRPC), 17210 (Borsh wRPC) and 18210 (JSON wRPC), and to 18211, a port some suites fall back to. A kaspad or simulator that happens to run on the machine therefore cannot change the verdict. --deny-ports a,b replaces that list. --allow-local-node-ports turns it off for diagnosis only, and a run made that way is not the release gate. Node-dependent suites run at their own levels (vitest.simnet.config.ts, vitest.silverc.config.ts), never inside this gate.

Stable and experimental features

Most CLI commands state their maturity at the end of their --help description: stable, beta, preview, alpha, experimental, research or internal; an unlabelled command is not stable. Only stable commands are covered by the release scope. On the SDK, the surfaces under sdk.experimental.* carry no stability promise. hardkas capabilities --json prints a warning that it is internal/experimental. The levels, and what each one promises, are described in docs/status/versioning.md, and the known gaps in docs/status/limitations.md.

Not covered by any guarantee:

  • @hardkas/simulator (experimental: an approximate model, not consensus evidence);
  • the L2 extension (@hardkas/ext-l2) and the L2 library (@hardkas/l2), experimental and not published in this release;
  • @hardkas/pskt-native, which is on hold and not published; @hardkas/sdk does not depend on it. Its prebuilt binary is built from rusty-kaspa 2.0.1 crates (not v2.1.0, which the rest of HardKAS pins). It ships for win32-x64 only, with no hash recorded in its provenance, and its index.d.ts is empty, so TypeScript consumers that import it do not compile. Its signer is permissive (audit HK-13). Rebuilding it is BLOCKED while the package is on hold. The SDK's PSKT surface uses the kaspa-wasm adapter unless the native one is registered explicitly. See limitations.

Toccata localnet and corpus commands:

hardkas localnet start --profile toccata-v2
hardkas localnet status --json
hardkas localnet fund alice --profile toccata-v2
hardkas corpus verify fixtures/toccata-v2/silver --json

30 Second SDK Example

import { Hardkas } from "@hardkas/sdk";

// Runs on the simulator; without `network` (or `target`) the workspace's default execution target decides.
const sdk = await Hardkas.create({ network: "simulated", autoBootstrap: true });

const plan = await sdk.tx.plan({ from: "alice", to: "bob", amount: "10" }); // a string amount is KAS
const signed = await sdk.tx.sign(plan, { account: "alice" });
const { receipt } = await sdk.tx.simulate(signed);

// Replay is addressed by the receipt's artifact id (its contentHash), not by its txId.
const replay = await sdk.replay.verify(receipt.contentHash);

console.log(receipt.txId, replay.passed); // synthetic-<64 hex> true

CLI Reference

HardKAS CLI commands are scoped to execution worlds:

Simulator

Synthetic testing without real nodes. Uses JS-based synthetic state and accounts.

HardKAS includes deterministic accounts (alice, bob, carol) by default, but you can create custom ones:

hardkas simulator account create custom-wallet
hardkas simulator fund custom-wallet --amount 1000
hardkas tx send --from custom-wallet --to bob --amount 10 --network simulated --yes

Localnet (Managed Environment)

A complete managed developer environment wrapping a real rusty-kaspad node. It provides orchestration for local mining (PoW), real Kaspa simnet UTXOs, and developer-friendly local accounts.

hardkas localnet start --profile toccata-v2
hardkas localnet account create treasury
hardkas localnet fund treasury

Explicit artifact boundary

hardkas tx plan --from alice --to bob --amount 10 --network simulated --out tx-plan.json
hardkas artifact inspect tx-plan.json
hardkas artifact verify tx-plan.json --strict
hardkas tx sign tx-plan.json --account alice --out tx-signed.json
hardkas tx send tx-signed.json --network simulated --yes

Core Concepts

Artifacts

Immutable JSON files representing planned transactions, signed payloads, receipts, traces, workflows, and replay reports. They use canonical hashing so the same inputs produce the same identity across platforms.

Lineage

The causal chain between artifacts. A receipt points back to a signed transaction, which points back to the original plan.

Replay

The local verification engine that reconstructs a simulator workflow from artifacts and checks whether the observed state transition remains deterministic. It covers simulator runs only.

Query Store

A rebuildable SQLite projection over .hardkas/artifacts and local events. It exists for fast reads by CLI, query services and dev-server; the filesystem artifacts remain the source of truth.

Guarantees

  • Deterministic hashing through canonical serialization.
  • Tamper detection by recalculating artifact hashes at consumption time.
  • Planning and signing isolation.
  • Rebuildable projections from committed artifacts.
  • Toccata v2 localnet baseline guarded by pnpm gauntlet:toccata.
  • Mainnet signing, broadcast and connections blocked in this release.

What HardKAS Is Not

  • Not a production wallet.
  • Not a custody system.
  • Not a consensus layer.
  • Not a replacement for Kaspa nodes.
  • Not a promise that local simulation equals mainnet finality.

See docs/ for architecture, limits, command references, and security claims.

About

Open-source development framework for Kaspa L1: CLI and TypeScript SDK, a managed rusty-kaspa simnet node, SilverScript and Toccata covenant workflows, and verifiable transaction artifacts. Testnet-10 behind an explicit opt-in; mainnet locked.

Topics

Resources

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages