Package com.bradyrussell.uiscoin.script
Enum ScriptOperator
java.lang.Object
java.lang.Enum<ScriptOperator>
com.bradyrussell.uiscoin.script.ScriptOperator
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ScriptOperator>
,java.lang.constant.Constable
public enum ScriptOperator extends java.lang.Enum<ScriptOperator>
-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description ABS
abs [int x] = Math.abs(x);ACOS
acos [float x] = Math.acos(x);ADD
numericADDBYTES
a[i] + b[i] = c[i]ADDFLOAT
numericALLOC
alloc(int NumberOfBytes) Push a new element onto the stack, consisting of NumberOfBytes zerosAND
boolean logic (byte either 1 or 0)APPEND
combine the top two stack itemsASIN
asin [float x] = Math.asin(x);ATAN
atan [float x] = Math.atan(x);BIGPUSH
the next 4 bytes specify the number of following bytes to put on the stack MULTI BYTE OPERATION (Consumes the following 4 bytes as well as N bytes after)BITAND
bitwise operationBITNOT
bitwise operationBITOR
bitwise operationBITXOR
bitwise operationBYTESEQUAL
are the top two values equal byte arraysCALL
Executes script bytecode from the stack.CEIL
ceil [float x] = Math.ceil(x);CLEAR
clear the stackCLONE
duplicate the entire stackCODESEPARATOR
COMBINE
combine N (top of the stack) elements into one array.CONVERT32TO64
Converts a 32 bit integer to a 64 bit integerCONVERT32TO8
Converts a 32-bit integer to an 8-bit integerCONVERT32TOFLOAT
Converts a 32 bit integer to a 32 bit floatCONVERT64TO32
Converts a 64 bit integer to a 32 bit integerCONVERT8TO32
Converts an 8-bit integer to a 32-bit integerCONVERTFLOATTO32
Converts a 32 bit float to a 32 bit integerCOPY
copy(int SourceStackElement, int SourceBeginIndex, int DestStackElement, int DestBeginIndex, int Length) From source, copy from the beginning index to Length into StackElement at DestBeginIndex to DestBeginIndex+LengthCOS
cos [float x] = Math.cos(x);DECRYPTAES
decryptaes [byte array message] [byte array key] using Cipher.getInstance("AES/ECB/PKCS5Padding").DEPTH
number of elements in stackDIVIDE
numeric Second To Top Stack Element / Top Stack ElementDIVIDEBYTES
a[i] / b[i] = c[i]DIVIDEFLOAT
numericDROP
drop the top stack elementDROPN
pops the top stack item as a byte N, then drops the next top N stack elementsDUP
duplicate the top stack elementDUP2
duplicate the top 2 stack elementsDUPN
pops the top stack item as a byte N, then duplicate the next top N stack elementsE
push Math.E onto the stackENCRYPTAES
encryptaes [byte array message] [byte array key] using Cipher.getInstance("AES/ECB/PKCS5Padding").EXPONENT
exponent [float base] [float exponent] = Math.pow(base, exponent);FABS
fabs [float x] = Math.abs(x);FALSE
push 0 on the stackFLAG
Enables a specific metadata byte flag for the script.FLAGDATA
flagdata [byte flag] [byte number of bytes to push] [byte...FLIP
reverse the entire stackFLOOR
floor [float x] = Math.floor(x);GET
get(int StackElementIndex, int BeginIndex, int Length) StackElement is the Nth (from BOTTOM of the stack) element on the stack From StackElement, copy from BeginIndex to BeginIndex+Length onto the top of the stackGREATERTHAN
GREATERTHANEQUAL
INSTRUCTION
push the instruction counter value onto the stackINVERTFLOAT
1/xISFIN
isfin [float x] = Float.isFinite(x);ISINF
isinf [float x] = Float.isInfinite(x);ISNAN
isnan [float x] = Float.isNaN(x);JUMP
Jumps to the specified instruction.JUMPIF
Jumps to the specified instruction.LEN
push the length of the top stack element on top of the stack WITHOUT removing itLENEQUAL
are the top two values equal in lengthLESSTHAN
LESSTHANEQUAL
LIMIT
top stack item is a byte number of elements to trim the second-to-top stack array toLOG
log [float x] = Math.log(x);LOGN
logn [float x] [float n] = Math.log(n) / Math.log(x);MODULO
Second To Top Stack Element % Top Stack ElementMULTIPLY
numericMULTIPLYBYTES
a[i] * b[i] = c[i]MULTIPLYFLOAT
numericNEGATE
-xNEGATEFLOAT
-xNOP
No operation, this operator is ignoredNOT
boolean logic (byte either 1 or 0)NOTEQUAL
NOTZERO
NULL
push null onto the stackNUMEQUAL
are the top two values numerically equal when interpreted as 4 byte integersOR
boolean logic (byte either 1 or 0)PI
pi = Math.PI;PICK
copy the Nth (from BOTTOM of the stack) element on the stack and push it onto the stackPUSH
the next byte specifies the number of following bytes to put on the stack MULTI BYTE OPERATION (Consumes the following byte as well as N bytes after)PUT
Pop the top stack element as N, pop the next stack element and put it into the Nth from the BOTTOM element's location put(byte[] Value, byte Address)RETURN
script fails unconditionallyRETURNIF
script fails IF there is a 1 on top of the stackREVERSE
reverse the order of the top stack elementROOT
root [float base] [float exponent] = Math.pow(base, 1.0 / exponent);ROUND
round [float x] = Math.round(x);SET
set(byte[] Source, int StackElement, int BeginIndex, int Length) StackElement is the Nth (from BOTTOM of the stack) element on the stack From source, copy from the beginning to Length into StackElement at BeginIndex to BeginIndex+LengthSHA512
SHA512EQUAL
does the top stack value == sha512(second value)SHIFTDOWN
shift the entire stack, so the top element becomes second, last becomes first etcSHIFTELEMENTSLEFT
shift the top stack element's elements to the left, so the first element becomes the last, second becomes firstSHIFTELEMENTSRIGHT
shift the top stack element's elements to the right, so the first element becomes the second, last becomes firstSHIFTN
shift the entire stack, N elements, based on the byte on top of the stackSHIFTNEXCEPT
shift the entire stack EXCEPT the bottom X elements, by Y elements, where X is top of the stack and Y is second so shiftNExcept(1, 4) 1 shift 4 excluded elementsSHIFTUP
shift the entire stack, so the top element becomes last, second becomes first etcSIN
sin [float x] = Math.sin(x);SPLIT
split top most stackSUBTRACT
numericSUBTRACTBYTES
a[i] - b[i] = c[i]SUBTRACTFLOAT
numericSWAP
swap the top 2 stack elementsTAN
tan [float x] = Math.tan(x);THIS
Push the entire script bytecode on to the stack.TIME
push the time in unix epoch secondsTRUE
push 1 on the stackUNZIP
VERIFY
script execution continues if there is a 1 on the stack, else failsVERIFYMULTISIG
Deprecated.VERIFYSIG
gets the public key (top of stack) and the signature (second to top) and stops the script, failing if necessary//pushes true if verifiedXOR
boolean logic (byte either 1 or 0)ZIP
-
Field Summary
Fields Modifier and Type Field Description byte
OPCode
-
Method Summary
Modifier and Type Method Description static ScriptOperator
getByOpCode(byte OPCode)
static ScriptOperator
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ScriptOperator[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NOP
No operation, this operator is ignored -
PUSH
the next byte specifies the number of following bytes to put on the stack MULTI BYTE OPERATION (Consumes the following byte as well as N bytes after) -
INSTRUCTION
push the instruction counter value onto the stack -
FLAG
Enables a specific metadata byte flag for the script. Has no effect on execution. MULTI BYTE OPERATION (Consumes the following byte) -
BIGPUSH
the next 4 bytes specify the number of following bytes to put on the stack MULTI BYTE OPERATION (Consumes the following 4 bytes as well as N bytes after) -
FLAGDATA
flagdata [byte flag] [byte number of bytes to push] [byte... bytes] MULTI BYTE OPERATION (Consumes the following two bytes as well as N bytes after) -
TIME
push the time in unix epoch seconds -
PICK
copy the Nth (from BOTTOM of the stack) element on the stack and push it onto the stack -
PUT
Pop the top stack element as N, pop the next stack element and put it into the Nth from the BOTTOM element's location put(byte[] Value, byte Address) -
NUMEQUAL
are the top two values numerically equal when interpreted as 4 byte integers -
BYTESEQUAL
are the top two values equal byte arrays -
SHA512EQUAL
does the top stack value == sha512(second value) -
LENEQUAL
are the top two values equal in length -
LESSTHAN
-
LESSTHANEQUAL
-
GREATERTHAN
-
GREATERTHANEQUAL
-
NOTEQUAL
-
NOTZERO
-
GET
get(int StackElementIndex, int BeginIndex, int Length) StackElement is the Nth (from BOTTOM of the stack) element on the stack From StackElement, copy from BeginIndex to BeginIndex+Length onto the top of the stack -
SET
set(byte[] Source, int StackElement, int BeginIndex, int Length) StackElement is the Nth (from BOTTOM of the stack) element on the stack From source, copy from the beginning to Length into StackElement at BeginIndex to BeginIndex+Length -
COPY
copy(int SourceStackElement, int SourceBeginIndex, int DestStackElement, int DestBeginIndex, int Length) From source, copy from the beginning index to Length into StackElement at DestBeginIndex to DestBeginIndex+Length -
ALLOC
alloc(int NumberOfBytes) Push a new element onto the stack, consisting of NumberOfBytes zeros -
THIS
Push the entire script bytecode on to the stack. Only available with ExtendedFlowControl due to recursion -
ADD
numeric -
SUBTRACT
numeric -
MULTIPLY
numeric -
DIVIDE
numeric Second To Top Stack Element / Top Stack Element -
ADDBYTES
a[i] + b[i] = c[i] -
SUBTRACTBYTES
a[i] - b[i] = c[i] -
MULTIPLYBYTES
a[i] * b[i] = c[i] -
DIVIDEBYTES
a[i] / b[i] = c[i] -
NEGATE
-x -
MODULO
Second To Top Stack Element % Top Stack Element -
CONVERT8TO32
Converts an 8-bit integer to a 32-bit integer -
CONVERT32TO8
Converts a 32-bit integer to an 8-bit integer -
CONVERT64TO32
Converts a 64 bit integer to a 32 bit integer -
CONVERT32TO64
Converts a 32 bit integer to a 64 bit integer -
CONVERTFLOATTO32
Converts a 32 bit float to a 32 bit integer -
CONVERT32TOFLOAT
Converts a 32 bit integer to a 32 bit float -
BITNOT
bitwise operation -
BITOR
bitwise operation -
BITAND
bitwise operation -
BITXOR
bitwise operation -
APPEND
combine the top two stack items -
LIMIT
top stack item is a byte number of elements to trim the second-to-top stack array to -
REVERSE
reverse the order of the top stack element -
SPLIT
split top most stack -
COMBINE
combine N (top of the stack) elements into one array. use depth before combine to do all -
LEN
push the length of the top stack element on top of the stack WITHOUT removing it -
NOT
boolean logic (byte either 1 or 0) -
OR
boolean logic (byte either 1 or 0) -
AND
boolean logic (byte either 1 or 0) -
XOR
boolean logic (byte either 1 or 0) -
INVERTFLOAT
1/x -
NEGATEFLOAT
-x -
ADDFLOAT
numeric -
SUBTRACTFLOAT
numeric -
MULTIPLYFLOAT
numeric -
DIVIDEFLOAT
numeric -
LOGN
logn [float x] [float n] = Math.log(n) / Math.log(x); -
ISINF
isinf [float x] = Float.isInfinite(x); -
ISFIN
isfin [float x] = Float.isFinite(x); -
EXPONENT
exponent [float base] [float exponent] = Math.pow(base, exponent); -
ROOT
root [float base] [float exponent] = Math.pow(base, 1.0 / exponent); -
ABS
abs [int x] = Math.abs(x); -
FABS
fabs [float x] = Math.abs(x); -
LOG
log [float x] = Math.log(x); -
SIN
sin [float x] = Math.sin(x); -
PI
pi = Math.PI; -
COS
cos [float x] = Math.cos(x); -
TAN
tan [float x] = Math.tan(x); -
ASIN
asin [float x] = Math.asin(x); -
ACOS
acos [float x] = Math.acos(x); -
ATAN
atan [float x] = Math.atan(x); -
FLOOR
floor [float x] = Math.floor(x); -
CEIL
ceil [float x] = Math.ceil(x); -
ROUND
round [float x] = Math.round(x); -
ISNAN
isnan [float x] = Float.isNaN(x); -
E
push Math.E onto the stack -
NULL
push null onto the stack -
FALSE
push 0 on the stack -
TRUE
push 1 on the stack -
DEPTH
number of elements in stack -
DROP
drop the top stack element -
DUP
duplicate the top stack element -
SWAP
swap the top 2 stack elements -
CLEAR
clear the stack -
CLONE
duplicate the entire stack -
FLIP
reverse the entire stack -
SHIFTUP
shift the entire stack, so the top element becomes last, second becomes first etc -
SHIFTDOWN
shift the entire stack, so the top element becomes second, last becomes first etc -
SHIFTN
shift the entire stack, N elements, based on the byte on top of the stack -
SHIFTELEMENTSRIGHT
shift the top stack element's elements to the right, so the first element becomes the second, last becomes first -
SHIFTELEMENTSLEFT
shift the top stack element's elements to the left, so the first element becomes the last, second becomes first -
DUP2
duplicate the top 2 stack elements -
DUPN
pops the top stack item as a byte N, then duplicate the next top N stack elements -
DROPN
pops the top stack item as a byte N, then drops the next top N stack elements -
SHIFTNEXCEPT
shift the entire stack EXCEPT the bottom X elements, by Y elements, where X is top of the stack and Y is second so shiftNExcept(1, 4) 1 shift 4 excluded elements -
VERIFY
script execution continues if there is a 1 on the stack, else fails -
RETURN
script fails unconditionally -
RETURNIF
script fails IF there is a 1 on top of the stack -
SHA512
-
ZIP
-
UNZIP
-
ENCRYPTAES
encryptaes [byte array message] [byte array key] using Cipher.getInstance("AES/ECB/PKCS5Padding"). -
DECRYPTAES
decryptaes [byte array message] [byte array key] using Cipher.getInstance("AES/ECB/PKCS5Padding"). -
VERIFYSIG
gets the public key (top of stack) and the signature (second to top) and stops the script, failing if necessary//pushes true if verified -
CODESEPARATOR
-
VERIFYMULTISIG
Deprecated.input stack: [signatures...] byte[] [number of required signatures] byte [public keys...] byte[] [number of public keys] byte -
CALL
Executes script bytecode from the stack. Stack elements are [virtual script bytecode] [byte number of stack items to take] then N byte arrays Pushes the resulting stack and then a true or false based on whether the execution was successful Used to be called virtual script because a new virtual machine is created to run the function (cannot access outside its scope) -
JUMP
Jumps to the specified instruction. This is relative to the current location. In standard transaction scripts you cannot jump backwards. Expects a byte on top of the stack to be ADDED TO the instruction counter. -
JUMPIF
Jumps to the specified instruction. This is relative to the current location. In standard transaction scripts you cannot jump backwards. Expects a byte on top of the stack to be ADDED TO the instruction counter conditionally followed by a byte as boolean.
-
-
Field Details
-
OPCode
public final byte OPCode
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getByOpCode
-