Anyone know how / where to run
enum optypecode
(or some other method) to get a list of current opcodes? Like this result...
https://www.slideshare.net/gvrooyen/20140220-bitcoin/34-We_just_used_4_opcodesenum
Bitcoin Stack Exchange is a question and answer site for Bitcoin users, developers, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAnyone know how / where to run
enum optypecode
(or some other method) to get a list of current opcodes? Like this result...
https://www.slideshare.net/gvrooyen/20140220-bitcoin/34-We_just_used_4_opcodesenum
This is the list of opcodes supported by Bitcoin Core v0.14.0:
https://github.com/bitcoin/bitcoin/blob/v0.14.0/src/script/script.h#L46L187
I don't think there is a command you can run, besides looking at Bitcoin's source code. (look for enum opcodetype
)
Note that a lot of the opcodes listed there
OP_CAT
)OP_CHECKLOCKTIMEVERIFY
and OP_NOP2
have the same opcode) or OP_SMALLINTEGER
)To get a list of ones that can actually be used without making a script fail, you need to look at the code that actually evaluates scripts. (look for Bool EvalScript
)
Here's a list of legal opcodes, as of time of writing:
(direct push, opcode 0x01-0x4b)
OP_PUSHDATA1
OP_PUSHDATA2
OP_PUSHDATA4
OP_0-16
OP_TRUE
OP_FALSE
OP_1NEGATE
OP_CHECKLOCKTIMEVERIFY
OP_CHECKSEQUENCEVERIFY
OP_NOP
OP_NOP1-10
OP_IF
OP_NOTIF
OP_ELSE
OP_ENDIF
OP_VERIFY
OP_RETURN
OP_TOALTSTACK
OP_FROMALTSTACK
OP_2DROP
OP_2DUP
OP_3DUP
OP_2OVER
OP_2ROT
OP_2SWAP
OP_IFDUP
OP_DEPTH
OP_DROP
OP_DUP
OP_NIP
OP_OVER
OP_PICK
OP_ROLL
OP_ROT
OP_SWAP
OP_TUCK
OP_SIZE
OP_EQUAL
OP_EQUALVERIFY
OP_NUMNOTEQUAL
OP_1ADD
OP_1SUB
OP_NEGATE
OP_ABS
OP_NOT
OP_0NOTEQUAL
OP_1ADD
OP_1SUB
OP_NEGATE
OP_ABS
OP_NOT
OP_0NOTEQUAL
OP_ADD
OP_SUB
OP_BOOLAND
OP_BOOLOR
OP_NUMEQUAL
OP_NUMEQUALVERIFY
OP_NUMNOTEQUAL
OP_LESSTHAN
OP_GREATERTHAN
OP_LESSTHANOREQUAL
OP_GREATERTHANOREQUAL
OP_MIN
OP_MAX
OP_ADD
OP_SUB
OP_BOOLAND
OP_BOOLOR
OP_NUMEQUAL
OP_NUMEQUALVERIFY
OP_NUMNOTEQUAL
OP_LESSTHAN
OP_GREATERTHAN
OP_LESSTHANOREQUAL
OP_GREATERTHANOREQUAL
OP_MIN
OP_MAX
OP_WITHIN
OP_RIPEMD160
OP_SHA1
OP_SHA256
OP_HASH160
OP_HASH256
OP_CODESEPARATOR
OP_CHECKSIG
OP_CHECKSIGVERIFY
OP_CHECKMULTISIG
OP_CHECKMULTISIGVERIFY
Bitcoin Wiki has an excellent page on this subject, if you're trying to figure out what is possible in Bitcoin script.