trait BitcoinScriptUtil extends AnyRef

Created by chris on 3/2/16.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BitcoinScriptUtil
  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 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(spendingTransaction: Transaction, signingInfo: InputSigningInfo[InputInfo], script: Seq[ScriptToken]): Seq[ScriptToken]
  11. def calculateScriptForSigning(txSignatureComponent: TxSigComponent, script: Seq[ScriptToken]): Seq[ScriptToken]
  12. 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)

  13. def checkPubKeyEncoding(key: ECPublicKeyBytes, flags: Seq[ScriptFlag]): Boolean
  14. def checkPubKeyEncoding(key: ECPublicKeyBytes, 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.

  15. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  16. def countOpCodes(opcodes: Vector[ScriptToken]): Int
  17. 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

  18. 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

  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  21. def filterOpCodes(tokens: Vector[ScriptToken]): Vector[ScriptToken]
  22. 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

  23. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def getDataTokens(asm: Seq[ScriptToken]): Seq[ScriptToken]

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

  26. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  27. def isCompressedOrUncompressedPubKey(key: ECPublicKeyBytes): 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

  28. def isCompressedPubKey(key: ECPublicKeyBytes): Boolean

    Checks if the given public key is a compressed public key

  29. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  30. 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

  31. def isMinimalToken(token: ScriptToken): Boolean

    Checks if the token is minimially encoded

  32. def isOnlyCompressedPubKey(spk: ScriptPubKey): Boolean

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

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

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

  34. 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

  35. def isShortestEncoding(bytes: ByteVector): Boolean
  36. 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

  37. def isValidPubKeyEncoding(pubKey: ECPublicKeyBytes, 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

  38. def minimalDummy(asm: Seq[ScriptToken]): Seq[ScriptToken]

    Replaces the OP_0 dummy for OP_CHECKMULTISIG with ScriptNumber.zero

  39. 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

  40. def minimalScriptNumberRepresentation(num: ScriptNumber): ScriptNumber
  41. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  42. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  43. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  44. 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

  45. 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

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

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

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

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

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

    Removes the list of ECDigitalSignature from the list of ScriptToken

  50. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  51. def toString(): String
    Definition Classes
    AnyRef → Any
  52. def verifyPSBTInputScript(tx: Transaction, inputMap: InputPSBTMap, index: Int, outputMap: PreviousOutputMap, flags: Seq[ScriptFlag] = Policy.standardFlags): Try[Transaction]
  53. def verifyScript(tx: Transaction, utxos: Seq[ScriptSignatureParams[InputInfo]]): Boolean
  54. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  55. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  56. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped