src/btc/utils.js
function hashForRedeemSig(network, txid, address, value, redeemScript) {
  const tx = btcUtil.buildIncompleteRedeem(network, txid, address, value);
  const sigHash = tx.hashForSignature(
    0,
    new Buffer.from(redeemScript, 'hex'),
    bitcoin.Transaction.SIGHASH_ALL
  );

  return sigHash.toString('hex');
}
function hashForRedeemSig(network, txid, address, value, redeemScript) {
  const tx = btcUtil.buildIncompleteRedeem(network, txid, address, value);
  const sigHash = tx.hashForSignature(
    0,
    new Buffer.from(redeemScript, 'hex'),
    bitcoin.Transaction.SIGHASH_ALL
  );

  return sigHash.toString('hex');
}
function hashForRedeemSig ( network , txid , address , value , redeemScript ) { const tx = btcUtil . buildIncompleteRedeem ( network , txid , address , value ) ; const sigHash = tx . hashForSignature ( 0 , new Buffer . from ( redeemScript , 'hex' ) , bitcoin . Transaction . SIGHASH_ALL ) ; return sigHash . toString ( 'hex' ) ; }
Get the hash to be signed for a redeem transaction
@param {string} network - Network name (mainnet, testnet)
@param {string} txid - The txid for the UTXO being spent
@param {string} address - The address to receive funds
@param {string|number} value - The amount of funds to be sent (in Satoshis)
@param {string} redeemScript - The redeemScript of the P2SH address
@returns {string} Hash to be signed
Get the hash to be signed for a redeem transaction