trait ScriptNumberUtil extends AnyRef

Created by chris on 6/5/16. Numbers in script are unique in the fact that they don't follow a conventional signed numbering system such as ones complement or twos complement. The bitcoin protocol uses little endian notation which means the most significant bit indicates the sign on the number we are interpreting. The rest of the bits are used to determine what that number is. See this irc log for more info https://botbot.me/freenode/bitcoin-core-dev/2016-06-06/?tz=America/Chicago

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ScriptNumberUtil
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def changeSignBitToNegative(bytes: ByteVector): ByteVector
  6. def changeSignBitToNegative(hex: String): ByteVector
  7. def changeSignBitToPositive(hex: String): ByteVector
  8. def changeSignBitToPositive(bytes: ByteVector): ByteVector

    Change sign bit to positive

  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. def firstByteAllZeros(hex: String): Boolean
  14. def firstByteAllZeros(bytes: ByteVector): Boolean
  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def isNegative(bytes: ByteVector): Boolean
  19. def isNegative(hex: String): Boolean
  20. def isPositive(hex: String): Boolean

    Determines if a given hex string is a positive number

  21. def isPositive(bytes: ByteVector): Boolean

    Determines if a byte array is a positive or negative number

  22. def isZero(x: ScriptNumber): Boolean

    Checks if the two given numbers are equivalent to zero in Script.

    Checks if the two given numbers are equivalent to zero in Script. Unfortunatey Script is one's complement which means we have things like negative zero, and also there isn't an enforcement of a minimal representation of zero, which means 0x00 = 0x0000 = 0x0000000.. == OP_0

  23. def longToByteVector(long: Long): ByteVector

    Converts a long number to the bytevec representation in Script

  24. def longToHex(long: Long): String

    Converts a long number to the representation of number inside of Bitcoin script's number system

  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  29. def toByteVec(long: Long): ByteVector
  30. def toInt(bytes: ByteVector): Int

    Takes in a sequence of bytes and converts it into a signed number This should only be used for numbers inside of Script

  31. def toInt(hex: String): Int

    Takes in a hex string and converts it into a signed number This function interprets the bytes as little endian numbers This should only be used for numbers inside of Script

  32. def toLong(bytes: ByteVector): Long

    Takes a sequence of bytes and converts it in to signed number inside of bitcoin script's numbering system This function interprets the bytes as little endian numbers This should only be used for numbers inside of Script

  33. def toLong(hex: String): Long

    Takes a hex number and converts it into a signed number used in the bitcoin script's numbering system.

    Takes a hex number and converts it into a signed number used in the bitcoin script's numbering system. This function interprets the bytes as little endian numbers This should only be used for numbers inside of Script

  34. def toString(): String
    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  36. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  37. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped