Skip to content

prepareTransactionForSigning

The prepareTransactionForSigning method prepares a Bitcoin transaction for MPC signing by creating a PSBT (Partially Signed Bitcoin Transaction) and computing the hash that needs to be signed.

Usage

const { transaction, hashesToSign } =
  await btcChain.prepareTransactionForSigning({
    from: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
    to: 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4',
    value: '0.001', // 0.001 BTC
    publicKey: '0235a3...',
  })

Parameters

ParameterTypeDescription
transactionRequestBTCTransactionRequestThe transaction request object containing from, to, value, publicKey, and optional feeRate and utxos

Returns

PropertyTypeDescription
transactionBTCUnsignedTransactionObject containing the unsigned PSBT
hashesToSignstring[]Array of hashes that need to be signed