Skip to main content
PSBT cosigning lets the user authorize a Bitcoin HTLC deposit by signing only the inputs they control. The protocol builds the transaction; the user signs it locally and preserves any existing partial signatures. The signed PSBT is returned as the approval, keeping funds secure until the resolver executes the swap under the authorized parameters.

Signing process

When approval_mechanism is htlc, params_to_sign contains a Base64-encoded psbt and the list of inputs the user must sign.
  1. Parse the Base64-encoded PSBT.
  2. Load the user’s signing key.
  3. Iterate over the input indexes listed in params_to_sign.inputs.
  4. For each input, read the referenced UTXO data from the PSBT (amount, script, and Taproot data where applicable).
  5. 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.
  6. Insert the signatures into the corresponding inputs without modifying any other transaction data.
  7. Serialize the PSBT back to Base64 and submit it as the approval.
Sign only the indexes in params_to_sign.inputs, and do not broadcast the transaction. The resolver broadcasts the deposit after the approval is accepted.

Example: sign with a browser wallet

Most Bitcoin wallets expose a signPsbt 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:
Then submit the signed PSBT from your backend, where the API key lives:
Bitcoin is a source chain that requires user_source_public_key when creating the intent.