Execution Contract
The Execution Contract is the foundational agreement in HardKAS that makes the intended execution boundary explicit. It prevents environmental cross-contamination (e.g., executing a localnet plan on mainnet) and establishes a rigid, verifiable pipeline for all state mutations.
At a conceptual level, the Execution Contract enforces that every state transition follows a strict sequence of accountability, separating intent from execution.
The Contract Sequence
Every transaction in HardKAS must fulfill the following contract stages:
- Intent: The developer declares a desired state change (e.g., "Send 10 KAS to Alice"). This is unvalidated raw input.
- Planning: HardKAS evaluates the intent against the target environment's state (UTXOs, maturity, fees) and generates a deterministic plan.
- Signing: A designated custody boundary approves the plan and provides cryptographic signatures.
- Execution / Submission: The signed payload is submitted to the target environment's RPC or simulation engine.
- Receipt / Evidence: The environment acknowledges the submission, producing a receipt.
- Verification: The resulting state is validated against the original intent and plan.
- Replay Boundary: Because the contract preserves all inputs and cryptographic linkages, the exact execution can be replayed in a compatible simulation environment to debug failures or verify determinism.
Conceptual vs. Concrete Implementation
Conceptually, the Execution Contract is the promise that state cannot be mutated without a verifiable trail of intent and evidence.
Concretely, this contract is implemented via the ExecutionTarget schema and the Artifact Engine. Every plan explicitly declares its target execution environment:
type ExecutionTarget = {
mode: "simulator" | "localnet" | "rpc" | "l2-rpc";
domain: "kaspa-l1" | "evm-l2";
network: string; // e.g. "simnet", "mainnet"
};
HardKAS actively rejects artifacts if their embedded ExecutionTarget does not match the active context, acting as a fail-closed Execution Guard.