Opcodes · push · enabled
OP_1NEGATE (0x4f)
Pushes the number -1.
Verified
- Stack in → out
- ∅ → -1
- Since
- Original Bitcoin script
- Cost
- Base instruction cost 100 plus the byte length of the pushed result (2025 VM limits).
- Bitcoin status
- Same in Bitcoin (BTC)
Example
OP_1NEGATE OP_ABS OP_1 OP_EQUAL | Step | Stack after (top on the right) | What happens |
|---|---|---|
OP_1NEGATE | -1 | Pushes the one-byte number 0x81, which is -1. |
OP_ABS | 1 | Absolute value of -1. |
OP_1 | 1 1 | |
OP_EQUAL | 1 | Both items are the byte 0x01, so the script ends true. |
Step through it opcode by opcode in Bitauth IDE, the in-browser BCH VM debugger.
Where OP_1NEGATE is used
- Upgrade November 2019: Schnorr multisig and MINIMALDATA : Made minimal pushes a consensus rule. A script that pushes -1 as the data byte 0x81 now fails; it must use OP_1NEGATE.
- Contracts CashScript integer literals : CashScript encodes integer literals as minimal pushes, so a literal -1 in a contract compiles to OP_1NEGATE.
- CHIP Bigger Script Integers : Widened the signed script numbers that -1 belongs to, from 32 to 64 bits.