Bitcoin Script Simulator (Stack Machine)
Bitcoin doesn't have "accounts" or "balances". It has UTXOs (Unspent Transaction Outputs) locked by small programs (Scripts). The execution engine is a LIFO (Last-In, First-Out) stack virtual machine. Execute the following scripts step-by-step to see how data and Opcodes interact.
Bitcoin Script: how funds are locked and unlocked
Bitcoin Script is the simple, stack-based language used to write the conditions for spending an output. It has no loops, which makes it predictable and safe. Each transaction includes a locking script (scriptPubKey) and, when spent, an unlocking script (scriptSig or witness) that must satisfy it.
The most common script, Pay-to-Public-Key-Hash (P2PKH), duplicates the public key, hashes it, compares it with the address hash and checks the signature. Nodes run both scripts one after the other: if the stack ends with a true value, the spend is valid.
How to use the simulator
Pick one of the scripts (standard P2PKH, a maths puzzle or a custom one) and step through it or run it all at once. At each instruction you will see what goes in and out of the stack and why the final result is valid or not.
Operations you will see
OP_DUP duplicates the top item, OP_HASH160 applies SHA-256 and RIPEMD-160, OP_EQUALVERIFY compares and stops execution if they differ, and OP_CHECKSIG verifies the signature. OP_CHECKMULTISIG is used to build multisig setups.
Note
The simulator is educational and does not cover every opcode or the Taproot consensus rules.