How does Kaspa's covenant system handle one input authorizing multiple outputs?
A single covenant input in Kaspa can authorize one or many covenant outputs within the same spending transaction. The script uses special opcodes — `OpAuthOutputCount` and `OpAuthOutputIdx` — to iterate over the outputs that a given authorizing input is allowed to touch. Because the Kaspa script engine has no general-purpose loops, the covenant script must enforce a hard upper limit on how many authorized outputs are allowed, then manually unroll the verification logic for each possible index up to that limit, checking each output's script public key and any other constraints like amounts or state commitments. This matters for beginners because it means Kaspa smart-contract-like scripts can be flexible (one trigger, many effects) while still being predictable and auditable — there are no hidden loops that could behave unexpectedly.