OP_MAX is used in Bitcoin scripting to compare two numerical values from the stack. When executed, it pops the top two items, which are expected to be numeric values, and then evaluates which of the two is larger. The larger of these two values is then pushed back onto the stack. This opcode is crucial in scripts where decisions are made based on the comparison of numerical values, such as in certain types of conditional transactions or complex multi-condition scripts.
OP_Code Walkthrough
Pushes the larger of the top two items on the stack onto the stack.
Pop Top Item
Pop Next Top Item
Push Maximum of Two Items