Message Signing issues

Hello community, we are seeking out help for signing a message.
The server is signing a message, but the smart contract is not able to get the address.

This is how we are signing the message
const { signMessage } = useWallet();

This is how we are digesting the message.

let messageBytes = ethers.toUtf8Bytes(message);
          let messageDigest = ethers.keccak256(messageBytes);

Solidity code

function recoverAddr(
        bytes32 msgHash,
        bytes memory signed
    ) internal pure returns (address) {
        bytes32 r;
        bytes32 s;
        uint8 v;
        assembly {
            r := mload(add(signed, 32))
            s := mload(add(signed, 64))
            v := and(mload(add(signed, 65)), 255)
        }
        if (v < 27) v += 27;

        return ecrecover(msgHash, v, r, s);
    }

Calculated address is not the same as the signer address, some random address.

3 Likes

@constantinpricope201 could be of help

2 Likes

Maybe @adeel can help out

2 Likes

@Gordian @Nweke-nature1.com Thanks, We have resolved the issue!

4 Likes

Good to know it has been resolved, all the best

2 Likes

Good :+1: to know it has been resolved but I know that there are top Bosses in thiz Platform.

1 Like