[−][src]Trait miniscript::descriptor::DescriptorTrait
A general trait for Bitcoin descriptor. Offers function for witness cost estimation, script pubkey creation satisfaction using the Satisfier trait.
Required methods
fn sanity_check(&self) -> Result<(), Error>
[src]
Whether the descriptor is safe Checks whether all the spend paths in the descriptor are possible on the bitcoin network under the current standardness and consensus rules Also checks whether the descriptor requires signauture on all spend paths And whether the script is malleable. In general, all the guarantees of miniscript hold only for safe scripts. All the analysis guarantees of miniscript only hold safe scripts. The signer may not be able to find satisfactions even if one exists
fn address(&self, network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the Bitcoin address of the descriptor, if one exists Some descriptors like pk() don't have any address.
fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the scriptpubkey of the descriptor
fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the scriptSig that will be in place for an unsigned input spending an output with this descriptor. For pre-segwit descriptors, which use the scriptSig for signatures, this returns the empty script.
This is used in Segwit transactions to produce an unsigned transaction whose txid will not change during signing (since only the witness data will change).
fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the "witness script" of the descriptor, i.e. the underlying
script before any hashing is done. For Bare
, Pkh
and Wpkh
this
is the scriptPubkey; for ShWpkh
and Sh
this is the redeemScript;
for the others it is the witness script.
fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
Returns satisfying witness and scriptSig to spend an output controlled by the given descriptor if it possible to construct one using the satisfier S.
fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]
Computes an upper bound on the weight of a satisfying witness to the transaction. Assumes all signatures are 73 bytes, including push opcode and sighash suffix. Includes the weight of the VarInts encoding the scriptSig and witness stack length. Returns Error when the descriptor is impossible to safisfy (ex: sh(OP_FALSE))
fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Get the scriptCode
of a transaction output.
The scriptCode
is the Script of the previous transaction output being serialized in the
sighash when evaluating a CHECKSIG
& co. OP code.
Provided methods
fn satisfy<S>(&self, txin: &mut TxIn, satisfier: S) -> Result<(), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
Pk: ToPublicKey,
S: Satisfier<Pk>,
Attempts to produce a satisfying witness and scriptSig to spend an
output controlled by the given descriptor; add the data to a given
TxIn
output.
Implementors
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Descriptor<Pk>
[src]
fn sanity_check(&self) -> Result<(), Error>
[src]
Whether the descriptor is safe Checks whether all the spend paths in the descriptor are possible on the bitcoin network under the current standardness and consensus rules Also checks whether the descriptor requires signauture on all spend paths And whether the script is malleable. In general, all the guarantees of miniscript hold only for safe scripts. All the analysis guarantees of miniscript only hold safe scripts. The signer may not be able to find satisfactions even if one exists
fn address(&self, network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the Bitcoin address of the descriptor, if one exists
fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the scriptpubkey of the descriptor
fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the scriptSig that will be in place for an unsigned input spending an output with this descriptor. For pre-segwit descriptors, which use the scriptSig for signatures, this returns the empty script.
This is used in Segwit transactions to produce an unsigned transaction whose txid will not change during signing (since only the witness data will change).
fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Computes the "witness script" of the descriptor, i.e. the underlying
script before any hashing is done. For Bare
, Pkh
and Wpkh
this
is the scriptPubkey; for ShWpkh
and Sh
this is the redeemScript;
for the others it is the witness script.
fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
Returns satisfying witness and scriptSig to spend an output controlled by the given descriptor if it possible to construct one using the satisfier S.
fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]
Computes an upper bound on the weight of a satisfying witness to the transaction. Assumes all signatures are 73 bytes, including push opcode and sighash suffix. Includes the weight of the VarInts encoding the scriptSig and witness stack length.
fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
Get the scriptCode
of a transaction output.
The scriptCode
is the Script of the previous transaction output being serialized in the
sighash when evaluating a CHECKSIG
& co. OP code.
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Bare<Pk>
[src]
fn sanity_check(&self) -> Result<(), Error>
[src]
fn address(&self, _network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]
fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Pkh<Pk>
[src]
fn sanity_check(&self) -> Result<(), Error>
[src]
fn address(&self, network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]
fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Sh<Pk>
[src]
fn sanity_check(&self) -> Result<(), Error>
[src]
fn address(&self, network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]
fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Wpkh<Pk>
[src]
fn sanity_check(&self) -> Result<(), Error>
[src]
fn address(&self, network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]
fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
impl<Pk: MiniscriptKey> DescriptorTrait<Pk> for Wsh<Pk>
[src]
fn sanity_check(&self) -> Result<(), Error>
[src]
fn address(&self, network: Network) -> Result<Address, Error> where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn script_pubkey(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn unsigned_script_sig(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn explicit_script(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,
fn get_satisfaction<S>(
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
[src]
&self,
satisfier: S
) -> Result<(Vec<Vec<u8>>, Script), Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
fn max_satisfaction_weight(&self) -> Result<usize, Error>
[src]
fn script_code(&self) -> Script where
Pk: ToPublicKey,
[src]
Pk: ToPublicKey,