Packages

trait BitcoinScriptUtil extends BitcoinSLogger

Created by chris on 3/2/16.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BitcoinScriptUtil
  2. BitcoinSLogger
  3. AnyRef
  4. 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 asmToBytes(asm: Seq[ScriptToken]): ByteVector

    Converts a sequence of script tokens to them to their byte values

  6. def asmToHex(asm: Seq[ScriptToken]): String

    Takes in a sequence of script tokens and converts them to their hexadecimal value

  7. def calculatePushOp(bytes: ByteVector): Seq[ScriptToken]
  8. def calculatePushOp(scriptToken: ScriptToken): Seq[ScriptToken]

    Calculates the push operation for the given ScriptToken

  9. def calculateScriptForChecking(txSignatureComponent: TxSigComponent, signature: ECDigitalSignature, script: Seq[ScriptToken]): Seq[ScriptToken]

    Prepares the script we spending to be serialized for our transaction signature serialization algorithm We need to check if the scriptSignature has a redeemScript In that case, we need to pass the redeemScript to the TransactionSignatureChecker

    Prepares the script we spending to be serialized for our transaction signature serialization algorithm We need to check if the scriptSignature has a redeemScript In that case, we need to pass the redeemScript to the TransactionSignatureChecker

    In the case we have a P2SH(P2WSH) we need to pass the witness's redeem script to the TransactionSignatureChecker instead of passing the WitnessScriptPubKey inside of the P2SHScriptSignature's redeem script.

  10. def calculateScriptForSigning(txSignatureComponent: TxSigComponent, script: Seq[ScriptToken]): Seq[ScriptToken]
  11. def castToBool(token: ScriptToken): Boolean

    Casts the given script token to a boolean value Mimics this function inside of Bitcoin Core https://github.com/bitcoin/bitcoin/blob/8c1dbc5e9ddbafb77e60e8c4e6eb275a3a76ac12/src/script/interpreter.cpp#L38 All bytes in the byte vector must be zero, unless it is the last byte, which can be 0 or 0x80 (negative zero)

  12. def checkPubKeyEncoding(key: ECPublicKey, flags: Seq[ScriptFlag]): Boolean
  13. def checkPubKeyEncoding(key: ECPublicKey, program: ExecutionInProgressScriptProgram): Boolean

    Checks the ECPublicKey encoding according to bitcoin core's function: https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp#L202.

  14. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  15. def countSigOps(script: Seq[ScriptToken]): Long

    Counts the amount of sigops in a script.

    Counts the amount of sigops in a script. Bitcoin Core script.cpp

    script

    the script whose sigops are being counted

    returns

    the number of signature operations in the script

  16. def countsTowardsScriptOpLimit(token: ScriptToken): Boolean

    Returns true if the given script token counts towards our max script operations in a script See interpreter.cpp#L269-L271 which is how Bitcoin Core handles this

  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  19. def filterPushOps(asm: Seq[ScriptToken]): Seq[ScriptToken]

    Filters out push operations in our sequence of script tokens this removes OP_PUSHDATA1, OP_PUSHDATA2, OP_PUSHDATA4, and all ByteToPushOntoStack tokens

  20. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. def getDataTokens(asm: Seq[ScriptToken]): Seq[ScriptToken]

    Returns only the data ScriptTokens in a script that are pushed onto the stack

  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  23. def isCompressedOrUncompressedPubKey(key: ECPublicKey): Boolean

    Returns true if the key is compressed or uncompressed, false otherwise https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp#L66

    Returns true if the key is compressed or uncompressed, false otherwise https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp#L66

    key

    the public key that is being checked

    returns

    true if the key is compressed/uncompressed otherwise false

  24. def isCompressedPubKey(key: ECPublicKey): Boolean

    Checks if the given public key is a compressed public key

  25. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  26. def isMinimalPush(pushOp: ScriptToken, token: ScriptToken): Boolean

    Determines if the token being pushed onto the stack is being pushed by the SMALLEST push operation possible This is equivalent to Bitcoin Core interpreter.cpp#L209

    Determines if the token being pushed onto the stack is being pushed by the SMALLEST push operation possible This is equivalent to Bitcoin Core interpreter.cpp#L209

    pushOp

    the operation that is pushing the data onto the stack

    token

    the token that is being pushed onto the stack by the pushOp

  27. def isMinimalToken(token: ScriptToken): Boolean

    Checks if the token is minimially encoded

  28. def isOnlyCompressedPubKey(spk: ScriptPubKey): Boolean

    Checks that all the ECPublicKey in this script is compressed public keys, this is required for BIP143

  29. def isPushOnly(script: Seq[ScriptToken]): Boolean

    Determines if a script contains only script operations This is equivalent to Bitcoin Core script.cpp#L213

  30. def isShortestEncoding(hex: String): Boolean

    Whenever a script constant is interpreted to a number BIP62 should enforce that number to be encoded in the smallest encoding possible https://github.com/bitcoin/bitcoin/blob/a6a860796a44a2805a58391a009ba22752f64e32/src/script/script.h#L220-L237

  31. def isShortestEncoding(bytes: ByteVector): Boolean
  32. def isShortestEncoding(constant: ScriptConstant): Boolean

    Whenever a ScriptConstant is interpreted to a number BIP62 could enforce that number to be encoded in the smallest encoding possible https://github.com/bitcoin/bitcoin/blob/a6a860796a44a2805a58391a009ba22752f64e32/src/script/script.h#L220-L237

  33. def isValidPubKeyEncoding(pubKey: ECPublicKey, sigVersion: SignatureVersion, flags: Seq[ScriptFlag]): Option[ScriptError]

    Determines if the given pubkey is valid in accordance to the given ScriptFlags and SignatureVersion.

    Determines if the given pubkey is valid in accordance to the given ScriptFlags and SignatureVersion. Mimics this function inside of Bitcoin Core https://github.com/bitcoin/bitcoin/blob/528472111b4965b1a99c4bcf08ac5ec93d87f10f/src/script/interpreter.cpp#L214-L223

  34. lazy val logger: Logger
    Definition Classes
    BitcoinSLogger
  35. def minimalDummy(asm: Seq[ScriptToken]): Seq[ScriptToken]

    Replaces the OP_0 dummy for OP_CHECKMULTISIG with ScriptNumber.zero

  36. def minimalIfOp(asm: Seq[ScriptToken]): Seq[ScriptToken]

    Since witnesses are not run through the interpreter, replace OP_0/OP_1 with ScriptNumber.zero/ScriptNumber.one

  37. def minimalScriptNumberRepresentation(num: ScriptNumber): ScriptNumber
  38. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  39. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  40. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  41. def numPossibleSignaturesOnStack(program: ExecutionInProgressScriptProgram): ScriptNumber

    Parses the number of signatures on the stack This can only be called when an OP_CHECKMULTISIG operation is about to be executed on the stack For instance if this was a 2/3 multisignature script, it would return the number 3

  42. def numRequiredSignaturesOnStack(program: ExecutionInProgressScriptProgram): ScriptNumber

    Returns the number of required signatures on the stack, for instance if this was a 2/3 multisignature script, it would return the number 2

  43. def parseScript[T <: Script](bytes: ByteVector, f: (Vector[ScriptToken]) => T): T
  44. def removeOpCodeSeparator(program: ExecutionInProgressScriptProgram): Seq[ScriptToken]

    Removes the OP_CODESEPARATOR in the original script according to the last code separator index in the script.

  45. def removeSignatureFromScript(signature: ECDigitalSignature, script: Seq[ScriptToken]): Seq[ScriptToken]

    Removes the given ECDigitalSignature from the list of ScriptToken if it exists.

  46. def removeSignaturesFromScript(sigs: Seq[ECDigitalSignature], script: Seq[ScriptToken]): Seq[ScriptToken]

    Removes the list of ECDigitalSignature from the list of ScriptToken

  47. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  48. def toString(): String
    Definition Classes
    AnyRef → Any
  49. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  50. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  51. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from BitcoinSLogger

Inherited from AnyRef

Inherited from Any

Ungrouped