[SOLVED] Verifying a signedMessage

const verifyResult = await web3.eth.personal.ecRecover(signedMessage, signature)

moralis Error: Returned error: the method personal_ecRecover does not exist/is not available
at handleError (RESTController.js:437)

any help?

have you tried to use web3.eth.accounts.recover instead?

trying now… no error, but unexpected result so far

will report back

It seems that we need to tweak config in our nodes to make web3.eth.personal work, will get back.
For now - hopefully you can solve your issue without personal package.

working!
many thanks!
:pray: :muscle:

1 Like

Hey ivan, has there been progress on this matter?
I tried using web3.eth.personal.ecRecover on cloud functions and it doesn’t seem to work
this is what I get
Error: {“message”:“Invalid JSON RPC response: “Unauthorized””,“code”:141}

can you share a part of your code that you used?

hey cryptokid!
this is the code for signing:

const signed_message = await web3.eth.personal.sign(message, eth_address)

and this is the cloud function code for recovering:

const params = request.params
const message = params.message
const signed_message = params.signed_message
const web3 = Moralis.web3ByChain("0x1");
const recovered_eth_address = await web3.eth.personal.ecRecover(message, signed_message)
logger.info(recovered_eth_address)

the cloud function fails right on the web3.eth.personal.ecRecover line.
message and signed_message is logged correctly in cloud functtion too.

1 Like

working code:

const web3 = Moralis.web3ByChain("0x1");  
message = "";
signed_message = "0x";
const recovered_eth_address = await web3.eth.accounts.recover(message, signed_message);
logger.info(recovered_eth_address);
2 Likes

it worked! I guess it was web3 coding error than moralis error.
really appreciate your quick response and solution!
thanks cryptokid!

1 Like