Toccata 101 · Part 2 · card 1
A script is a list of instructions that a computer runs from top to bottom to complete a task. Most of them are text files. A Kaspa script is not, it is a string of bytes sitting inside a transaction.
Programs in general are built from these. A Kaspa script uses four of them.
A valid Kaspa lock can be a single byte, 0x51, one instruction that is enough to let a UTXO be spent.
For every input a node gets, it creates a fresh new stack. In this stack the node verifies the input is valid.
How?
A UTXO carries a lock, the script_public_key. It was written by the wallet when the output was created.
On a normal wallet coin it's 34 bytes:
script_public_key1 byte32 bytes1 byte
2071
Written as it really is. The 0x in the list above is only a way of writing that says "this is hexadecimal". The script itself carries the bytes without it.
The spend carries an unlock, the signature_script. The spender writes it on that input.
For this we have 66 bytes:
signature_script1 byte64 bytes1 byte
417c
These 2 scripts exist specifically for this purpose, and written automatically by the wallet. The stack is thrown away after the verification is cleared.
In rusty-kaspa, an input is checked by running two scripts in order on one stack that is created for that input and discarded after it: the input's signature script, then the script public key of the UTXO it spends. The signature script may hold only push instructions (crypto/txscript/src/lib.rs, from_transaction_input, execute_inner, execute_script). A push instruction is the number of bytes that follow it, for every length from 1 to 75, and OpCheckSig is 0xac, OpTrue is 0x51 (crypto/txscript/src/opcodes/mod.rs). The standard key lock is OpData32 key OpCheckSig (crypto/txscript/src/standard.rs). A single 0x51 lock is valid for consensus and non standard for a node's mempool, which refuses both the transaction that creates such an output and the one that spends it (mining/src/mempool/check_transaction_standard.rs). Read at release v2.0.1. The bytes on this page are the real ones from 60a2f205…f145914, read from api.kaspa.org on 12 September 2026. The letters and symbols a byte stands for in the hexadecimal window, Hey! and the phrase to decode, follow the ASCII table, one byte per character.