0

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);
                console.log(result)
                resolve(result);
            })
    });
};

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 Jan 1 at 5:03
  • myHash was returning an array object. myHash[0] solved the problem. Thanks! – Maddy1730 Jan 1 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 Jan 1 at 7:32
  • I have created contract referring this. – Maddy1730 Jan 1 at 7:44
  • @Ismael Please suggest the correct way to recover the address – Maddy1730 Jan 1 at 11:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.