6

As the title suggests I would like to check whether a specific PSBT is associated with a specific descriptor, either manually or using bitcoin-cli or bdk-cli.

I'm more concerned about static validation, not whether or not the inputs can be signed by the individual keys.

Is there a way to do this?

1 Answer 1

1

To do this you’ll need to first make sure the PSBT has the necessary information required by the descriptor to potentially sign the transaction. Do this by using Bitcoin Core's command-line tools (bitcoin-cli)

[Note: The descriptor in Bitcoin specifies how the keys in a wallet are structured and provides the script needed to control the coins. Examples of descriptors include pkh, wpkh, and sh(wpkh). Each descriptor requires certain data to sign a transaction, such as public keys and redeem scripts].

  • First you need to decode the PSBT to discover what information the PSBT currently has, such as inputs, outputs, signatures or scripts.

    • Use the code: 
bitcoin-cli decodepsbt "your_psbt_here"


  • Use the getdescriptorinfo command to get more information about your descriptor, particularly to understand what scriptPubKey and the redeem scripts it generates:

    • use the code code:
 bitcoin-cli getdescriptorinfo "your_descriptor_here"

  • Next you’ll have to check the PSBT Inputs Against the Descriptor Outputs: For each input in the PSBT, check that the scriptPubKey and redeemScript match those expected by the descriptor. You would compare the hash of these scripts or the addresses derived from them, to make sure they align with what the descriptor can produce and sign for.

  • You need to fill in the missing data in PSBT, If the PSBT is missing any necessary information that the descriptor can provide (like redeemScripts or witnessScripts), you can use the utxoupdatepsbt command. This command tries to add missing information to the PSBT using the UTXO set known to the node:

    • use the code: 
bitcoin-cli utxoupdatepsbt "your_psbt_here

  • Validate Solvability: After ensuring all necessary information is present in the PSBT and matches with the descriptor capabilities, you can consider the PSBT as solvable by the descriptor. Each input should have corresponding necessary data to allow for signing.

  • You can now try to sign the PSBT using walletprocesspsbt (if your wallet supports the descriptor) in order to verify if it can actually produce valid signatures:

    • use the code:
 bitcoin-cli walletprocesspsbt "your_psbt_here"



If the above command successfully signs the PSBT, it confirms the PSBT is solvable by the descriptor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.