Script
Simulator
Documentation

Generated Bitcoin Script

// Bitcoin Script will appear here...

Commonly Used Scripts

Stack Simulator

See how your script manipulates the stack. Add initial stack values below:

Stack is empty. Add values to simulate execution.

Bitcoin Script Reference

Click on each category to expand and see operation details:

Stack Operations
OP_DUP - Duplicates the top stack item
OP_DROP - Removes the top stack item
OP_SWAP - Swaps the top two stack items
OP_ROT - Rotates the top three stack items
OP_OVER - Copies the second stack item to the top
OP_2DUP - Duplicates the top two stack items
OP_2DROP - Removes the top two stack items
OP_TOALTSTACK - Moves top item to alternate stack
OP_FROMALTSTACK - Moves top item from alternate stack to main stack
Flow Control
OP_IF - Executes statements if top of stack is not 0
OP_NOTIF - Executes statements if top of stack is 0
OP_ELSE - Executes statements if the preceding IF or NOTIF was not executed
OP_ENDIF - Ends an IF/NOTIF/ELSE block
OP_VERIFY - Marks transaction as invalid if top stack value is not true
OP_RETURN - Marks transaction as invalid
Comparison & Bitwise Operations
OP_EQUAL - Returns 1 if the inputs are exactly equal, 0 otherwise
OP_EQUALVERIFY - Same as OP_EQUAL, but runs OP_VERIFY afterward
OP_AND - Boolean AND between each bit in the inputs
OP_OR - Boolean OR between each bit in the inputs
OP_XOR - Boolean XOR between each bit in the inputs
Arithmetic
OP_1ADD - Adds 1 to the top stack item
OP_1SUB - Subtracts 1 from the top stack item
OP_NEGATE - Negates the top stack item
OP_ABS - Returns the absolute value of the top stack item
OP_NOT - Returns 1 if the input is 0, 0 otherwise
OP_0NOTEQUAL - Returns 0 if the input is 0, 1 otherwise
OP_ADD - Adds the top two items on the stack
OP_SUB - Subtracts the top item from the second top item
OP_MIN - Returns the smaller of the two top items
OP_MAX - Returns the larger of the two top items
Crypto Operations
OP_RIPEMD160 - Returns RIPEMD160 hash of the top stack item
OP_SHA1 - Returns SHA1 hash of the top stack item
OP_SHA256 - Returns SHA256 hash of the top stack item
OP_HASH160 - Returns RIPEMD160(SHA256(x))
OP_HASH256 - Returns SHA256(SHA256(x))
OP_CHECKSIG - Verifies a signature
OP_CHECKSIGVERIFY - Same as CHECKSIG, but runs VERIFY afterward
OP_CHECKMULTISIG - Verifies multiple signatures
Time Locks
OP_CHECKLOCKTIMEVERIFY - Marks transaction as invalid if the top stack item is greater than the transaction's nLockTime field
OP_CHECKSEQUENCEVERIFY - Marks transaction as invalid if the relative lock time of the input is not equal to or longer than the value of the top stack item
Script Templates Explained
P2PKH (Pay to Public Key Hash) - Standard transaction that pays to a Bitcoin address.
Format: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
P2SH (Pay to Script Hash) - Allows sending bitcoins to a script hash instead of a public key hash.
Format: OP_HASH160 <scriptHash> OP_EQUAL
Multisignature - Requires M of N signatures to spend.
Format: OP_<M> <pubKey1> <pubKey2> ... <pubKeyN> OP_<N> OP_CHECKMULTISIG
Time-locked - Prevents spending until a specific time.
Format: <locktime> OP_CHECKLOCKTIMEVERIFY OP_DROP