Script Challenges
Test your Bitcoin Script knowledge. Each challenge shows you a locking script — your job is to figure out the unlocking script that makes it pass.
beginner
#1. The Number
beginnerThe lock expects a specific number. Can you push the right one?
#2. Quick Math
beginnerPush two numbers that add up to 9.
#3. Double Up
beginnerPush one number. The lock duplicates it and adds both copies. Result must be 10.
intermediate
#4. Choose Wisely
intermediateA nested IF/ELSE: two booleans select one of four outcomes (2, 3, 4, or 5). The lock checks for 4. Which two booleans open the path that pushes 4?
#5. Reverse Order
intermediatePush two numbers A and B. The lock swaps them, subtracts (B − A), verifies the result is positive, then checks it equals 3.
#6. Twin Values
intermediatePush two identical numbers. The lock duplicates the top, copies the second (OP_OVER), verifies they match, then adds the two originals. Sum must be 8.
#7. Secret Word (HASH160)
intermediateFind the preimage. The lock hashes your input with HASH160 (RIPEMD160(SHA256(x))) and checks the digest — the same hash used in Bitcoin addresses.
#11. Range Gate
intermediatePush one number. The lock checks it is in the range [3, 10) (≥ 3 and < 10), then multiplies it by 2. The result must equal 10.
#12. Two Paths
intermediateThe lock has two paths: IF checks SHA256(preimage), ELSE checks HASH160(preimage). We want the ELSE path. Push the preimage and the boolean that selects ELSE.
advanced
#8. String Builder
advancedPush two byte strings that concatenate to "helloworld" (hex: 68656c6c6f776f726c64). OP_CAT is restored on BSV.
#9. Alt Stack Trick
advancedPush two numbers. One goes to the alt stack, the other is doubled, then the alt value is added. Result must be 11.
#10. Rabin Check
advancedVerify a Rabin signature: the lock computes s² mod n and checks it equals 4. Public key n = 77 (0x4d). Find a valid signature s.
#13. Dual Secret
advancedThe lock requires two different SHA256 preimages. The first (top of stack) must hash to one digest, the second to another. Push both in order.
#14. Byte Split
advancedPush one 10-byte value. The lock splits it at position 5 (OP_5 OP_SPLIT), then verifies the left half is "hello" and the right half is "world".
#15. Stack Depth
advancedPush exactly three numbers. The lock verifies stack depth is 3 (OP_DEPTH), then adds all three. The sum must equal 12.
#16. Message Auth
advancedThe lock concatenates two fields (sender and message) with OP_CAT, hashes with SHA256, and checks the digest. Find a valid [sender, message] pair that matches the locked hash.
#17. Conditional Dual Hash
advancedSame lock as Two Paths: IF = SHA256(preimage), ELSE = HASH160(preimage). This time we want the IF path. Push the preimage and the boolean that selects IF.
Want to experiment with custom scripts?
Open Script Lab