trait BitcoinScriptUtil extends AnyRef
Created by chris on 3/2/16.
- Alphabetic
- By Inheritance
- BitcoinScriptUtil
- 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 asmToBytes(asm: Seq[ScriptToken]): ByteVector
Converts a sequence of script tokens to them to their byte values
- def asmToHex(asm: Seq[ScriptToken]): String
Takes in a sequence of script tokens and converts them to their hexadecimal value
- def calculatePushOp(bytes: ByteVector): Seq[ScriptToken]
- def calculatePushOp(scriptToken: ScriptToken): Seq[ScriptToken]
Calculates the push operation for the given ScriptToken
- 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.
- def calculateScriptForSigning(spendingTransaction: Transaction, signingInfo: InputSigningInfo[InputInfo], asm: Seq[ScriptToken]): Seq[ScriptToken]
- def calculateScriptForSigning(txSignatureComponent: TxSigComponent, script: Seq[ScriptToken]): Seq[ScriptToken]
- 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)
- def checkPubKeyEncoding(key: ECPublicKeyBytes, flags: Seq[ScriptFlag]): Boolean
- 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.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def countOpCodes(opcodes: Vector[ScriptToken]): Int
- 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
- 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
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filterOpCodes(tokens: Vector[ScriptToken]): Vector[ScriptToken]
- 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
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getDataTokens(asm: Seq[ScriptToken]): Seq[ScriptToken]
Returns only the data ScriptTokens in a script that are pushed onto the stack
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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
- def isCompressedPubKey(key: ECPublicKeyBytes): Boolean
Checks if the given public key is a compressed public key
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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
- def isMinimalToken(token: ScriptToken): Boolean
Checks if the token is minimially encoded
- def isOnlyCompressedPubKey(spk: ScriptPubKey): Boolean
Checks that all the ECPublicKey in this script is compressed public keys, this is required for BIP143
- def isPushOnly(script: Seq[ScriptToken]): Boolean
Determines if a script contains only script operations This is equivalent to Bitcoin Core script.cpp#L213
- 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
- def isShortestEncoding(bytes: ByteVector): Boolean
- 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
- 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
- def minimalDummy(asm: Seq[ScriptToken]): Seq[ScriptToken]
Replaces the OP_0 dummy for OP_CHECKMULTISIG with ScriptNumber.zero
- def minimalIfOp(asm: Seq[ScriptToken]): Seq[ScriptToken]
Since witnesses are not run through the interpreter, replace
OP_0
/OP_1
withScriptNumber.zero
/ScriptNumber.one
- def minimalScriptNumberRepresentation(num: ScriptNumber): ScriptNumber
- 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()
- 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
- 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
- def parseScript[T <: Script](bytes: ByteVector, f: (Vector[ScriptToken]) => T): T
- def removeOpCodeSeparator(program: ExecutionInProgressScriptProgram): Seq[ScriptToken]
Removes the OP_CODESEPARATOR in the original script according to the last code separator index in the script.
- def removeSignatureFromScript(signature: ECDigitalSignature, script: Seq[ScriptToken]): Seq[ScriptToken]
Removes the given ECDigitalSignature from the list of ScriptToken if it exists.
- def removeSignaturesFromScript(sigs: Seq[ECDigitalSignature], script: Seq[ScriptToken]): Seq[ScriptToken]
Removes the list of ECDigitalSignature from the list of ScriptToken
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def verifyPSBTInputScript(tx: Transaction, inputMap: InputPSBTMap, index: Int, outputMap: PreviousOutputMap, flags: Seq[ScriptFlag] = Policy.standardFlags): Try[Transaction]
- def verifyScript(tx: Transaction, utxos: Seq[ScriptSignatureParams[InputInfo]]): Boolean
- 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()