recoverPublicKey($msgHash, $signature); // Convert the public key to an Ethereum address $derivedAddress = $util->publicKeyToAddress($pubKey); // Compare the derived address with the given address return strtolower($address) === strtolower($derivedAddress); } // Fetch and decode the JSON POST request $data = json_decode(file_get_contents('php://input'), true); $account = $data['account']; $signature = $data['signature']; $message = $data['message']; $verified = verifySignature($account, $signature, $message); echo json_encode(['verified' => $verified]);