public byte[] ComputeSigHash(Transaction transaction, TransactionInput input, TransactionOutput priorOutput, SigHashType sigHashType) { if (sigHashType != SigHashType.All) { throw new NotImplementedException("Only supports SigHashType.All"); } var hashingScript = IsPayToScriptHash(input.SigScript, priorOutput.ScriptPubKey) ? DecodeRedeemScript((byte[])input.SigScript.Commands[^ 1]) :
void Write(TransactionOutput output) { Write(output.Amount, 8); Write(output.ScriptPubKey); }
public Transaction CloneWithReplacedOutput(TransactionOutput oldOutput, TransactionOutput newOutput) { var newOutputs = Outputs.Select(o => o == oldOutput ? newOutput : o); return(new(Version, Segwit, Inputs, newOutputs, LockTime, Testnet)); }