Skip to content
module

neo3.vm

NEO Virtual Machine classes.

Classes
  • ScriptBuilder A utility class to create scripts (sequence of opcodes) that can be executed by theNEO Virtual Machine.
  • Syscalls Container holding all NEO blockchain interop syscalls.
enum

neo3.vm.OpCode()

Bases
enum.IntEnum int enum.ReprEnum enum.Enum

NEO Virtual Machine instructions.

Can be concatenated into a hex-escaped bytes sequence.

Example

In [1]: from neo3.contracts import vm

In [2]: script = vm.OpCode.PUSHDATA1 + b'' + vm.OpCode.RET

In [3]: script Out[3]: b' @'

Members
  • ABORT (int) 0x38
  • ABS (int) 0x9a
  • ADD (int) 0x9e
  • AND (int) 0x91
  • APPEND (int) 0xcf
  • ASSERT (int) 0x39
  • BOOLAND (int) 0xab
  • BOOLOR (int) 0xac
  • CALL (int) 0x34
  • CALLA (int) 0x36
  • CALLT (int) 0x37
  • CALL_L (int) 0x35
  • CAT (int) 0x8b
  • CLEAR (int) 0x49
  • CLEARITEMS (int) 0xd3
  • CONVERT (int) 0xdb
  • DEC (int) 0x9d
  • DEPTH (int) 0x43
  • DIV (int) 0xa1
  • DROP (int) 0x45
  • DUP (int) 0x4a
  • ENDFINALLY (int) 0x3f
  • ENDTRY (int) 0x3d
  • ENDTRY_L (int) 0x3e
  • EQUAL (int) 0x97
  • GE (int) 0xb8
  • GT (int) 0xb7
  • HASKEY (int) 0xcb
  • INC (int) 0x9c
  • INITSLOT (int) 0x57
  • INITSSLOT (int) 0x56
  • INVERT (int) 0x90
  • ISNULL (int) 0xd8
  • ISTYPE (int) 0xd9
  • JMP (int) 0x22
  • JMPEQ (int) 0x28
  • JMPEQ_L (int) 0x29
  • JMPGE (int) 0x2e
  • JMPGE_L (int) 0x2f
  • JMPGT (int) 0x2c
  • JMPGT_L (int) 0x2d
  • JMPIF (int) 0x24
  • JMPIFNOT (int) 0x26
  • JMPIFNOT_L (int) 0x27
  • JMPIF_L (int) 0x25
  • JMPLE (int) 0x32
  • JMPLE_L (int) 0x33
  • JMPLT (int) 0x30
  • JMPLT_L (int) 0x31
  • JMPNE (int) 0x2a
  • JMPNE_L (int) 0x2b
  • JMP_L (int) 0x23
  • KEYS (int) 0xcc
  • LDARG (int) 0x7f
  • LDARG0 (int) 0x78
  • LDARG1 (int) 0x79
  • LDARG2 (int) 0x7a
  • LDARG3 (int) 0x7b
  • LDARG4 (int) 0x7c
  • LDARG5 (int) 0x7d
  • LDARG6 (int) 0x7e
  • LDLOC (int) 0x6f
  • LDLOC0 (int) 0x68
  • LDLOC1 (int) 0x69
  • LDLOC2 (int) 0x6a
  • LDLOC3 (int) 0x6b
  • LDLOC4 (int) 0x6c
  • LDLOC5 (int) 0x6d
  • LDLOC6 (int) 0x6e
  • LDSFLD (int) 0x5f
  • LDSFLD0 (int) 0x58
  • LDSFLD1 (int) 0x59
  • LDSFLD2 (int) 0x5a
  • LDSFLD3 (int) 0x5b
  • LDSFLD4 (int) 0x5c
  • LDSFLD5 (int) 0x5d
  • LDSFLD6 (int) 0x5e
  • LE (int) 0xb6
  • LEFT (int) 0x8d
  • LT (int) 0xb5
  • MAX (int) 0xba
  • MEMCPY (int) 0x89
  • MIN (int) 0xb9
  • MOD (int) 0xa2
  • MODMUL (int) 0xa5
  • MODPOW (int) 0xa6
  • MUL (int) 0xa0
  • NEGATE (int) 0x9b
  • NEWARRAY (int) 0xc3
  • NEWARRAY0 (int) 0xc2
  • NEWARRAY_T (int) 0xc4
  • NEWBUFFER (int) 0x88
  • NEWMAP (int) 0xc8
  • NEWSTRUCT (int) 0xc6
  • NEWSTRUCT0 (int) 0xc5
  • NIP (int) 0x46
  • NOP (int) 0x21
  • NOT (int) 0xaa
  • NOTEQUAL (int) 0x98
  • NUMEQUAL (int) 0xb3
  • NUMNOTEQUAL (int) 0xb4
  • NZ (int) 0xb1
  • OR (int) 0x92
  • OVER (int) 0x4b
  • PACK (int) 0xc0
  • PACKMAP (int) 0xbe
  • PACKSTRUCT (int) 0xbf
  • PICK (int) 0x4d
  • PICKITEM (int) 0xce
  • POPITEM (int) 0xd4
  • POW (int) 0xa3
  • PUSH0 (int) 0x10
  • PUSH1 (int) 0x11
  • PUSH10 (int) 0x1a
  • PUSH11 (int) 0x1b
  • PUSH12 (int) 0x1c
  • PUSH13 (int) 0x1d
  • PUSH14 (int) 0x1e
  • PUSH15 (int) 0x1f
  • PUSH16 (int) 0x20
  • PUSH2 (int) 0x12
  • PUSH3 (int) 0x13
  • PUSH4 (int) 0x14
  • PUSH5 (int) 0x15
  • PUSH6 (int) 0x16
  • PUSH7 (int) 0x17
  • PUSH8 (int) 0x18
  • PUSH9 (int) 0x19
  • PUSHA (int) 0xa
  • PUSHDATA1 (int) 0xc
  • PUSHDATA2 (int) 0xd
  • PUSHDATA4 (int) 0xe
  • PUSHF (int) 0x9
  • PUSHINT128 (int) 0x4
  • PUSHINT16 (int) 0x1
  • PUSHINT256 (int) 0x5
  • PUSHINT32 (int) 0x2
  • PUSHINT64 (int) 0x3
  • PUSHINT8 (int) 0x0
  • PUSHM1 (int) 0xf
  • PUSHNULL (int) 0xb
  • PUSHT (int) 0x8
  • REMOVE (int) 0xd2
  • RET (int) 0x40
  • REVERSE3 (int) 0x53
  • REVERSE4 (int) 0x54
  • REVERSEITEMS (int) 0xd1
  • REVERSEN (int) 0x55
  • RIGHT (int) 0x8e
  • ROLL (int) 0x52
  • ROT (int) 0x51
  • SETITEM (int) 0xd0
  • SHL (int) 0xa8
  • SHR (int) 0xa9
  • SIGN (int) 0x99
  • SIZE (int) 0xca
  • SQRT (int) 0xa4
  • STARG (int) 0x87
  • STARG0 (int) 0x80
  • STARG1 (int) 0x81
  • STARG2 (int) 0x82
  • STARG3 (int) 0x83
  • STARG4 (int) 0x84
  • STARG5 (int) 0x85
  • STARG6 (int) 0x86
  • STLOC (int) 0x77
  • STLOC0 (int) 0x70
  • STLOC1 (int) 0x71
  • STLOC2 (int) 0x72
  • STLOC3 (int) 0x73
  • STLOC4 (int) 0x74
  • STLOC5 (int) 0x75
  • STLOC6 (int) 0x76
  • STSFLD (int) 0x67
  • STSFLD0 (int) 0x60
  • STSFLD1 (int) 0x61
  • STSFLD2 (int) 0x62
  • STSFLD3 (int) 0x63
  • STSFLD4 (int) 0x64
  • STSFLD5 (int) 0x65
  • STSFLD6 (int) 0x66
  • SUB (int) 0x9f
  • SUBSTR (int) 0x8c
  • SWAP (int) 0x50
  • SYSCALL (int) 0x41
  • THROW (int) 0x3a
  • TRY (int) 0x3b
  • TRY_L (int) 0x3c
  • TUCK (int) 0x4e
  • UNPACK (int) 0xc1
  • VALUES (int) 0xcd
  • WITHIN (int) 0xbb
  • XDROP (int) 0x48
  • XOR (int) 0x93
