One-click Login With Blockchain: A MetaMask login

Most functions in web3.js are read functions (get block, get balance, etc.), and web3 will give the response immediately. However, some functions (like web3.eth.sendTransaction and web3.personal.sign) need the current account to sign some data with its private key. These functions trigger MetaMask to show a confirmation screen, to double-check that the user knows what she or he is signing.Let’s see how to use MetaMask for this. To make a simple test, paste the following line in the DevTools console: