BitcoinScript

Bitcoin script manipulating functions

Constructors

Link copied to clipboard
open fun BitcoinScript()
Creates an empty script.
Link copied to clipboard
open fun BitcoinScript(data: Array<Byte>)
Creates a script from a raw data representation.
Link copied to clipboard
open fun BitcoinScript(script: BitcoinScript)
Creates a script from a raw bytes and size.

Functions

Link copied to clipboard
open fun buildBRC20InscribeTransfer(ticker: String, amount: String, pubkey: Array<Byte>): Array<Byte>
Builds the Ordinals inscripton for BRC20 transfer.
Link copied to clipboard
open fun buildOrdinalNftInscription(mimeType: String, payload: Array<Byte>, pubkey: Array<Byte>): Array<Byte>
Builds the Ordinals inscripton for NFT construction.
Link copied to clipboard
Builds a standard 'pay to public key' script.
Link copied to clipboard
Builds a standard 'pay to public key hash' script.
Link copied to clipboard
Builds a standard 'pay to script hash' script.
Link copied to clipboard
Builds a pay-to-witness-public-key-hash (P2WPKH) script..
Link copied to clipboard
Builds a pay-to-witness-script-hash (P2WSH) script.
Link copied to clipboard
open fun data(): Array<Byte>
Get data of a script
Link copied to clipboard
open fun encode(): Array<Byte>
Encodes the script.
Link copied to clipboard
Determines whether 2 scripts have the same content
Link copied to clipboard
open fun hashTypeForCoin(coinType: CoinType): Int
Return the default HashType for the given coin, such as TWBitcoinSigHashTypeAll.
Link copied to clipboard
Determines whether this is a pay-to-script-hash (P2SH) script.
Link copied to clipboard
Determines whether this is a pay-to-witness-public-key-hash (P2WPKH) script.
Link copied to clipboard
Determines whether this is a pay-to-witness-script-hash (P2WSH) script.
Link copied to clipboard
Determines whether this is a witness program script.
Link copied to clipboard
open fun lockScriptForAddress(address: String, coin: CoinType): BitcoinScript
Builds a appropriate lock script for the given address..
Link copied to clipboard
open fun lockScriptForAddressReplay(address: String, coin: CoinType, blockHash: Array<Byte>, blockHeight: Long): BitcoinScript
Builds a appropriate lock script for the given address with replay.
Link copied to clipboard
Matches the script to a pay-to-public-key (P2PK) script.
Link copied to clipboard
Matches the script to a pay-to-public-key-hash (P2PKH).
Link copied to clipboard
Matches the script to a pay-to-script-hash (P2SH).
Link copied to clipboard
Matches the script to a pay-to-witness-public-key-hash (P2WPKH).
Link copied to clipboard
Matches the script to a pay-to-witness-script-hash (P2WSH).
Link copied to clipboard
open fun scriptHash(): Array<Byte>
Return script hash of a script
Link copied to clipboard
open fun size(): Int
Get size of a script