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

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants 
    Enum Constant Description
    ABS
    abs [int x] = Math.abs(x);
    ACOS
    acos [float x] = Math.acos(x);
    ADD
    numeric
    ADDBYTES
    a[i] + b[i] = c[i]
    ADDFLOAT
    numeric
    ALLOC
    alloc(int NumberOfBytes) Push a new element onto the stack, consisting of NumberOfBytes zeros
    AND
    boolean logic (byte either 1 or 0)
    APPEND
    combine the top two stack items
    ASIN
    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 operation
    BITNOT
    bitwise operation
    BITOR
    bitwise operation
    BITXOR
    bitwise operation
    BYTESEQUAL
    are the top two values equal byte arrays
    CALL
    Executes script bytecode from the stack.
    CEIL
    ceil [float x] = Math.ceil(x);
    CLEAR
    clear the stack
    CLONE
    duplicate the entire stack
    CODESEPARATOR  
    COMBINE
    combine N (top of the stack) elements into one array.
    CONVERT32TO64
    Converts a 32 bit integer to a 64 bit integer
    CONVERT32TO8
    Converts a 32-bit integer to an 8-bit integer
    CONVERT32TOFLOAT
    Converts a 32 bit integer to a 32 bit float
    CONVERT64TO32
    Converts a 64 bit integer to a 32 bit integer
    CONVERT8TO32
    Converts an 8-bit integer to a 32-bit integer
    CONVERTFLOATTO32
    Converts a 32 bit float to a 32 bit integer
    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
    COS
    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 stack
    DIVIDE
    numeric Second To Top Stack Element / Top Stack Element
    DIVIDEBYTES
    a[i] / b[i] = c[i]
    DIVIDEFLOAT
    numeric
    DROP
    drop the top stack element
    DROPN
    pops the top stack item as a byte N, then drops the next top N stack elements
    DUP
    duplicate the top stack element
    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
    E
    push Math.E onto the stack
    ENCRYPTAES
    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 stack
    FLAG
    Enables a specific metadata byte flag for the script.
    FLAGDATA
    flagdata [byte flag] [byte number of bytes to push] [byte...
    FLIP
    reverse the entire stack
    FLOOR
    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 stack
    GREATERTHAN  
    GREATERTHANEQUAL  
    INSTRUCTION
    push the instruction counter value onto the stack
    INVERTFLOAT
    1/x
    ISFIN
    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 it
    LENEQUAL
    are the top two values equal in length
    LESSTHAN  
    LESSTHANEQUAL  
    LIMIT
    top stack item is a byte number of elements to trim the second-to-top stack array to
    LOG
    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 Element
    MULTIPLY
    numeric
    MULTIPLYBYTES
    a[i] * b[i] = c[i]
    MULTIPLYFLOAT
    numeric
    NEGATE
    -x
    NEGATEFLOAT
    -x
    NOP
    No operation, this operator is ignored
    NOT
    boolean logic (byte either 1 or 0)
    NOTEQUAL  
    NOTZERO  
    NULL
    push null onto the stack
    NUMEQUAL
    are the top two values numerically equal when interpreted as 4 byte integers
    OR
    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 stack
    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)
    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 unconditionally
    RETURNIF
    script fails IF there is a 1 on top of the stack
    REVERSE
    reverse the order of the top stack element
    ROOT
    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+Length
    SHA512  
    SHA512EQUAL
    does the top stack value == sha512(second value)
    SHIFTDOWN
    shift the entire stack, so the top element becomes second, last becomes first etc
    SHIFTELEMENTSLEFT
    shift the top stack element's elements to the left, so the first element becomes the last, second becomes first
    SHIFTELEMENTSRIGHT
    shift the top stack element's elements to the right, so the first element becomes the second, last becomes first
    SHIFTN
    shift the entire stack, N elements, based on the byte on top of the stack
    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
    SHIFTUP
    shift the entire stack, so the top element becomes last, second becomes first etc
    SIN
    sin [float x] = Math.sin(x);
    SPLIT
    split top most stack
    SUBTRACT
    numeric
    SUBTRACTBYTES
    a[i] - b[i] = c[i]
    SUBTRACTFLOAT
    numeric
    SWAP
    swap the top 2 stack elements
    TAN
    tan [float x] = Math.tan(x);
    THIS
    Push the entire script bytecode on to the stack.
    TIME
    push the time in unix epoch seconds
    TRUE
    push 1 on the stack
    UNZIP  
    VERIFY
    script execution continues if there is a 1 on the stack, else fails
    VERIFYMULTISIG
    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 verified
    XOR
    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.

    Methods inherited from class java.lang.Enum

    clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NOP

      public static final ScriptOperator NOP
      No operation, this operator is ignored
    • PUSH

      public static final ScriptOperator 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

      public static final ScriptOperator INSTRUCTION
      push the instruction counter value onto the stack
    • FLAG

      public static final ScriptOperator FLAG
      Enables a specific metadata byte flag for the script. Has no effect on execution. MULTI BYTE OPERATION (Consumes the following byte)
    • BIGPUSH

      public static final ScriptOperator 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

      public static final ScriptOperator 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

      public static final ScriptOperator TIME
      push the time in unix epoch seconds
    • PICK

      public static final ScriptOperator PICK
      copy the Nth (from BOTTOM of the stack) element on the stack and push it onto the stack
    • PUT

      public static final ScriptOperator 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

      public static final ScriptOperator NUMEQUAL
      are the top two values numerically equal when interpreted as 4 byte integers
    • BYTESEQUAL

      public static final ScriptOperator BYTESEQUAL
      are the top two values equal byte arrays
    • SHA512EQUAL

      public static final ScriptOperator SHA512EQUAL
      does the top stack value == sha512(second value)
    • LENEQUAL

      public static final ScriptOperator LENEQUAL
      are the top two values equal in length
    • LESSTHAN

      public static final ScriptOperator LESSTHAN
    • LESSTHANEQUAL

      public static final ScriptOperator LESSTHANEQUAL
    • GREATERTHAN

      public static final ScriptOperator GREATERTHAN
    • GREATERTHANEQUAL

      public static final ScriptOperator GREATERTHANEQUAL
    • NOTEQUAL

      public static final ScriptOperator NOTEQUAL
    • NOTZERO

      public static final ScriptOperator NOTZERO
    • GET

      public static final ScriptOperator 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

      public static final ScriptOperator 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

      public static final ScriptOperator 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

      public static final ScriptOperator ALLOC
      alloc(int NumberOfBytes) Push a new element onto the stack, consisting of NumberOfBytes zeros
    • THIS

      public static final ScriptOperator THIS
      Push the entire script bytecode on to the stack. Only available with ExtendedFlowControl due to recursion
    • ADD

      public static final ScriptOperator ADD
      numeric
    • SUBTRACT

      public static final ScriptOperator SUBTRACT
      numeric
    • MULTIPLY

      public static final ScriptOperator MULTIPLY
      numeric
    • DIVIDE

      public static final ScriptOperator DIVIDE
      numeric Second To Top Stack Element / Top Stack Element
    • ADDBYTES

      public static final ScriptOperator ADDBYTES
      a[i] + b[i] = c[i]
    • SUBTRACTBYTES

      public static final ScriptOperator SUBTRACTBYTES
      a[i] - b[i] = c[i]
    • MULTIPLYBYTES

      public static final ScriptOperator MULTIPLYBYTES
      a[i] * b[i] = c[i]
    • DIVIDEBYTES

      public static final ScriptOperator DIVIDEBYTES
      a[i] / b[i] = c[i]
    • NEGATE

      public static final ScriptOperator NEGATE
      -x
    • MODULO

      public static final ScriptOperator MODULO
      Second To Top Stack Element % Top Stack Element
    • CONVERT8TO32

      public static final ScriptOperator CONVERT8TO32
      Converts an 8-bit integer to a 32-bit integer
    • CONVERT32TO8

      public static final ScriptOperator CONVERT32TO8
      Converts a 32-bit integer to an 8-bit integer
    • CONVERT64TO32

      public static final ScriptOperator CONVERT64TO32
      Converts a 64 bit integer to a 32 bit integer
    • CONVERT32TO64

      public static final ScriptOperator CONVERT32TO64
      Converts a 32 bit integer to a 64 bit integer
    • CONVERTFLOATTO32

      public static final ScriptOperator CONVERTFLOATTO32
      Converts a 32 bit float to a 32 bit integer
    • CONVERT32TOFLOAT

      public static final ScriptOperator CONVERT32TOFLOAT
      Converts a 32 bit integer to a 32 bit float
    • BITNOT

      public static final ScriptOperator BITNOT
      bitwise operation
    • BITOR

      public static final ScriptOperator BITOR
      bitwise operation
    • BITAND

      public static final ScriptOperator BITAND
      bitwise operation
    • BITXOR

      public static final ScriptOperator BITXOR
      bitwise operation
    • APPEND

      public static final ScriptOperator APPEND
      combine the top two stack items
    • LIMIT

      public static final ScriptOperator LIMIT
      top stack item is a byte number of elements to trim the second-to-top stack array to
    • REVERSE

      public static final ScriptOperator REVERSE
      reverse the order of the top stack element
    • SPLIT

      public static final ScriptOperator SPLIT
      split top most stack
    • COMBINE

      public static final ScriptOperator COMBINE
      combine N (top of the stack) elements into one array. use depth before combine to do all
    • LEN

      public static final ScriptOperator LEN
      push the length of the top stack element on top of the stack WITHOUT removing it
    • NOT

      public static final ScriptOperator NOT
      boolean logic (byte either 1 or 0)
    • OR

      public static final ScriptOperator OR
      boolean logic (byte either 1 or 0)
    • AND

      public static final ScriptOperator AND
      boolean logic (byte either 1 or 0)
    • XOR

      public static final ScriptOperator XOR
      boolean logic (byte either 1 or 0)
    • INVERTFLOAT

      public static final ScriptOperator INVERTFLOAT
      1/x
    • NEGATEFLOAT

      public static final ScriptOperator NEGATEFLOAT
      -x
    • ADDFLOAT

      public static final ScriptOperator ADDFLOAT
      numeric
    • SUBTRACTFLOAT

      public static final ScriptOperator SUBTRACTFLOAT
      numeric
    • MULTIPLYFLOAT

      public static final ScriptOperator MULTIPLYFLOAT
      numeric
    • DIVIDEFLOAT

      public static final ScriptOperator DIVIDEFLOAT
      numeric
    • LOGN

      public static final ScriptOperator LOGN
      logn [float x] [float n] = Math.log(n) / Math.log(x);
    • ISINF

      public static final ScriptOperator ISINF
      isinf [float x] = Float.isInfinite(x);
    • ISFIN

      public static final ScriptOperator ISFIN
      isfin [float x] = Float.isFinite(x);
    • EXPONENT

      public static final ScriptOperator EXPONENT
      exponent [float base] [float exponent] = Math.pow(base, exponent);
    • ROOT

      public static final ScriptOperator ROOT
      root [float base] [float exponent] = Math.pow(base, 1.0 / exponent);
    • ABS

      public static final ScriptOperator ABS
      abs [int x] = Math.abs(x);
    • FABS

      public static final ScriptOperator FABS
      fabs [float x] = Math.abs(x);
    • LOG

      public static final ScriptOperator LOG
      log [float x] = Math.log(x);
    • SIN

      public static final ScriptOperator SIN
      sin [float x] = Math.sin(x);
    • PI

      public static final ScriptOperator PI
      pi = Math.PI;
    • COS

      public static final ScriptOperator COS
      cos [float x] = Math.cos(x);
    • TAN

      public static final ScriptOperator TAN
      tan [float x] = Math.tan(x);
    • ASIN

      public static final ScriptOperator ASIN
      asin [float x] = Math.asin(x);
    • ACOS

      public static final ScriptOperator ACOS
      acos [float x] = Math.acos(x);
    • ATAN

      public static final ScriptOperator ATAN
      atan [float x] = Math.atan(x);
    • FLOOR

      public static final ScriptOperator FLOOR
      floor [float x] = Math.floor(x);
    • CEIL

      public static final ScriptOperator CEIL
      ceil [float x] = Math.ceil(x);
    • ROUND

      public static final ScriptOperator ROUND
      round [float x] = Math.round(x);
    • ISNAN

      public static final ScriptOperator ISNAN
      isnan [float x] = Float.isNaN(x);
    • E

      public static final ScriptOperator E
      push Math.E onto the stack
    • NULL

      public static final ScriptOperator NULL
      push null onto the stack
    • FALSE

      public static final ScriptOperator FALSE
      push 0 on the stack
    • TRUE

      public static final ScriptOperator TRUE
      push 1 on the stack
    • DEPTH

      public static final ScriptOperator DEPTH
      number of elements in stack
    • DROP

      public static final ScriptOperator DROP
      drop the top stack element
    • DUP

      public static final ScriptOperator DUP
      duplicate the top stack element
    • SWAP

      public static final ScriptOperator SWAP
      swap the top 2 stack elements
    • CLEAR

      public static final ScriptOperator CLEAR
      clear the stack
    • CLONE

      public static final ScriptOperator CLONE
      duplicate the entire stack
    • FLIP

      public static final ScriptOperator FLIP
      reverse the entire stack
    • SHIFTUP

      public static final ScriptOperator SHIFTUP
      shift the entire stack, so the top element becomes last, second becomes first etc
    • SHIFTDOWN

      public static final ScriptOperator SHIFTDOWN
      shift the entire stack, so the top element becomes second, last becomes first etc
    • SHIFTN

      public static final ScriptOperator SHIFTN
      shift the entire stack, N elements, based on the byte on top of the stack
    • SHIFTELEMENTSRIGHT

      public static final ScriptOperator SHIFTELEMENTSRIGHT
      shift the top stack element's elements to the right, so the first element becomes the second, last becomes first
    • SHIFTELEMENTSLEFT

      public static final ScriptOperator SHIFTELEMENTSLEFT
      shift the top stack element's elements to the left, so the first element becomes the last, second becomes first
    • DUP2

      public static final ScriptOperator DUP2
      duplicate the top 2 stack elements
    • DUPN

      public static final ScriptOperator DUPN
      pops the top stack item as a byte N, then duplicate the next top N stack elements
    • DROPN

      public static final ScriptOperator DROPN
      pops the top stack item as a byte N, then drops the next top N stack elements
    • SHIFTNEXCEPT

      public static final ScriptOperator 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

      public static final ScriptOperator VERIFY
      script execution continues if there is a 1 on the stack, else fails
    • RETURN

      public static final ScriptOperator RETURN
      script fails unconditionally
    • RETURNIF

      public static final ScriptOperator RETURNIF
      script fails IF there is a 1 on top of the stack
    • SHA512

      public static final ScriptOperator SHA512
    • ZIP

      public static final ScriptOperator ZIP
    • UNZIP

      public static final ScriptOperator UNZIP
    • ENCRYPTAES

      public static final ScriptOperator ENCRYPTAES
      encryptaes [byte array message] [byte array key] using Cipher.getInstance("AES/ECB/PKCS5Padding").
    • DECRYPTAES

      public static final ScriptOperator DECRYPTAES
      decryptaes [byte array message] [byte array key] using Cipher.getInstance("AES/ECB/PKCS5Padding").
    • VERIFYSIG

      public static final ScriptOperator 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

      public static final ScriptOperator CODESEPARATOR
    • VERIFYMULTISIG

      @Deprecated public static final ScriptOperator VERIFYMULTISIG
      Deprecated.
      input stack: [signatures...] byte[] [number of required signatures] byte [public keys...] byte[] [number of public keys] byte
    • CALL

      public static final ScriptOperator 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

      public static final ScriptOperator 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

      public static final ScriptOperator 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

      public static ScriptOperator[] 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

      public static ScriptOperator valueOf​(java.lang.String name)
      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 name
      java.lang.NullPointerException - if the argument is null
    • getByOpCode

      public static ScriptOperator getByOpCode​(byte OPCode)