class

neo3.vm.ScriptBuilder()

A utility class to create scripts (sequence of opcodes) that can be executed by theNEO Virtual Machine.

Methods
  • emit_contract_call(script_hash, operation, call_flags) (ScriptBuilder) Emit opcode sequence to call a smart contrat operation.
  • emit_contract_call_with_args(script_hash, operation, args, call_flags) (ScriptBuilder) Emit opcode sequence to call a smart contrat operation with arguments.
method

emit_contract_call(script_hash, operation, call_flags=None) → ScriptBuilder

Emit opcode sequence to call a smart contrat operation.

Parameters
  • script_hash (UInt160) contract script hash.
  • operation (str) method to call on contract.
  • call_flags (Optional, optional) call flags for the operation.
method

emit_contract_call_with_args(script_hash, operation, args, call_flags=None) → ScriptBuilder

Emit opcode sequence to call a smart contrat operation with arguments.

Parameters
  • script_hash (UInt160) contract script hash.
  • operation (str) method to call on contract.
  • args (Union) parameters to pass to the operation.
  • call_flags (Optional, optional) call flags for the operation.
enum

neo3.vm.StackItemType()

Bases
enum.IntEnum int enum.ReprEnum enum.Enum

StackItemType as defined inside the virtual machine

Members
  • ANY (int) 0x0
  • ARRAY (int) 0x40
  • BOOLEAN (int) 0x20
  • BUFFER (int) 0x30
  • BYTESTRING (int) 0x28
  • INTEGER (int) 0x21
  • MAP (int) 0x48
  • POINTER (int) 0x10
  • STRUCT (int) 0x41
class

neo3.vm.Syscalls()

Container holding all NEO blockchain interop syscalls.

enum

neo3.vm.VMState()

Bases
enum.IntEnum int enum.ReprEnum enum.Enum

Enum where members are also (and must be) ints

Members
  • BREAK (int) 0x4
  • FAULT (int) 0x2
  • HALT (int) 0x1
  • NONE (int) 0x0