1

How to verify MetaMask account holder is the real owner of the address?

I recently saw this post and tried it immediately, unfortunately, I am not getting the right result from the server. I think it has something to do with the hashing algorithm sha3, but I am not sure. Could anyone please update the solution? Thank you!

1

I think this is what you are asking for...

Using Web3.js 1.0 and Metamask:

Create a signature for a message:

var message = "Some string"
var hash = web3.utils.sha3(message)
var accounts = await web3.eth.getAccounts()
var signature = await web3.eth.personal.sign(hash, accounts[0])

Recover the address for a message + signature:

var hash = web3.utils.sha3(message)
var signing_address = await web3.eth.personal.ecRecover(hash, signature)

You should see that signing_address will match accounts[0] if you are using the same message and signature across the board.

0

metamask and web3 injected for recover an ethereum account by message and sign

var hashCodificado = web3.fromUtf8("Autentificacion en Plataforma")

        web3.personal.ecRecover(hashCodificado, "0x9b2d3a06ff7da90b629b18eaa56e150da522fa77d550d06be14049ee808ca3aa471af025c1aa40e5e11e3b42a0e033935da7b934059c1e6bebbc4f6h4486d7b51b", function (error, result) {
                if (error) alert("Necesitas identificarte para poder entrar al panel de usuario");
                if (result) {
                    alert("La cuenta que ha firmado la transaccion es: " + result)
                }
            });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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