src/tx.js
// specified output. This is the core business logic of the Bitcoin signer.
specified output. This is the core business logic of the Bitcoin signer.
specified output . This is the core business logic of the Bitcoin signer .
async function makeSignedTx(
  outpoint,
  inputPKH,
  inputValue, 
  outputValue, 
  outputPKH
) {
  const tx = wpkhToWpkhTx(outpoint, inputPKH, outputValue, outputPKH);
  const sighash = wpkhToWpkhSighashAll(outpoint, inputPKH, inputValue, outputValue, outputPKH);
  const rsvStr = await sigs.rawSign(sighash);
  const pubkey = sigs.recoverPubkey(sighash, rsvStr);
  const signature = sigs.rsvToDER(rsvStr);
  return appendWitness(tx, pubkey, signature);
}
async function makeSignedTx ( outpoint , inputPKH , inputValue , outputValue , outputPKH ) { const tx = wpkhToWpkhTx ( outpoint , inputPKH , outputValue , outputPKH ) ; const sighash = wpkhToWpkhSighashAll ( outpoint , inputPKH , inputValue , outputValue , outputPKH ) ; const rsvStr = await sigs . rawSign ( sighash ) ; const pubkey = sigs . recoverPubkey ( sighash , rsvStr ) ; const signature = sigs . rsvToDER ( rsvStr ) ; return appendWitness ( tx , pubkey , signature ) ; }
specified output.
specified output .
// 8-byte LE // 8-byte LE // Make a transaction // Calculate its sighash // Get an RSV signture on that sighash // Recover the public key from the signature // Translate the signature to DER-encoding for use in Bitcoin // Append the signature to the transaction.