Crate psbt

source ·
Expand description

PSBT bitcoin library, providing all PSBT functionality from bitcoin library, plus

  • constructor, supporting miniscript-based descriptors, input descriptors, all sighash types, spendings from P2C, S2C-tweaked inputs ([construct]);
  • advanced signer, supporting pre-segwit, bare and nested segwit v0, taproot key and path spendings, different forms of tweaks & commitments, all sighash types ([sign]);
  • commitment-related features: managing tapret-, P2C and S2C-related proprietary keys;
  • utility methods for fee computing, lexicographic reordering etc;
  • command-line utility for editing PSBT data (WIP).


Managing commitment-related proprietary keys inside PSBT.
Lexicographic sorting functions.
Raw PSBT key-value pairs.
PSBT serialization.


Proprietary keys (i.e. keys starting with 0xFC byte) with their internal structure according to BIP 174.
A Signature hash type for the corresponding input. As of taproot upgrade, the signature hash type can be either EcdsaSighashType or SchnorrSighashType but it is not possible to know directly which signature hash type the user is dealing with. Therefore, the user is responsible for converting to/from PsbtSighashType from/to the desired signature hash type they need.


Ways that a Partially Signed Transaction might fail.
Errors happening during fee computation
Errors happening when PSBT or other resolver information does not match the structure of bitcoin transaction
Error encountered during PSBT decoding from Base64 string.
Version of the PSBT (V0 stands for BIP174-defined version; V2 - for BIP370).
Errors during Psbt construction from an unsigned transaction data (see Psbt::with).
Errors during Input construction from an unsigned transaction input (see Input::new).


Proprietary key subtype for storing LNPBP4 information about each specific protocol.
Proprietary key subtype for PSBT inputs containing the applied tapret tweak information.
PSBT proprietary key prefix used for LNPBP4 commitment-related data.
Proprietary key subtype for storing LNPBP4 entropy constant.
Proprietary key subtype for storing LNPBP4 single commitment message under some protocol in global map.
Proprietary key subtype for storing LNPBP4 requirement for a minimal tree size.
Proprietary key subtype holding 32-byte commitment which will be put into tapreturn tweak.
Proprietary key subtype marking PSBT outputs which may host tapreturn commitment.
Proprietary key subtype holding merkle branch path to tapreturn tweak inside the taptree structure.
PSBT proprietary key prefix used for tapreturn commitment.