pyrxd.script — Script types and evaluation¶
Script types, templates, and evaluation for Radiant transactions.
The public re-exports below are resolved lazily via PEP 562
__getattr__ so importing pyrxd.script.script (used by the
inspect tool’s Transaction parser) doesn’t transitively pull
pyrxd.script.type and through it pyrxd.keys → coincurve.
See pyrxd for the broader rationale on lazy public re-exports.
- class pyrxd.script.BareMultisig[source]¶
Bases:
ScriptTemplate
- class pyrxd.script.CsvKind[source]¶
Bases:
EnumRelative time-lock kind, per BIP-112.
- BLOCKS = 'blocks'¶
- TIME_512_SECONDS = 'time'¶
- class pyrxd.script.OpReturn[source]¶
Bases:
ScriptTemplate
- class pyrxd.script.P2PK[source]¶
Bases:
ScriptTemplate
- class pyrxd.script.P2PKH[source]¶
Bases:
ScriptTemplate
- class pyrxd.script.Script[source]¶
Bases:
object- classmethod from_chunks(chunks)[source]¶
- Parameters:
chunks (list[ScriptChunk])
- Return type:
- class pyrxd.script.ScriptChunk[source]¶
Bases:
objectA representation of a chunk of a script, which includes an opcode. For push operations, the associated data to push onto the stack is also included.
- class pyrxd.script.Unknown[source]¶
Bases:
ScriptTemplate
- pyrxd.script.build_csv_sequence(units, kind)[source]¶
Encode an
(units, kind)pair into the integer form CSV expects on the stack and in the spending input’snSequencefield.unitsis the BIP-112 unit count: blocks forCsvKind.BLOCKS, or 512-second intervals forCsvKind.TIME_512_SECONDS. Must be in the range[0, 65535](16 bits).
- pyrxd.script.build_p2pkh_with_cltv_script(owner_pkh, locktime)[source]¶
Build a P2PKH locking script gated by an absolute time-lock (CLTV).
The output is spendable only when the spending transaction’s
nLockTimeis at or afterlocktime.locktime < 500_000_000selects a block-height lock; values at or aboveLOCKTIME_THRESHOLDselect a Unix-time lock (seconds). The caller is responsible for choosing the right interpretation — both are accepted at the script level.Returns the raw locking-script bytes.
- pyrxd.script.build_p2pkh_with_csv_script(owner_pkh, sequence)[source]¶
Build a P2PKH locking script gated by a relative time-lock (CSV).
The output is spendable only after the BIP-112-encoded
sequencehas elapsed (measured from the funding-output’s confirmation). Usebuild_csv_sequence(units, kind)to constructsequencefrom a block count or a 512-second interval count.Callers must NOT pass a sequence with the disable bit (1 << 31) set — that value means “no relative lock” and would silently make the script trivially spendable.
Returns the raw locking-script bytes.