pub struct Psbt {
pub unsigned_tx: Transaction,
pub version: u32,
pub xpub: BTreeMap<ExtendedPubKey, (Fingerprint, DerivationPath)>,
pub proprietary: BTreeMap<ProprietaryKey<u8>, Vec<u8, Global>>,
pub unknown: BTreeMap<Key, Vec<u8, Global>>,
pub inputs: Vec<Input, Global>,
pub outputs: Vec<Output, Global>,
}
Expand description
A Partially Signed Transaction.
Fields
unsigned_tx: Transaction
The unsigned transaction, scriptSigs and witnesses for each input must be empty.
version: u32
The version number of this PSBT. If omitted, the version number is 0.
xpub: BTreeMap<ExtendedPubKey, (Fingerprint, DerivationPath)>
A global map from extended public keys to the used key fingerprint and derivation path as defined by BIP 32
proprietary: BTreeMap<ProprietaryKey<u8>, Vec<u8, Global>>
Global proprietary key-value pairs.
unknown: BTreeMap<Key, Vec<u8, Global>>
Unknown global key-value pairs.
inputs: Vec<Input, Global>
The corresponding key-value map for each input in the unsigned transaction.
outputs: Vec<Output, Global>
The corresponding key-value map for each output in the unsigned transaction.
Implementations
sourceimpl PartiallySignedTransaction
impl PartiallySignedTransaction
sourcepub fn from_unsigned_tx(
tx: Transaction
) -> Result<PartiallySignedTransaction, Error>
pub fn from_unsigned_tx(
tx: Transaction
) -> Result<PartiallySignedTransaction, Error>
Create a PartiallySignedTransaction from an unsigned transaction, error if not unsigned
sourcepub fn extract_tx(self) -> Transaction
pub fn extract_tx(self) -> Transaction
Extract the Transaction from a PartiallySignedTransaction by filling in the available signature information in place.
sourcepub fn combine(
&mut self,
other: PartiallySignedTransaction
) -> Result<(), Error>
pub fn combine(
&mut self,
other: PartiallySignedTransaction
) -> Result<(), Error>
Combines this PartiallySignedTransaction
with other
PSBT as described by BIP 174.
In accordance with BIP 174 this function is commutative i.e., A.combine(B) == B.combine(A)
Trait Implementations
sourceimpl Clone for PartiallySignedTransaction
impl Clone for PartiallySignedTransaction
sourcefn clone(&self) -> PartiallySignedTransaction
fn clone(&self) -> PartiallySignedTransaction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Construct for Psbt
impl Construct for Psbt
fn construct<C: Verification>(
secp: &Secp256k1<C>,
descriptor: &Descriptor<TrackingAccount>,
lock_time: LockTime,
inputs: &[InputDescriptor],
outputs: &[(PubkeyScript, u64)],
change_index: UnhardenedIndex,
fee: u64,
tx_resolver: &impl ResolveTx
) -> Result<Psbt, Error>
sourceimpl Debug for PartiallySignedTransaction
impl Debug for PartiallySignedTransaction
sourceimpl Decodable for PartiallySignedTransaction
impl Decodable for PartiallySignedTransaction
sourcefn consensus_decode<D>(d: D) -> Result<PartiallySignedTransaction, Error> where
D: Read,
fn consensus_decode<D>(d: D) -> Result<PartiallySignedTransaction, Error> where
D: Read,
Decode an object with a well-defined format
sourceimpl Display for PartiallySignedTransaction
impl Display for PartiallySignedTransaction
sourceimpl FromStr for PartiallySignedTransaction
impl FromStr for PartiallySignedTransaction
type Err = PsbtParseError
type Err = PsbtParseError
The associated error which can be returned from parsing.
sourcefn from_str(
s: &str
) -> Result<PartiallySignedTransaction, <PartiallySignedTransaction as FromStr>::Err>
fn from_str(
s: &str
) -> Result<PartiallySignedTransaction, <PartiallySignedTransaction as FromStr>::Err>
Parses a string s
to return a value of this type. Read more
sourceimpl LexOrder for Psbt
impl LexOrder for Psbt
fn lex_order(&mut self)
fn lex_ordered(self) -> Self where
Self: Sized,
sourceimpl PartialEq<PartiallySignedTransaction> for PartiallySignedTransaction
impl PartialEq<PartiallySignedTransaction> for PartiallySignedTransaction
sourcefn eq(&self, other: &PartiallySignedTransaction) -> bool
fn eq(&self, other: &PartiallySignedTransaction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PartiallySignedTransaction) -> bool
fn ne(&self, other: &PartiallySignedTransaction) -> bool
This method tests for !=
.
sourceimpl PsbtExt for PartiallySignedTransaction
impl PsbtExt for PartiallySignedTransaction
sourcefn finalize_mut<C>(
&mut self,
secp: &Secp256k1<C>
) -> Result<(), Vec<Error, Global>> where
C: Verification,
fn finalize_mut<C>(
&mut self,
secp: &Secp256k1<C>
) -> Result<(), Vec<Error, Global>> where
C: Verification,
Finalize the psbt. This function takes in a mutable reference to psbt and populates the final_witness and final_scriptsig for all miniscript inputs. Read more
sourcefn finalize<C>(
self,
secp: &Secp256k1<C>
) -> Result<PartiallySignedTransaction, (PartiallySignedTransaction, Vec<Error, Global>)> where
C: Verification,
fn finalize<C>(
self,
secp: &Secp256k1<C>
) -> Result<PartiallySignedTransaction, (PartiallySignedTransaction, Vec<Error, Global>)> where
C: Verification,
Same as PsbtExt::finalize_mut
, but does not mutate the input psbt and
returns a new psbt Read more
sourcefn finalize_mall_mut<C>(
&mut self,
secp: &Secp256k1<C>
) -> Result<(), Vec<Error, Global>> where
C: Verification,
fn finalize_mall_mut<C>(
&mut self,
secp: &Secp256k1<C>
) -> Result<(), Vec<Error, Global>> where
C: Verification,
Same as PsbtExt::finalize_mut, but allows for malleable satisfactions
sourcefn finalize_mall<C>(
self,
secp: &Secp256k1<C>
) -> Result<PartiallySignedTransaction, (PartiallySignedTransaction, Vec<Error, Global>)> where
C: Verification,
fn finalize_mall<C>(
self,
secp: &Secp256k1<C>
) -> Result<PartiallySignedTransaction, (PartiallySignedTransaction, Vec<Error, Global>)> where
C: Verification,
Same as PsbtExt::finalize, but allows for malleable satisfactions
sourcefn finalize_inp_mut<C>(
&mut self,
secp: &Secp256k1<C>,
index: usize
) -> Result<(), Error> where
C: Verification,
fn finalize_inp_mut<C>(
&mut self,
secp: &Secp256k1<C>,
index: usize
) -> Result<(), Error> where
C: Verification,
Same as PsbtExt::finalize_mut
, but only tries to finalize a single input leaving other
inputs as is. Use this when not all of inputs that you are trying to
satisfy are miniscripts Read more
sourcefn finalize_inp<C>(
self,
secp: &Secp256k1<C>,
index: usize
) -> Result<PartiallySignedTransaction, (PartiallySignedTransaction, Error)> where
C: Verification,
fn finalize_inp<C>(
self,
secp: &Secp256k1<C>,
index: usize
) -> Result<PartiallySignedTransaction, (PartiallySignedTransaction, Error)> where
C: Verification,
Same as PsbtExt::finalize_inp_mut
, but does not mutate the psbt and returns a new one Read more
sourcefn finalize_inp_mall_mut<C>(
&mut self,
secp: &Secp256k1<C>,
index: usize
) -> Result<(), Error> where
C: Verification,
fn finalize_inp_mall_mut<C>(
&mut self,
secp: &Secp256k1<C>,
index: usize
) -> Result<(), Error> where
C: Verification,
Same as PsbtExt::finalize_inp_mut
, but allows for malleable satisfactions
sourcefn finalize_inp_mall<C>(
self,
secp: &Secp256k1<C>,
index: usize
) -> Result<PartiallySignedTransaction, (PartiallySignedTransaction, Error)> where
C: Verification,
fn finalize_inp_mall<C>(
self,
secp: &Secp256k1<C>,
index: usize
) -> Result<PartiallySignedTransaction, (PartiallySignedTransaction, Error)> where
C: Verification,
Same as PsbtExt::finalize_inp
, but allows for malleable satisfactions
sourcefn extract<C>(&self, secp: &Secp256k1<C>) -> Result<Transaction, Error> where
C: Verification,
fn extract<C>(&self, secp: &Secp256k1<C>) -> Result<Transaction, Error> where
C: Verification,
Psbt extractor as defined in BIP174 that takes in a psbt reference and outputs a extracted bitcoin::Transaction Also does the interpreter sanity check Will error if the final ScriptSig or final Witness are missing or the interpreter check fails. Read more
sourcefn update_desc(
&mut self,
input_index: usize,
desc: &Descriptor<DescriptorPublicKey>,
range: Option<Range<u32>>
) -> Result<(), UxtoUpdateError>
fn update_desc(
&mut self,
input_index: usize,
desc: &Descriptor<DescriptorPublicKey>,
range: Option<Range<u32>>
) -> Result<(), UxtoUpdateError>
Update an psbt with the derived descriptor information. If the descriptor is Read more
sourcefn sighash_msg<T>(
&self,
idx: usize,
cache: &mut SighashCache<T>,
tapleaf_hash: Option<TapLeafHash>
) -> Result<PsbtSighashMsg, SighashError> where
T: Deref<Target = Transaction>,
fn sighash_msg<T>(
&self,
idx: usize,
cache: &mut SighashCache<T>,
tapleaf_hash: Option<TapLeafHash>
) -> Result<PsbtSighashMsg, SighashError> where
T: Deref<Target = Transaction>,
Get the sighash message(data to sign) at input index idx
based on the sighash
flag specified in the Psbt
sighash field. If the input sighash flag psbt field is None
the SchnorrSighashType::Default
is chosen
for for taproot spends, otherwise EcdsaSignatureHashType::All
is chosen.
If the utxo at idx
is a taproot output, returns a PsbtSighashMsg::TapSighash
variant.
If the utxo at idx
is a pre-taproot output, returns a PsbtSighashMsg::EcdsaSighash
variant.
The tapleaf_hash
parameter can be used to specify which tapleaf script hash has to be computed. If
tapleaf_hash
is None
, and the output is taproot output, the key spend hash is computed. This parameter must be
set to None
while computing sighash for pre-taproot outputs.
The function also updates the sighash cache with transaction computed during sighash computation of this input Read more
sourceimpl SignAll for Psbt
impl SignAll for Psbt
sourcefn sign_all<C: Signing + Verification>(
&mut self,
provider: &impl SecretProvider<C>
) -> Result<usize, SignError>
fn sign_all<C: Signing + Verification>(
&mut self,
provider: &impl SecretProvider<C>
) -> Result<usize, SignError>
Signs all PSBT inputs using all known keys provided by
SecretProvider
. This includes signing legacy, segwit and taproot
inputs; including inputs coming from P2PK, P2PKH, P2WPKH,
P2WPKH-in-P2SH, bare scripts, P2SH, P2WSH, P2WSH-in-P2SH and P2TR
outputs with both key- and script- spending paths. Supports all
consensus sighash types. Read more
sourceimpl Tx for Psbt
impl Tx for Psbt
sourcefn to_transaction(&self) -> Transaction
fn to_transaction(&self) -> Transaction
Returns transaction with empty scriptSig
and witness
impl Eq for PartiallySignedTransaction
impl StructuralEq for PartiallySignedTransaction
impl StructuralPartialEq for PartiallySignedTransaction
Auto Trait Implementations
impl RefUnwindSafe for PartiallySignedTransaction
impl Send for PartiallySignedTransaction
impl Sync for PartiallySignedTransaction
impl Unpin for PartiallySignedTransaction
impl UnwindSafe for PartiallySignedTransaction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more