Kaspa covenants can pay miners to execute themselves (CATMA draft)

I’d like feedback on a draft standard for self-executing covenants on Kaspa L1.

The problem: a covenant whose condition is met still waits for someone to submit the spend. If the app that created it shuts down, nobody may ever do it.

The idea: the covenant carries its own bounty. Once its DAA score arrives, anyone may spend it, but only into the payout fixed at creation. Whatever the payout leaves is the transaction fee, so the miner who includes the spend is paid for executing it. No new opcode, no keeper key, no server, no consensus change. It’s a convention on top of what Toccata already has.

Full spec: docs/CATMA/Covenant-Activation-Through-Miner-Action-v0.1-Specification.md at main · kasperolabs/docs · GitHub

How it works

T1 (one-shot, time-triggered). The trigger branch has no signature check. It requires:

  1. tx.lock_time >= N (CLTV).
  2. The output at this input’s index pays the committed beneficiary script.
  3. That output is at least input - bounty, where bounty = min(B0 + K * (lock_time - N), BMAX).

The mempool only accepts a tx whose lock_time is below the virtual DAA score, so lock_time is a lower bound on “now” that the spender picks. The bounty climbs until it clears at any fee level, capped at BMAX. Pairing each input with its own output index lets triggers batch, and no covenant can lose more than its own bounty. T1-N is the same template without an owner escape, for payments that can’t be revoked.

Discovery. A P2SH output only shows a hash, so a payload record carries the params. Scanners rebuild the script and check the hash; records are hints, never trusted. Template IDs use the KCC-1 template hash.

Durability. Payloads are pruned after about 30 hours, so a covenant set to fire in a year could be lost if its creator is gone. A beacon covenant fixes that: anyone may spend it once per period, only to republish the committed records in its payload (checked with OpTxPayloadSubstr) and pay itself back, minus a capped miner fee. A cold-starting scanner finds everything in the last 30 hours of blocks.

Why the fee and not a payout to the submitter: a keyless output paying whoever submitted can be swapped by any block producer, so the standard pays miners directly.

Limits I found

  • Script can enforce “not before” but never “not after”, so pure time windows are out. Deadlines need a signed event score (reserved for oracle templates).
  • A signed oracle expiry can’t be enforced for the same reason. Only event semantics work (“crossed X at score d”).
  • Permissionless isn’t guaranteed: it needs one broadcaster. The beneficiary has every reason to be that broadcaster.

Status

Checked against rusty-kaspa master by reading the code (opcodes, CLTV semantics, finality rule, standardness, relay floor, pruning). Nothing has run on testnet yet; that’s next.

Questions

  1. Is relying on lock_time as a spender-chosen lower bound on time sound for an escalating fee, or is there a reason not to?
  2. Payload format: CATMA records and the beacon need a payload section. I’d rather fit the envelope from @michaelsutton’s inter-covenant communication thread than claim the whole payload. Today the beacon hashes the full payload, which a section layout would fix.
  3. Could a KIP-21 opening give a script an authenticated upper bound on time? That would make deadlines enforceable.
  4. Pool operators: would you run a scanner? Is a way to keep a trigger out of the public mempool wanted, or is the public path enough?
  5. Does this belong as a KCC?
2 Likes