jmwallet.wallet.psbt
jmwallet.wallet.psbt
Strict BIP174 PSBT v0 and BIP370 PSBT v2 parsing and record-preserving updates.
Attributes
LOCKTIME_THRESHOLD = 500000000
module-attribute
PSBT_GLOBAL_FALLBACK_LOCKTIME = 3
module-attribute
PSBT_GLOBAL_INPUT_COUNT = 4
module-attribute
PSBT_GLOBAL_OUTPUT_COUNT = 5
module-attribute
PSBT_GLOBAL_TX_MODIFIABLE = 6
module-attribute
PSBT_GLOBAL_TX_VERSION = 2
module-attribute
PSBT_GLOBAL_UNSIGNED_TX = 0
module-attribute
PSBT_GLOBAL_VERSION = 251
module-attribute
PSBT_GLOBAL_XPUB = 1
module-attribute
PSBT_IN_BIP32_DERIVATION = 6
module-attribute
PSBT_IN_FINAL_SCRIPTSIG = 7
module-attribute
PSBT_IN_FINAL_SCRIPTWITNESS = 8
module-attribute
PSBT_IN_NON_WITNESS_UTXO = 0
module-attribute
PSBT_IN_OUTPUT_INDEX = 15
module-attribute
PSBT_IN_PARTIAL_SIG = 2
module-attribute
PSBT_IN_PREVIOUS_TXID = 14
module-attribute
PSBT_IN_PROPRIETARY = 252
module-attribute
PSBT_IN_REDEEM_SCRIPT = 4
module-attribute
PSBT_IN_REQUIRED_HEIGHT_LOCKTIME = 18
module-attribute
PSBT_IN_REQUIRED_TIME_LOCKTIME = 17
module-attribute
PSBT_IN_SEQUENCE = 16
module-attribute
PSBT_IN_SIGHASH_TYPE = 3
module-attribute
PSBT_IN_WITNESS_SCRIPT = 5
module-attribute
PSBT_IN_WITNESS_UTXO = 1
module-attribute
PSBT_MAGIC = b'psbt\xff'
module-attribute
PSBT_OUT_AMOUNT = 3
module-attribute
PSBT_OUT_BIP32_DERIVATION = 2
module-attribute
PSBT_OUT_PROPRIETARY = 252
module-attribute
PSBT_OUT_REDEEM_SCRIPT = 0
module-attribute
PSBT_OUT_SCRIPT = 4
module-attribute
PSBT_OUT_WITNESS_SCRIPT = 1
module-attribute
PSBT_VERSION_0 = 0
module-attribute
PSBT_VERSION_2 = 2
module-attribute
SEQUENCE_FINAL = 4294967295
module-attribute
TX_MODIFIABLE_HAS_SIGHASH_SINGLE = 4
module-attribute
TX_MODIFIABLE_INPUTS = 1
module-attribute
TX_MODIFIABLE_OUTPUTS = 2
module-attribute
Classes
BIP32KeyOrigin
dataclass
A BIP32 public key and its master fingerprint and derivation path.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
137 138 139 140 141 142 143 | |
Attributes
fingerprint: bytes
instance-attribute
path: tuple[int, ...]
instance-attribute
pubkey: bytes
instance-attribute
PSBTError
Bases: ValueError
Raised when a PSBT violates BIP174 serialization requirements.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
91 92 | |
PSBTKeyValue
dataclass
An ordered raw PSBT key/value record.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
95 96 97 98 99 100 | |
Attributes
key: bytes
instance-attribute
value: bytes
instance-attribute
PSBTMap
dataclass
A PSBT map retaining record order and unknown records.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
Attributes
records: list[PSBTKeyValue] = field(default_factory=list)
class-attribute
instance-attribute
Methods:
append(key: bytes, value: bytes) -> None
Append a unique, nonempty raw record to this map.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
109 110 111 112 113 114 115 | |
serialize() -> bytes
Serialize this map with canonical CompactSize lengths.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
117 118 119 120 121 122 123 124 125 126 | |
ParsedPSBT
dataclass
A parsed BIP174 PSBT v0 or BIP370 PSBT v2, retaining all raw map records.
transaction is the unsigned transaction described by the PSBT: parsed from
PSBT_GLOBAL_UNSIGNED_TX for v0 and reconstructed from the BIP370 fields for
v2, with the locktime derived as BIP370 specifies. unsigned_tx is its
serialization; for v2 it is a reconstruction and is not part of the PSBT bytes.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
Attributes
global_map: PSBTMap
instance-attribute
input_maps: list[PSBTMap]
instance-attribute
output_maps: list[PSBTMap]
instance-attribute
transaction: ParsedTransaction
instance-attribute
unsigned_tx: bytes
instance-attribute
version: int = PSBT_VERSION_0
class-attribute
instance-attribute
Methods:
append_input_key_value(input_index: int, key: bytes, value: bytes) -> None
Append a valid unique record to an input map.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
173 174 175 176 177 178 179 180 181 182 183 184 185 | |
serialize() -> bytes
Serialize the PSBT while preserving all map record order.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
163 164 165 166 167 168 169 170 171 | |
WitnessUTXO
dataclass
The amount and scriptPubKey contained in a PSBT witness UTXO record.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
129 130 131 132 133 134 | |
Attributes
script_pubkey: bytes
instance-attribute
value: int
instance-attribute
Functions:
parse_bip32_derivation(key: bytes, value: bytes) -> BIP32KeyOrigin
Parse a BIP174 BIP32 derivation key/value pair.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
375 376 377 378 379 380 381 382 383 384 385 386 387 | |
parse_psbt(data: bytes) -> ParsedPSBT
Parse a strict, complete BIP174 PSBT v0 or BIP370 PSBT v2 binary payload.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
188 189 190 191 192 193 194 195 196 197 198 199 200 | |
parse_witness_utxo(value: bytes) -> WitnessUTXO
Parse a BIP174 witness UTXO value with exact consumption.
Source code in jmwallet/src/jmwallet/wallet/psbt.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |