Signing process
Whenapproval_mechanism is htlc, params_to_sign contains a Base64-encoded psbt and the list of inputs the user must sign.
- Parse the Base64-encoded PSBT.
- Load the user’s signing key.
- Iterate over the input indexes listed in
params_to_sign.inputs. - For each input, read the referenced UTXO data from the PSBT (amount, script, and Taproot data where applicable).
- Compute the signature hash and produce the witness signature: a Schnorr signature for Taproot (P2TR key-path) inputs, or an ECDSA signature for P2WPKH inputs.
- Insert the signatures into the corresponding inputs without modifying any other transaction data.
- Serialize the PSBT back to Base64 and submit it as the approval.
Example: sign with a browser wallet
Most Bitcoin wallets expose asignPsbt method that handles the cryptography. With Sats Connect, pass the PSBT and a map of the user’s address to the input indexes to sign:
Bitcoin is a source chain that requires
user_source_public_key when creating the intent.