Sign-In with Ethereum
You can set up Sign-In with Uptick network to enable users to easily sign in to your dapp by authenticating with their MetaMask wallet.
MetaMask supports the SIWE standard message format as specified in ERC-4361. When your dapp prompts a user to sign a message that follows the SIWE format, MetaMask parses the message and gives the user a friendly interface prompting them to sign in to your dapp:
// Sign-in with Ethereum
export async function addNetwork() {
try {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: `0x75`,
chainName: `Uptick Network`,
nativeCurrency: {
name: 'UptickToken',
symbol: `Uptick`,
decimals: 18,
},
rpcUrls: [`https://json-rpc.uptick.network`],
blockExplorerUrls: [`https://evm-explorer.uptick.network/`],
}],
});
}
catch (error) {
console.error(error);
}
}Domain binding
MetaMask supports domain binding with SIWE to help prevent phishing attacks. When a site asks a user to sign a SIWE message, but the domain in the message doesn't match the site the user is on, MetaMask displays a warning in the sign-in interface. The user must explicitly select to proceed, accepting the risk of a phishing attack.
IMPORTANT
MetaMask displays a prominent warning for mismatched domains, but does not block users from bypassing the warning and accepting the sign-in request. This is to not break existing dapps that may have use cases for mismatched domains.


Example
The following is an example of setting up SIWE with MetaMask using personal_sign. See the live example and test dapp source code.
Last updated