unlockingScript

open override fun unlockingScript(flatTx: ByteArray, inputIdx: Long, sigHashType: ByteArray, inputAmount: Long, spendingProposal: SpendingProposal? = null): SatoshiScript

Build the unlocking ("satisfier") script authorising a spend of this destination. signInput in wallet.kt calls this with the in-flight tx bytes, the input index, sighash flags and amount, and plants the result as tx.inputs[idx].script.

Three pushes, consumed left-to-right:

  1. Template script bytes — the locking script commits only to hash160(template), so the spender must reveal it.

  2. Constraint script bytes — likewise revealed, so the network verifies the hash and pushes the owner pubkey for CHECKSIGVERIFY.

  3. Schnorr signature over the canonical sighash, whose scriptCode is the TEMPLATE bytes, not the locking or constraint script — the Nexa template convention.

Three pushes rather than the two Pay2PubKeyTemplateDestination uses: well-known templates may skip the template push because the network already has the bytes, and this one is not well-known.

spendingProposal is always null, since atomicSpending is true.