NeoVM Instructions
#
Built-in data typesNeoVM has following built-in data types:
Type | Description |
---|---|
Array | Implemented as a List<StackItem> , the StackItem is an abstract class, and all the built-in data types are inherited from it. |
Boolean | Implemented as two byte arrays, TRUE and FALSE . |
Buffer | Readonly byte array, implemented as a buffer array byte[] |
ByteString | Readonly byte array, implemented as a ReadOnlyMemory<byte> |
Integer | Implemented as a BigInteger value. |
InteropInterface | Interoperable interface |
Map | Implemented as a key-value pair Dictionary<StackItem, StackItem> . |
Null | Null type |
Pointer | Implemented as a context Script and an instruction Position |
Struct | Inherited from Array, a Clone method is added and Equals method is overridden. |
CompoundType
: Compound type, which includesArray
,Map
andStruct
。PrimitiveType
: Basic type which includesBoolean
,ByteString
andInteger
。
// boolean typeprivate static readonly byte[] TRUE = { 1 };private static readonly byte[] FALSE = { 0 };
private bool value;
#
InstructionsNeoVM has implemented 189 instructions. The categories are as follows:
Constant | Flow Control | Stack Operation | Slot Operation | String Operation | Logical Operation | Arithmetic Operation | Advanced Data Structure | Type Operation |
---|---|---|---|---|---|---|---|---|
29 | 32 | 15 | 50 | 6 | 6 | 25 | 18 | 3 |
Details of each instruction in each category are introduced as follows.
#
ConstantsThe constant instructions mainly complete the function of pushing constants or arrays into the EvaluationStack
.
#
PUSHINTInstruction | PUSHINT8, PUSHINT16, PUSHINT32, PUSHINT64, PUSHINT128, PUSHINT256 |
---|---|
Bytecode | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 |
Fee | 0.00000001 GAS, 0.00000001 GAS, 0.00000001 GAS, 0.00000001 GAS, 0.00000004 GAS, 0.00000004 GAS |
Function | Push an integer onto the stack, the bit length of which is specified with the number 8\16\32\64\128\256. |
#
PUSHT/PUSHFInstruction | PUSHT, PUSHF |
---|---|
Bytecode | 0x08, 0x09 |
Fee | 0.00000001 GAS |
Function | Push the Boolean value True/False onto the stack. |
#
PUSHAInstruction | PUSHA |
---|---|
Bytecode | 0x0A |
Fee | 0.00000004 GAS |
Function | Convert the next four bytes to an address, and push the address onto the stack. |
#
PUSHNULLInstruction | PUSHNULL |
---|---|
Bytecode | 0x0B |
Fee | 0.00000001 GAS |
Function | The item null is pushed onto the stack. |
#
PUSHDATAInstruction | PUSHDATA1, PUSHDATA2, PUSHDATA4 |
---|---|
Bytecode | 0x0C, 0x0D, 0x0E |
Fee | 0.00000008 GAS, 0.00000512 GAS, 0.00004096 GAS |
Function | The next n bytes contain the number of bytes to be pushed onto the stack, where n is specified by 1|2|4. |
#
PUSHM1Instruction | PUSHM1 |
---|---|
Bytecode | 0x0F |
Fee | 0.00000001 GAS |
Function | The number -1 is pushed onto the stack. |
#
PUSHNInstruction | PUSH0~PUSH16 |
---|---|
Bytecode | 0x10~0x20 |
Fee | 0.00000001 GAS |
Function | The number n is pushed onto the stack,where n is specified by 0~16. |
#
Flow ControlIt's used to control the running process of NeoVM, including jump, call and other instructions.
#
NOPInstruction | NOP |
---|---|
Bytecode | 0x21 |
Fee | 0.00000001 GAS |
Function | The NOP operation does nothing. It is intended to fill in space if opcodes are patched. |
#
JMPInstruction | JMP |
---|---|
Bytecode | 0x22 |
Fee | 0.00000002 GAS |
Function | Unconditionally transfers control to a target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMP_LInstruction | JMP_L |
---|---|
Bytecode | 0x23 |
Fee | 0.00000002 GAS |
Function | Unconditionally transfers control to a target instruction. The target instruction is represented as a 4-bytes signed offset from the beginning of the current instruction. |
#
JMPIFInstruction | JMPIF |
---|---|
Bytecode | 0x24 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the value is true , not null , or non-zero. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMPIF_LInstruction | JMPIF |
---|---|
Bytecode | 0x25 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the value is true , not null , or non-zero. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
JMPIFNOTInstruction | JMPIFNOT |
---|---|
Bytecode | 0x26 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the value is false , a null reference, or zero. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMPIFNOT_LInstruction | JMPIFNOT_L |
---|---|
Bytecode | 0x27 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the value is false , a null reference, or zero. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
JMPEQInstruction | JMPEQ |
---|---|
Bytecode | 0x28 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if two values are equal. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMPEQ_LInstruction | JMPEQ_L |
---|---|
Bytecode | 0x29 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if two values are equal. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
JMPNEInstruction | JMPNE |
---|---|
Bytecode | 0x2A |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction when two values are not equal. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMPNE_LInstruction | JMPNE_L |
---|---|
Bytecode | 0x2B |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction when two values are not equal. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
JMPGTInstruction | JMPGT |
---|---|
Bytecode | 0x2C |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the first value is greater than the second value. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMPGT_LInstruction | JMPGT_L |
---|---|
Bytecode | 0x2D |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the first value is greater than the second value. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
JMPGEInstruction | JMPGE |
---|---|
Bytecode | 0x2E |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the first value is greater than or equal to the second value. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMPGE_LInstruction | JMPGE_L |
---|---|
Bytecode | 0x2F |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the first value is greater than or equal to the second value. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
JMPLTInstruction | JMPLT |
---|---|
Bytecode | 0x30 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the first value is less than the second value. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMPLT_LInstruction | JMPLT_L |
---|---|
Bytecode | 0x31 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the first value is less than the second value. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
JMPLEInstruction | JMPLE |
---|---|
Bytecode | 0x32 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the first value is less than or equal to the second value. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
JMPLE_LInstruction | JMPLE_L |
---|---|
Bytecode | 0x33 |
Fee | 0.00000002 GAS |
Function | Transfers control to a target instruction if the first value is less than or equal to the second value. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
CALLInstruction | CALL |
---|---|
Bytecode | 0x34 |
Fee | 0.00000512 GAS |
Function | Calls the function at the target address which is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
CALL_LInstruction | CALL_L |
---|---|
Bytecode | 0x35 |
Fee | 0.00000512 GAS |
Function | Calls the function at the target address which is represented as a 4-bytes signed offset from the beginning of the current instruction. |
#
CALLAInstruction | CALLA |
---|---|
Bytecode | 0x36 |
Fee | 0.00000512 GAS |
Function | Pops the address of a function from the stack, and call the function. |
#
CALLTInstruction | CALLT |
---|---|
Bytecode | 0x37 |
Fee | 0.00032768 GAS |
Function | Pops the function Token from the stack, and call the function. |
#
ABORTInstruction | ABORT |
---|---|
Bytecode | 0x38 |
Fee | 0 GAS |
Function | It turns the vm state to FAULT immediately, and the exception cannot be caught. |
#
ASSERTInstruction | ASSERT |
---|---|
Bytecode | 0x39 |
Fee | 0.00000001 GAS |
Function | Pop the top value of the stack, if it is false, then exit vm execution and set vm state to FAULT. |
#
THROWInstruction | THROW |
---|---|
Bytecode | 0x3A |
Fee | 0.00000512 GAS |
Function | Throws the exception of stack top |
#
TRYInstruction | TRY |
---|---|
Bytecode | 0x3B |
Fee | 0.00000004 GAS |
Function | Enters the block of Try statement. The Catch and Finally address offset are represented as a 1-byte signed offset from the beginning of the current instruction. |
#
TRY_LInstruction | TRY_L |
---|---|
Bytecode | 0x3C |
Fee | 0.00000004 GAS |
Function | Enters the block of Try statement. The Catch and Finally address offset are represented as a 4-byte signed offset from the beginning of the current instruction. |
#
ENDTRYInstruction | ENDTRY |
---|---|
Bytecode | 0x3D |
Fee | 0.00000004 GAS |
Function | Terminates the block Try and unconditionally transfers control to a target instruction. The target instruction is represented as a 1-byte signed offset from the beginning of the current instruction. |
#
ENDTRY_LInstruction | ENDTRY_L |
---|---|
Bytecode | 0x3E |
Fee | 0.00000004 GAS |
Function | Terminates the block Try and unconditionally transfers control to a target instruction. The target instruction is represented as a 4-byte signed offset from the beginning of the current instruction. |
#
ENDFINALLYInstruction | ENDFINALLY |
---|---|
Bytecode | 0x3F |
Fee | 0.00000004 GAS |
Function | Terminates the block Finally and goes to the target instruction ENDTRY/ENDTRY_L if there is no exception, or throw the exception to the upper level again. |
#
RETInstruction | RET |
---|---|
Bytecode | 0x40 |
Fee | 0 GAS |
Function | Returns from the current method. |
#
SYSCALLInstruction | SYSCALL |
---|---|
Bytecode | 0x41 |
Fee | 0 GAS |
Function | Calls to an interop service. |
#
Stack OperationCopy, remove and swap the elements of the stack.
#
DEPTHInstruction | DEPTH |
---|---|
Bytecode | 0x43 |
Fee | 0.00000002 GAS |
Function | Puts the number of stack items onto the stack. |
#
DROPInstruction | DROP |
---|---|
Bytecode | 0x45 |
Fee | 0.00000002 GAS |
Function | Removes the top stack item. |
#
NIPInstruction | NIP |
---|---|
Bytecode | 0x46 |
Fee | 0.00000002 GAS |
Function | Removes the second-to-top stack item. |
#
XDROPInstruction | XDROP |
---|---|
Bytecode | 0x48 |
Fee | 0.00000016 GAS |
Function | The item n back in the main stack is removed. |
Function | Gets the integer N from the top stack and removes elements indexed to N from the remaining elements of the stack. |
#
CLEARInstruction | CLEAR |
---|---|
Bytecode | 0x49 |
Fee | 0.00000016 GAS |
Function | Clear the stack |
#
DUPInstruction | DUP |
---|---|
Bytecode | 0x4A |
Fee | 0.00000002 GAS |
Function | Copies the top stack item to the top. |
#
OVERInstruction | OVER |
---|---|
Bytecode | 0x4B |
Fee | 0.00000002 GAS |
Function | Copies the second-to-top stack item to the top. |
#
PICKInstruction | PICK |
---|---|
Bytecode | 0x4D |
Fee | 0.00000002 GAS |
Function | Gets the integer N from the top stack and copies elements indexed to N from the remaining elements of the stack to the top. |
#
TUCKInstruction | TUCK |
---|---|
Bytecode | 0x4E |
Fee | 0.00000002 GAS |
Function | The item at the top of the stack is copied and inserted before the second-to-top item. |
#
SWAPInstruction | SWAP |
---|---|
Bytecode | 0x50 |
Fee | 0.00000002 GAS |
Function | The top two items on the stack are swapped. |
#
ROTInstruction | ROT |
---|---|
Bytecode | 0x51 |
Fee | 0.00000002 GAS |
Function | Moves the elements indexed to 2 to the top |
#
ROLLInstruction | ROLL |
---|---|
Bytecode | 0x52 |
Fee | 0.00000016 GAS |
Function | Gets the integer N from the top stack and moves elements indexed to N from the remaining elements of the stack to the top. |
#
REVERSE3Instruction | REVERSE3 |
---|---|
Bytecode | 0x53 |
Fee | 0.00000002 GAS |
Function | Reverse the order of the top 3 items on the stack. |
#
REVERSE4Instruction | REVERSE4 |
---|---|
Bytecode | 0x54 |
Fee | 0.00000002 GAS |
Function | Reverse the order of the top 4 items on the stack. |
#
REVERSENInstruction | REVERSEN |
---|---|
Bytecode | 0x55 |
Fee | 0.00000016 GAS |
Function | Gets the integer N from the top stack, and reverse the order of the top N items on the stack. |
#
Slot#
INITSSLOTInstruction | INITSSLOT |
---|---|
Bytecode | 0x56 |
Fee | 0.00000016 GAS |
Function | Initialize the static field list for the current execution context. |
#
INITSLOTInstruction | INITSLOT |
---|---|
Bytecode | 0x57 |
Fee | 0.00000064 GAS |
Function | Initialize the argument slot and the local variable list for the current execution context. |
#
LDSFLDNInstruction | LDSFLD0~LDSFLD6 |
---|---|
Bytecode | 0x58~0x5E |
Fee | 0.00000002 GAS |
Function | Loads the static field at index n onto the evaluation stack, where the n is 0~6。 |
#
LDSFLDInstruction | LDSFLD |
---|---|
Bytecode | 0x5F |
Fee | 0.00000002 GAS |
Function | Loads the static field at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer. |
#
STSFLDNInstruction | STSFLD0~STSFLD6 |
---|---|
Bytecode | 0x60~0x0x66 |
Fee | 0.00000002 GAS |
Function | Stores the value on top of the evaluation stack in the static field list at index n , where the n is 0~6。 |
#
STSFLDInstruction | STSFLD |
---|---|
Bytecode | 0x67 |
Fee | 0.00000002 GAS |
Function | Stores the value on top of the evaluation stack in the static field list at a specified index. The index is represented as a 1-byte unsigned integer. |
#
LDLOCNInstruction | LDLOC0~LDLOC6 |
---|---|
Bytecode | 0x68~0x6E |
Fee | 0.00000002 GAS |
Function | Loads the local variable at index n onto the evaluation stack, where the n is 0~6。 |
#
LDLOCInstruction | LDLOC |
---|---|
Bytecode | 0x6F |
Fee | 0.00000002 GAS |
Function | Loads the local variable at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer. |
#
STLOCNInstruction | STLOC0~STLOC6 |
---|---|
Bytecode | 0x70~0x76 |
Fee | 0.00000002 GAS |
Function | Stores the value on top of the evaluation stack in the local variable list at index n , where the n is 0~6。 |
#
STLOCInstruction | STLOC |
---|---|
Bytecode | 0x77 |
Fee | 0.00000002 GAS |
Function | Stores the value on top of the evaluation stack in the local variable list at a specified index. The index is represented as a 1-byte unsigned integer. |
#
LDARGNInstruction | LDARG0~LDARG6 |
---|---|
Bytecode | 0x78~0x7E |
Fee | 0.00000002 GAS |
Function | Loads the argument at index n onto the evaluation stack, where the n is 0~6. |
#
LDARGInstruction | LDARG |
---|---|
Bytecode | 0x7F |
Fee | 0.00000002 GAS |
Function | Loads the argument at a specified index onto the evaluation stack. The index is represented as a 1-byte unsigned integer. |
#
STARGNInstruction | STARG0~STARG6 |
---|---|
Bytecode | 0x80~0x86 |
Fee | 0.00000002 GAS |
Function | Stores the value on top of the evaluation stack in the argument slot at index n , where the n is 0~6. |
#
STARGInstruction | STARG |
---|---|
Bytecode | 0x87 |
Fee | 0.00000002 GAS |
Function | Stores the value on top of the evaluation stack in the argument slot at a specified index. The index is represented as a 1-byte unsigned integer. |
#
String Operation#
NEWBUFFERInstruction | NEWBUFFER |
---|---|
Bytecode | 0x88 |
Fee | 0.00000256 GAS |
Function | Create a new buffer |
#
MEMCPYInstruction | MEMCPY |
---|---|
Bytecode | 0x89 |
Fee | 0.00002048 GAS |
Function | memory copy |
#
CATInstruction | CAT |
---|---|
Bytecode | 0x8B |
Fee | 0.00002048 GAS |
Function | Concatenates two strings. |
#
SUBSTRInstruction | SUBSTR |
---|---|
Bytecode | 0x8C |
Fee | 0.00002048 GAS |
Function | Returns a section of a string. |
#
LEFTInstruction | LEFT |
---|---|
Bytecode | 0x8D |
Fee | 0.00002048 GAS |
Function | Gets characters in the left of the specified point in a string. |
#
RIGHTInstruction | RIGHT |
---|---|
Bytecode | 0x8E |
Fee | 0.00002048 GAS |
Function | Gets characters in the right of the specified point in a string. |
#
Logical Operation#
INVERTInstruction | INVERT |
---|---|
Bytecode | 0x90 |
Fee | 0.00000004 GAS |
Function | Flips all of the bits in the input. |
#
ANDInstruction | AND |
---|---|
Bytecode | 0x91 |
Fee | 0.00000008 GAS |
Function | Boolean and between each bit in the inputs |
#
ORInstruction | OR |
---|---|
Bytecode | 0x92 |
Fee | 0.00000008 GAS |
Function | Boolean or between each bit in the inputs. |
#
XORInstruction | XOR |
---|---|
Bytecode | 0x93 |
Fee | 0.00000008 GAS |
Function | Boolean exclusive or between each bit in the inputs. |
#
EQUALInstruction | EQUAL |
---|---|
Bytecode | 0x97 |
Fee | 0.00000032 GAS |
Function | Returns 1 if the inputs are exactly equal, 0 otherwise. |
#
NOTEQUALInstruction | NOTEQUAL |
---|---|
Bytecode | 0x98 |
Fee | 0.00000032 GAS |
Function | Returns 1 if the inputs are not equal, 0 otherwise. |
#
Arithmetic Operation#
SIGNInstruction | SIGN |
---|---|
Bytecode | 0x99 |
Fee | 0.00000004 GAS |
Function | Puts the sign of top stack item on top of the main stack. If value is negative, put -1; if positive, put 1; if value is zero, put 0. |
#
ABSInstruction | ABS |
---|---|
Bytecode | 0x9A |
Fee | 0.00000004 GAS |
Function | The input is made positive. |
#
NEGATEInstruction | NEGATE |
---|---|
Bytecode | 0x9B |
Fee | 0.00000004 GAS |
Function | The sign of the input is flipped. |
#
INCInstruction | INC |
---|---|
Bytecode | 0x9C |
Fee | 0.00000004 GAS |
Function | 1 is added to the input. |
#
DECInstruction | DEC |
---|---|
Bytecode | 0x9D |
Fee | 0.00000004 GAS |
Function | 1 is subtracted from the input. |
#
ADDInstruction | ADD |
---|---|
Bytecode | 0x9E |
Fee | 0.00000008 GAS |
Function | a is added to b. |
#
SUBInstruction | SUB |
---|---|
Bytecode | 0x9F |
Fee | 0.00000008 GAS |
Function | b is subtracted from a. |
#
MULInstruction | MUL |
---|---|
Bytecode | 0xA0 |
Fee | 0.00000008 GAS |
Function | a is multiplied by b. |
#
DIVInstruction | DIV |
---|---|
Bytecode | 0xA1 |
Fee | 0.00000008 GAS |
Function | a is divided by b. |
#
MODInstruction | MOD |
---|---|
Bytecode | 0xA2 |
Fee | 0.00000008 GAS |
Function | Returns the remainder after dividing a by b. |
#
POWInstruction | POW |
---|---|
Bytecode | 0xA3 |
Fee | 0.00000064 GAS |
Function | The result of raising value to the exponent power. |
#
SQRTInstruction | SQRT |
---|---|
Bytecode | 0xA4 |
Fee | 0.00000064 GAS |
Function | Returns the square root of a specified number. |
#
SHLInstruction | SHL |
---|---|
Bytecode | 0xA8 |
Fee | 0.00000008 GAS |
Function | Gets the integer n from the top stack and performs a n-bit left shift operation on the remaining BigInteger on the stack. |
#
SHRInstruction | SHR |
---|---|
Bytecode | 0xA9 |
Fee | 0.00000008 GAS |
Function | Gets the integer n from the top stack and performs a n-bit right shift operation on the remaining BigInteger on the stack. |
#
NOTInstruction | NOT |
---|---|
Bytecode | 0xAA |
Fee | 0.00000004 GAS |
Function | If the input is 0 or 1, it is flipped. Otherwise the output will be 0. |
#
BOOLANDInstruction | BOOLAND |
---|---|
Bytecode | 0xAB |
Fee | 0.00000008 GAS |
Function | If both a and b are not 0, the output is 1. Otherwise 0. |
#
BOOLORInstruction | BOOLOR |
---|---|
Bytecode | 0xAC |
Fee | 0.00000008 GAS |
Function | If a or b is not 0, the output is 1. Otherwise 0. |
#
NZInstruction | NZ |
---|---|
Bytecode | 0xB1 |
Fee | 0.00000004 GAS |
Function | Returns 0 if the input is 0. 1 otherwise. |
#
NUMEQUALInstruction | NUMEQUAL |
---|---|
Bytecode | 0xB3 |
Fee | 0.00000008 GAS |
Function | Returns 1 if the numbers are equal, 0 otherwise. |
#
NUMNOTEQUALInstruction | NUMNOTEQUAL |
---|---|
Bytecode | 0xB4 |
Fee | 0.00000008 GAS |
Function | Returns 1 if the numbers are not equal, 0 otherwise. |
#
LTInstruction | LT |
---|---|
Bytecode | 0xB5 |
Fee | 0.00000008 GAS |
Function | Returns 1 if a is less than b, 0 otherwise. |
#
LEInstruction | LE |
---|---|
Bytecode | 0xB6 |
Fee | 0.00000008 GAS |
Function | Returns 1 if a is less than or equal to b, 0 otherwise. |
#
GTInstruction | GT |
---|---|
Bytecode | 0xB7 |
Fee | 0.00000008 GAS |
Function | Returns 1 if a is greater than b, 0 otherwise. |
#
GEInstruction | GE |
---|---|
Bytecode | 0xB8 |
Fee | 0.00000008 GAS |
Function | Returns 1 if a is greater than or equal to b, 0 otherwise. |
#
MINInstruction | MIN |
---|---|
Bytecode | 0xB9 |
Fee | 0.00000008 GAS |
Function | Returns the smaller of a and b. |
#
MAXInstruction | MAX |
---|---|
Bytecode | 0xBA |
Fee | 0.00000008 GAS |
Function | Returns the larger of a and b. |
#
WITHINInstruction | WITHIN |
---|---|
Bytecode | 0xBB |
Fee | 0.00000008 GAS |
Function | Returns 1 if x is within the specified range (left-inclusive), 0 otherwise. |
#
Advanced Data StructureIt has implemented common operations for array, map, struct, etc.
#
PACKMAPInstruction | PACKMAP |
---|---|
Bytecode | 0xBE |
Fee | 0.00002048 GAS |
Function | A value n is taken from top of main stack. The next n*2 items on main stack are removed, put inside n-sized map and this map is put on top of the main stack. |
#
PACKSTRUCTInstruction | PACKSTRUCT |
---|---|
Bytecode | 0xBF |
Fee | 0.00002048 GAS |
Function | A value n is taken from top of main stack. The next n items on main stack are removed, put inside n-sized struct and this struct is put on top of the main stack. |
#
PACKInstruction | PACK |
---|---|
Bytecode | 0xC0 |
Fee | 0.00002048 GAS |
Function | A value n is taken from top of main stack. The next n items on main stack are removed, put inside n-sized array and this array is put on top of the main stack. |
#
UNPACKInstruction | UNPACK |
---|---|
Bytecode | 0xC1 |
Fee | 0.00002048 GAS |
Function | An array is removed from top of the main stack. Its elements are put on top of the main stack (in reverse order) and the array size is also put on main stack. |
#
NEWARRAY0Instruction | NEWARRAY0 |
---|---|
Bytecode | 0xC2 |
Fee | 0.00000016 GAS |
Function | An array with size n is put on top of the main stack. |
#
NEWARRAYInstruction | NEWARRAY |
---|---|
Bytecode | 0xC3 |
Fee | 0.00000512 GAS |
Function | A value n is taken from top of main stack. A null-filled array with size n is put on top of the main stack. |
#
NEWARRAY_TInstruction | NEWARRAY_T |
---|---|
Bytecode | 0xC4 |
Fee | 0.00000512 GAS |
Function | An array of type T with size n is put on top of the main stack. |
#
NEWSTRUCT0Instruction | NEWSTRUCT0 |
---|---|
Bytecode | 0xC5 |
Fee | 0.00000016 GAS |
Function | A structure with size n and all 0 elements is put on top of the main stack. |
#
NEWSTRUCTInstruction | NEWSTRUCT |
---|---|
Bytecode | 0xC6 |
Fee | 0.00000512 GAS |
Function | A value n is taken from top of main stack. A zero-filled struct with size n is put on top of the main stack. |
#
NEWMAPInstruction | NEWMAP |
---|---|
Bytecode | 0xC8 |
Fee | 0.00000008 GAS |
Function | An empty Map is put on top of the main stack. |
#
SIZEInstruction | SIZE |
---|---|
Bytecode | 0xCA |
Fee | 0.00000004 GAS |
Function | Gets the size of elements on the top stack. |
#
HASKEYInstruction | HASKEY |
---|---|
Bytecode | 0xCB |
Fee | 0.00000064 GAS |
Function | An input index n (or key) and an array (Map,Buffer, ByteString) are returned from the top of the main stack. Puts True on top of main stack if n is in the length range of the array (Map,Buffer, ByteString), and False otherwise. |
#
KEYSInstruction | KEYS |
---|---|
Bytecode | 0xCC |
Fee | 0.00000016 GAS |
Function | Gets all Keys of the map from top of the main stack and constructs a new array with all Key and puts it on top of the main stack. |
#
VALUESInstruction | VALUES |
---|---|
Bytecode | 0xCD |
Fee | 0.00008192 GAS |
Function | Gets all Values of the elements (Array or Map) from top of the main stack and constructs a new array with all Value and puts it on top of the main stack. |
#
PICKITEMInstruction | PICKITEM |
---|---|
Bytecode | 0xCE |
Fee | 0.00000064 GAS |
Function | Gets the Nth element in the array of the top stack |
#
APPENDInstruction | APPEND |
---|---|
Bytecode | 0xCF |
Fee | 0.00008192 GAS |
Function | Adds a new item to the arry of the top stack |
#
SETITEMInstruction | SETITEM |
---|---|
Bytecode | 0xD0 |
Fee | 0.00008192 GAS |
Function | Assigns a value to the specified index of element (Array,Map or Buffer)in the top stack |
#
REVERSEITEMSInstruction | REVERSEITEMS |
---|---|
Bytecode | 0xD1 |
Fee | 0.00008192 GAS |
Function | Reverses the elements in Array or Buffer from the top stack. |
#
REMOVEInstruction | REMOVE |
---|---|
Bytecode | 0xD2 |
Fee | 0.00000016 GAS |
Function | Removes the specified index or Key elements from Array or Map |
#
CLEARITEMSInstruction | CLEARITEMS |
---|---|
Bytecode | 0xD3 |
Fee | 0.00000016 GAS |
Function | Remove all the items from the compound-type. |
#
POPITEMInstruction | POPITEM |
---|---|
Bytecode | 0xD4 |
Fee | 0.00000016 GAS |
Function | Pops the last element in Array from the stack top and push into the stack. |
#
Type#
ISNULLInstruction | ISNULL |
---|---|
Bytecode | 0xD8 |
Fee | 0.00000002 GAS |
Function | Returns true if the input is null. Returns false otherwise. |
#
ISTYPEInstruction | ISTYPE |
---|---|
Bytecode | 0xD9 |
Fee | 0.00000002 GAS |
Function | Returns true if the top item is of the specified type. |
#
CONVERTInstruction | CONVERT |
---|---|
Bytecode | 0xDB |
Fee | 0.00002048 GAS |
Function | Converts the top item to the specified type. |
note
The operation code with * indicates that the result of the operation is not pushed back to the EvaluationStack
using PUSH()
.