txhash = "0x4e5dbe378c6371a4131e90a0dcf42aab81328262dd39cce209aee97cbe1980da",
fromaddress = "0x57f7920c1e7381f3d46a7dba93edb06f191dbe22",
txsignature = "0x460e5ac282faf5347c14aef546011051d9d082b42c887babbd085d6654d0d44c5992a88b7a2180cd8fe534f2d87c827ae8df816ade1fb7de4e3cf6e8e132eec11c"
string TxHash = aaa.txhash.ToString();
string FromAddress = aaa.fromaddress.ToString();
string TxSignature = aaa.txsignature.ToString();
if (string.IsNullOrWhiteSpace(TxHash) || string.IsNullOrWhiteSpace(FromAddress) || string.IsNullOrWhiteSpace(TxSignature))
res = "Please provide all required transaction details.";
else if (!TxHash.StartsWith("0x") || TxHash.Length != 66)
res = "Invalid transaction hash format. Expected 66 characters with '0x'.";
else if (!FromAddress.StartsWith("0x") || FromAddress.Length != 42)
res = "Invalid address format. Expected 42 characters with '0x'.";
else if (!TxSignature.StartsWith("0x") || TxSignature.Length != 132)
res = "Invalid signature format. Expected 132 characters with '0x'.";
var message = "Verify TX: " + TxHash;
var messageSigner = new Nethereum.Signer.EthereumMessageSigner();
var recoveredAddress = messageSigner.EncodeUTF8AndEcRecover(message, TxSignature);
int comparisonResult = String.Compare(recoveredAddress, FromAddress, StringComparison.OrdinalIgnoreCase);
res = (comparisonResult == 0) ? "Transaction verified" : "Invalid signature";
res = "Verification failed due to system error: " + ex.Message;