sigildocs

(sigil bitcoin script)

(sigil bitcoin script) — Bitcoin script byte constructors

Exports

script-emptyvariable

Empty script bytevector.

script-chunkprocedure

Parsed script chunk. data is a bytevector for push operations and #f for non-push opcodes.

script-chunk?procedure

Test if a value is a script-chunk struct.

Get the opcode field of a script-chunk struct.

Get the data field of a script-chunk struct.

script-opprocedure

Return a one-byte script containing the given opcode.

script-appendprocedure

Concatenate script bytevector fragments.

Encode a minimally-sized pushdata operation for a bytevector.

Build 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-p2pkhprocedure

Build a standard P2PKH scriptPubKey from a 20-byte public key hash.

script-p2shprocedure

Build a standard P2SH scriptPubKey from a 20-byte script hash.

script-p2wpkhprocedure

Build a native P2WPKH scriptPubKey from a 20-byte public key hash.

script-p2wshprocedure

Build a native P2WSH scriptPubKey from a 32-byte witness script hash.

script-p2trprocedure

Build a native P2TR scriptPubKey from a 32-byte x-only public key.

script-parseprocedure

Parse raw script bytes into opcode/data chunks.

Raises an error for truncated pushdata encodings.

Encode an integer using Bitcoin Script's little-endian signed-magnitude number format.

Decode a Bitcoin Script little-endian signed-magnitude number.

script->asmprocedure

Decompile raw script bytes to a simple Bitcoin Core-style ASM string.

Alias for callers that use decompiler terminology.

Decode 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).

Classify a standard scriptPubKey.

Returns one of p2pkh, p2sh, p2wpkh, p2wsh, p2tr, or unknown.

Extract 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)

(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)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)