While recovering address from hash and sign, getting above error.

myHash = '0xd0109ef5f602b69354acd389a2c752f9b80ef6bbce92a922ae8853d43a027b68';

mySign = '0xebedaa7185fe2b0c4a6a6e3f1a833abd14eeb2f05f46931ec5c602e9f67a43af2071e9bcda9a1598dcc9e936ceea71d95d648f9c390c1ef6d58fd01012e2ab4e1c';

var getRecoveredAddress = function (myHash, mySign) 
    return new Promise(function (resolve, reject) {
        token.recover(myHash, mySign
            , (error, result) => {
                if (error) reject(error);

Please let me know what what's wrong with this code!! Thank you in advance!

  • How the signature was generated? What does token.recover works?
    – Ismael
    Commented Jan 1, 2019 at 5:03
  • myHash was returning an array object. myHash[0] solved the problem. Thanks!
    – Maddy1730
    Commented Jan 1, 2019 at 7:30
  • my ERC865 contract recovering the correct address after generating the sign using Metamask customized function web3.eth.sign() using this. But when I try normal web3.eth.accounts.sign() using this, I'm getting wrong address. I want to sign the hash using private key only!(I know, which is not acceptable!!)
    – Maddy1730
    Commented Jan 1, 2019 at 7:32
  • I have created contract referring this.
    – Maddy1730
    Commented Jan 1, 2019 at 7:44
  • @Ismael Please suggest the correct way to recover the address
    – Maddy1730
    Commented Jan 1, 2019 at 11:13

1 Answer 1


Try switching to different network in metamask, then switching back. Could be some cached state if you're using ganache and have restarted it.

I got that error message after restarting ganache, and metamask being connected to same server+port already before restart.

  • Sorry for late reply. Thanks.
    – Maddy1730
    Commented Jul 20, 2020 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.