module Tapyrus::Opcodes
Constants
- DUPLICATE_KEY
- NAME_MAP
- OPCODES_MAP
- OP_0
- OP_0NOTEQUAL
- OP_1
- OP_10
- OP_11
- OP_12
- OP_13
- OP_14
- OP_15
- OP_16
- OP_1ADD
- OP_1NEGATE
- OP_1SUB
- OP_2
- OP_2DIV
- OP_2DROP
- OP_2DUP
- OP_2MUL
- OP_2OVER
- OP_2ROT
- OP_2SWAP
- OP_3
- OP_3DUP
- OP_4
- OP_5
- OP_6
- OP_7
- OP_8
- OP_9
- OP_ABS
- OP_ADD
- OP_AND
- OP_BOOLAND
- OP_BOOLOR
- OP_CAT
- OP_CHECKDATASIG
tapyrus extension
- OP_CHECKDATASIGVERIFY
- OP_CHECKMULTISIG
- OP_CHECKMULTISIGVERIFY
- OP_CHECKSIG
- OP_CHECKSIGVERIFY
- OP_CODESEPARATOR
- OP_COLOR
- OP_DEPTH
- OP_DIV
- OP_DROP
- OP_DUP
- OP_ELSE
- OP_ENDIF
- OP_EQUAL
- OP_EQUALVERIFY
- OP_FROMALTSTACK
- OP_GREATERTHAN
- OP_GREATERTHANOREQUAL
- OP_HASH160
- OP_HASH256
- OP_IF
- OP_IFDUP
- OP_INVALIDOPCODE
- OP_INVERT
- OP_LEFT
- OP_LESSTHAN
- OP_LESSTHANOREQUAL
- OP_LSHIFT
- OP_MAX
- OP_MIN
- OP_MOD
- OP_MUL
- OP_NEGATE
- OP_NIP
- OP_NOP
- OP_NOP1
- OP_NOP10
- OP_NOP2
- OP_NOP3
- OP_NOP4
- OP_NOP5
- OP_NOP6
- OP_NOP7
- OP_NOP8
- OP_NOP9
- OP_NOT
- OP_NOTIF
- OP_NUMEQUAL
- OP_NUMEQUALVERIFY
- OP_NUMNOTEQUAL
- OP_OR
- OP_OVER
- OP_PICK
- OP_PUBKEY
- OP_PUBKEYHASH
- OP_PUSHDATA1
- OP_PUSHDATA2
- OP_PUSHDATA4
- OP_RESERVED
- OP_RESERVED1
- OP_RESERVED2
- OP_RETURN
- OP_RIGHT
- OP_RIPEMD160
- OP_ROLL
- OP_ROT
- OP_RSHIFT
- OP_SHA1
- OP_SHA256
- OP_SIZE
- OP_SUB
- OP_SUBSTR
- OP_SWAP
- OP_TOALTSTACK
- OP_TUCK
- OP_VER
- OP_VERIF
- OP_VERIFY
- OP_VERNOTIF
- OP_WITHIN
- OP_XOR
Public Instance Methods
defined?(opcode)
click to toggle source
whether opcode is predefined opcode
# File lib/tapyrus/opcodes.rb, line 167 def defined?(opcode) !opcode_to_name(opcode).nil? end
name_to_opcode(name)
click to toggle source
# File lib/tapyrus/opcodes.rb, line 161 def name_to_opcode(name) return NAME_MAP['OP_' + name] if name =~ /^\d/ && name.to_i < 17 && name.to_i > -1 NAME_MAP[name] end
opcode_to_name(opcode)
click to toggle source
# File lib/tapyrus/opcodes.rb, line 156 def opcode_to_name(opcode) return OPCODES_MAP[opcode].delete('OP_') if opcode == OP_0 || (opcode <= OP_16 && opcode >= OP_1) OPCODES_MAP[opcode] end
opcode_to_small_int(opcode)
click to toggle source
# File lib/tapyrus/opcodes.rb, line 178 def opcode_to_small_int(opcode) return 0 if opcode == ''.b || opcode == OP_0 return -1 if opcode == OP_1NEGATE return opcode - (OP_1 - 1) if opcode >= OP_1 && opcode <= OP_16 nil end
small_int_to_opcode(int)
click to toggle source
# File lib/tapyrus/opcodes.rb, line 171 def small_int_to_opcode(int) return OP_0 if int == 0 return OP_1NEGATE if int == -1 return OP_1 + (int - 1) if int >= 1 && int <= 16 nil end