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 ABSabs [int x] = Math.abs(x);ACOSacos [float x] = Math.acos(x);ADDnumericADDBYTESa[i] + b[i] = c[i]ADDFLOATnumericALLOCalloc(int NumberOfBytes) Push a new element onto the stack, consisting of NumberOfBytes zerosANDboolean logic (byte either 1 or 0)APPENDcombine the top two stack itemsASINasin [float x] = Math.asin(x);ATANatan [float x] = Math.atan(x);BIGPUSHthe 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)BITANDbitwise operationBITNOTbitwise operationBITORbitwise operationBITXORbitwise operationBYTESEQUALare the top two values equal byte arraysCALLExecutes script bytecode from the stack.CEILceil [float x] = Math.ceil(x);CLEARclear the stackCLONEduplicate the entire stackCODESEPARATORCOMBINEcombine N (top of the stack) elements into one array.CONVERT32TO64Converts a 32 bit integer to a 64 bit integerCONVERT32TO8Converts a 32-bit integer to an 8-bit integerCONVERT32TOFLOATConverts a 32 bit integer to a 32 bit floatCONVERT64TO32Converts a 64 bit integer to a 32 bit integerCONVERT8TO32Converts an 8-bit integer to a 32-bit integerCONVERTFLOATTO32Converts a 32 bit float to a 32 bit integerCOPYcopy(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+LengthCOScos [float x] = Math.cos(x);DECRYPTAESdecryptaes [byte array message] [byte array key] using Cipher.getInstance("AES/ECB/PKCS5Padding").DEPTHnumber of elements in stackDIVIDEnumeric Second To Top Stack Element / Top Stack ElementDIVIDEBYTESa[i] / b[i] = c[i]DIVIDEFLOATnumericDROPdrop the top stack elementDROPNpops the top stack item as a byte N, then drops the next top N stack elementsDUPduplicate the top stack elementDUP2duplicate the top 2 stack elementsDUPNpops the top stack item as a byte N, then duplicate the next top N stack elementsEpush Math.E onto the stackENCRYPTAESencryptaes [byte array message] [byte array key] using Cipher.getInstance("AES/ECB/PKCS5Padding").EXPONENTexponent [float base] [float exponent] = Math.pow(base, exponent);FABSfabs [float x] = Math.abs(x);FALSEpush 0 on the stackFLAGEnables a specific metadata byte flag for the script.FLAGDATAflagdata [byte flag] [byte number of bytes to push] [byte...FLIPreverse the entire stackFLOORfloor [float x] = Math.floor(x);GETget(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 stackGREATERTHANGREATERTHANEQUALINSTRUCTIONpush the instruction counter value onto the stackINVERTFLOAT1/xISFINisfin [float x] = Float.isFinite(x);ISINFisinf [float x] = Float.isInfinite(x);ISNANisnan [float x] = Float.isNaN(x);JUMPJumps to the specified instruction.JUMPIFJumps to the specified instruction.LENpush the length of the top stack element on top of the stack WITHOUT removing itLENEQUALare the top two values equal in lengthLESSTHANLESSTHANEQUALLIMITtop stack item is a byte number of elements to trim the second-to-top stack array toLOGlog [float x] = Math.log(x);LOGNlogn [float x] [float n] = Math.log(n) / Math.log(x);MODULOSecond To Top Stack Element % Top Stack ElementMULTIPLYnumericMULTIPLYBYTESa[i] * b[i] = c[i]MULTIPLYFLOATnumericNEGATE-xNEGATEFLOAT-xNOPNo operation, this operator is ignoredNOTboolean logic (byte either 1 or 0)NOTEQUALNOTZERONULLpush null onto the stackNUMEQUALare the top two values numerically equal when interpreted as 4 byte integersORboolean logic (byte either 1 or 0)PIpi = Math.PI;PICKcopy the Nth (from BOTTOM of the stack) element on the stack and push it onto the stackPUSHthe 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)PUTPop 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)RETURNscript fails unconditionallyRETURNIFscript fails IF there is a 1 on top of the stackREVERSEreverse the order of the top stack elementROOTroot [float base] [float exponent] = Math.pow(base, 1.0 / exponent);ROUNDround [float x] = Math.round(x);SETset(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+LengthSHA512SHA512EQUALdoes the top stack value == sha512(second value)SHIFTDOWNshift the entire stack, so the top element becomes second, last becomes first etcSHIFTELEMENTSLEFTshift the top stack element's elements to the left, so the first element becomes the last, second becomes firstSHIFTELEMENTSRIGHTshift the top stack element's elements to the right, so the first element becomes the second, last becomes firstSHIFTNshift the entire stack, N elements, based on the byte on top of the stackSHIFTNEXCEPTshift 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 elementsSHIFTUPshift the entire stack, so the top element becomes last, second becomes first etcSINsin [float x] = Math.sin(x);SPLITsplit top most stackSUBTRACTnumericSUBTRACTBYTESa[i] - b[i] = c[i]SUBTRACTFLOATnumericSWAPswap the top 2 stack elementsTANtan [float x] = Math.tan(x);THISPush the entire script bytecode on to the stack.TIMEpush the time in unix epoch secondsTRUEpush 1 on the stackUNZIPVERIFYscript execution continues if there is a 1 on the stack, else failsVERIFYMULTISIGDeprecated.VERIFYSIGgets the public key (top of stack) and the signature (second to top) and stops the script, failing if necessary//pushes true if verifiedXORboolean logic (byte either 1 or 0)ZIP -
Field Summary
Fields Modifier and Type Field Description byteOPCode -
Method Summary
Modifier and Type Method Description static ScriptOperatorgetByOpCode(byte OPCode)static ScriptOperatorvalueOf(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
-