1

I did some web3.js projects and also worked with MetaMask. But I've never seen this window popping up in MetaMask - as it does when signing up for cryptokitties.

Confirm Transaction
Sign Message

MESSAGE
Cryptokitties

What does this mean? Why is this pop up? What permissions do I grant?

Screenshot here: https://i2.wp.com/blockchaindk.com/wp-content/uploads/2017/12/Cryptokitties-Sign-Message.png?w=346&ssl=1

source: https://blockchaindk.com/2017/12/05/buy-cryptokitty-cryptokitties/

1

In most cases, we don't need to sign to send transactions between the site(contract) and me.

But what the sign does is that site makes sure the user is real and he has ether(metamask in this case) account. To sign, we usually need email, username.

  • We can register the user to the site with just email and username and whenever we need to transfer ether from or to the user, we trigger metamask provided web3.sendTransaction function(which will trigger metamask transfer dialog).
  • But before we register user with just email and username, we verify if the user has actual account. If the web3.personal.sign succeeds, it means the user has the account and it's real, then we can continue to register the user to our site.

we stands for the site managers, admins. Basically, it's triggered by

var signer = web3.eth.defaultAccount || web3.eth.accounts[0];
var original_message = "I am but a stack exchange post";
var message = "0x" + original_message.toHex();
var message_hash = web3.sha3('\u0019Ethereum Signed Message:\n' + message.length.toString() + message);
var signature;
web3.personal.sign(message, signer, function(err, res) {
    if (err) console.error(err);
    signature = res;
    console.log({
        "signer": signer,
        "message": message,
        "message_hash": message_hash,
        "signature": signature,
    })
});

The response would be

{
    message: "0x4920616d20627574206120737461636b2065786368616e676520706f7374"
    message_hash: "0x1a0126ceafb4579293016a4cc3ca0ec753c7d497cda8b3e6ece095c832d92590"
    signature: "0x0cf7e2e1cbaf249175b8e004118a182eb378a0b78a7a741e72a0a34e970b59194aa4d9419352d181a4d1827abbad279ad4f5a7b60da5751b82fec4dde6f380a51b"
    signer: "0x9283099a29556fcf8fff5b2cea2d4f67cb7a7a8b"
}

If you have any questions, please let me know.

1

I believe this is only used as a form of login system. By signing a message, CryptoKitties can determine what address you are using, and therefore what account to show on their website.

  • Well, but if you use metamask it would be easier to just get the account info directly over metamask with the register button... Imho – kn1g Feb 14 '18 at 12:09
  • You mean you want Metamask to sign your transactions without prompting you? – Richard Horrocks Feb 14 '18 at 12:15

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.