OP_TUCK is a stack manipulation opcode that duplicates the top item on the stack and inserts the duplicate copy before the second-to-top item. It essentially 'tucks' a copy of the top item underneath the second item, while preserving the original top and second items on the stack. OP_TUCK is often used in Bitcoin scripts for stack manipulation operations, allowing for the duplication and rearrangement of specific items without modifying the original stack order.
OP_Code Walkthrough
Duplicates the top stack item and inserts the duplicate copy before the second-to-top item.
Remove the top two items from the stack
duplicates the top item on the stack
push the new rearranged items back to the stack