public override async Task <Script> CreateSigScript(Wallet wallet, Transaction transaction, TransactionInput input, SigHashType sigHashType) { var priorOutput = await Fetcher.FetchPriorOutput(input); if (priorOutput.ScriptPubKey.Commands.Count < 1 || !(priorOutput.ScriptPubKey.Commands[0] is byte[] sec)) { throw new FormatException("Unexpected opcode in output script"); } var privateKey = wallet.FindBy(PublicKey.FromSec(sec)); if (privateKey == null) { throw new PrivateKeyNotFoundException("Key not found in wallet"); } return(await CreateSigScript(privateKey, transaction, input, sigHashType)); }