public override Task <TransactionResponse> SendCoin(SendRequest request, ServerCallContext context) { // Create new transaction var newTrx = new Transaction( request.TransactionInput.SenderAddress, request.TransactionOutput.RecipientAddress, request.TransactionOutput.Amount, request.TransactionOutput.Fee) { Hash = request.TransactionId, TimeStamp = request.TransactionInput.TimeStamp }; // verify transaction ID var trxHash = TransactionHelpers.GetTransactionHash(newTrx); if (!trxHash.Equals(request.TransactionId)) { return(Task.FromResult(new TransactionResponse { Result = "Transaction ID not valid", })); } // Verify signature var isValid = TransactionHelpers.VerifySignature(request.PublicKey, request.TransactionId, request.TransactionInput.Signature); if (!isValid) { return(Task.FromResult(new TransactionResponse() { Result = "Signature not valid", })); } this.blockChain.AddTransaction(newTrx); return(Task.FromResult(new TransactionResponse() { Result = "Success", })); }