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
- Alphabetic
- By Inheritance
- ScriptNumberUtil
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def changeSignBitToNegative(bytes: ByteVector): ByteVector
- def changeSignBitToNegative(hex: String): ByteVector
- def changeSignBitToPositive(hex: String): ByteVector
- def changeSignBitToPositive(bytes: ByteVector): ByteVector
Change sign bit to positive
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def firstByteAllZeros(hex: String): Boolean
- def firstByteAllZeros(bytes: ByteVector): Boolean
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isNegative(bytes: ByteVector): Boolean
- def isNegative(hex: String): Boolean
- def isPositive(hex: String): Boolean
Determines if a given hex string is a positive number
- def isPositive(bytes: ByteVector): Boolean
Determines if a byte array is a positive or negative number
- 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
- def longToByteVector(long: Long): ByteVector
Converts a long number to the bytevec representation in Script
- def longToHex(long: Long): String
Converts a long number to the representation of number inside of Bitcoin script's number system
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toByteVec(long: Long): ByteVector
- 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
- 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
- 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
- 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
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()