(sigil bitcoin script)
(sigil bitcoin script) — Bitcoin script byte constructors
Exports
script-emptyvariableEmpty script bytevector.
script-chunkprocedureParsed script chunk. data is a bytevector for push operations and #f for non-push opcodes.
script-chunk?procedureTest if a value is a script-chunk struct.
script-chunk-opcodeprocedureGet the opcode field of a script-chunk struct.
script-chunk-dataprocedureGet the data field of a script-chunk struct.
script-opprocedureReturn a one-byte script containing the given opcode.
script-appendprocedureConcatenate script bytevector fragments.
script-push-dataprocedureEncode a minimally-sized pushdata operation for a bytevector.
script-witness-programprocedureBuild a native witness program scriptPubKey.
Version 0 is encoded as OP0. Versions 1 through 16 use OP1 through OP_16 followed by the witness program push.
script-p2pkhprocedureBuild a standard P2PKH scriptPubKey from a 20-byte public key hash.
script-p2shprocedureBuild a standard P2SH scriptPubKey from a 20-byte script hash.
script-p2wpkhprocedureBuild a native P2WPKH scriptPubKey from a 20-byte public key hash.
script-p2wshprocedureBuild a native P2WSH scriptPubKey from a 32-byte witness script hash.
script-p2trprocedureBuild a native P2TR scriptPubKey from a 32-byte x-only public key.
script-parseprocedureParse raw script bytes into opcode/data chunks.
Raises an error for truncated pushdata encodings.
script-number-encodeprocedureEncode an integer using Bitcoin Script's little-endian signed-magnitude number format.
script-number-decodeprocedureDecode a Bitcoin Script little-endian signed-magnitude number.
script->asmprocedureDecompile raw script bytes to a simple Bitcoin Core-style ASM string.
script-decompileprocedureAlias for callers that use decompiler terminology.
script-witness-program-decodeprocedureDecode a native witness program scriptPubKey.
Returns (version program) for a valid witness program shape, otherwise #f. This validates only the script shape and witness program length; address-level Bech32 checksum rules live in (sigil bitcoin encoding).
script-classifyprocedureClassify a standard scriptPubKey.
Returns one of p2pkh, p2sh, p2wpkh, p2wsh, p2tr, or unknown.
script-standard-payloadprocedureExtract the standard payload from a recognized scriptPubKey.
For P2PKH/P2SH this is the 20-byte hash. For witness outputs this is the witness program. Returns #f for unknown scripts.
op-0variable(No description)
op-pushdata1variable(No description)
op-pushdata2variable(No description)
op-pushdata4variable(No description)
op-1variable(No description)
op-2variable(No description)
op-3variable(No description)
op-4variable(No description)
op-5variable(No description)
op-6variable(No description)
op-7variable(No description)
op-8variable(No description)
op-9variable(No description)
op-10variable(No description)
op-11variable(No description)
op-12variable(No description)
op-13variable(No description)
op-14variable(No description)
op-15variable(No description)
op-16variable(No description)
op-ifvariable(No description)
op-notifvariable(No description)
op-elsevariable(No description)
op-endifvariable(No description)
op-verifyvariable(No description)
op-ifdupvariable(No description)
op-dupvariable(No description)
op-sizevariable(No description)
op-ripemd160variable(No description)
op-sha256variable(No description)
op-hash160variable(No description)
op-hash256variable(No description)
op-equalvariable(No description)
op-equalverifyvariable(No description)
op-swapvariable(No description)
op-addvariable(No description)
op-boolandvariable(No description)
op-boolorvariable(No description)
op-numequalvariable(No description)
op-checksigvariable(No description)
op-checksigverifyvariable(No description)
op-checkmultisigvariable(No description)
op-checkmultisigverifyvariable(No description)
op-checksigaddvariable(No description)
op-checklocktimeverifyvariable(No description)
op-checksequenceverifyvariable(No description)