jepeta.
wallet security

Sign‑In with Ethereum: What to Check Before Signing a Login Message

Sign-In with Ethereum (SIWE) lets a service authenticate an Ethereum address using a signed message. Before signing, check which site is requesting the login and which account it names. For the service accepting the signature, recovering an address is only part of verification.

Three explanatory cards separate a SIWE login message, its request origin and account signature validation.
JEPETA — owned programmatic explanatory diagram

Key takeaways

  • Match the requesting origin, account, URI and chain to the expected login before accepting the message.
  • Bind a server-issued nonce to the pending login and consume it once; enforce the declared time bounds.
  • Verify EOA signatures and contract-account signatures through their appropriate methods, then create an address-bound session.
In this article

What the login message contains

ERC-4361's Message Fields section distinguishes the required fields from optional additions:

Required fieldWhat it identifies
domainThe requesting domain, including its authority and any specified port.
addressThe account being authenticated.
uriThe resource that is the subject of the signed message.
versionThe message-format version; this specification uses 1.
chain-idThe session's chain context and the network used to resolve contract accounts.
nonceA challenge value used for replay protection.
issued-atWhen the message was generated.

The scheme, statement, expiration time, not-before time, request ID and resources list are optional fields. The required uri is not the optional resources list. Leaving URI out is not a valid way to simplify a conforming SIWE message.

Illustrative login message and rejection checks

Illustrative example only. This unsigned message uses a placeholder account, a fixed sample nonce and historical sample times; it is not an active login challenge. Its line breaks are part of the message format.

example.com wants you to sign in with your Ethereum account:
0x0000000000000000000000000000000000000001

Sign in to the example reading account.

URI: https://example.com/login
Version: 1
Chain ID: 1
Nonce: q8M2v7R4s9T6u3W5
Issued At: 2026-11-10T08:00:00Z
Expiration Time: 2026-11-10T08:10:00Z
CheckExpected handling in this example
Origin and fieldsCompare with trusted origin https://example.com, expected URI, account, version and chain; reject a different domain.
ChallengeMatch the server-issued pending-login nonce and prevent a second successful use. Never issue this printed sample nonce.
TimeReject after the supplied expiration; ten minutes is this example’s choice, not a universal SIWE rule.
Signature and sessionValidate the exact message using ERC-191 for an EOA or the declared-chain ERC-1271 contract method, then bind the session to the verified address.

The format and account-verification rules come from ERC-4361; nonce consumption is an implementation recommendation. This is a documentation walkthrough, not an executed signature or application test.

Match the request to its origin

The origin requirements bind the message's domain and supplied scheme to the origin making the request. An embedded cross-origin frame has its own origin; it cannot simply claim its parent page's identity.

For a reader, an unexpected domain or account is a reason to stop and inspect the request. For an implementation, displaying a familiar domain string is insufficient: the wallet must compare the claimed origin with trusted request-origin information, and the service must validate the parsed fields against its expected values.

Validate the challenge as well as the signature

ERC-4361's verification requirements cover message grammar, expected values and signature validity. Check the intended domain, URI, chain, version and challenge rather than accepting whichever values arrived in the submitted message.

The standard recommends a nonce with enough unpredictability for each session initiation. An implementation recommendation is to bind the issued challenge to the pending login and prevent it being accepted again after use. The precise nonce-generation mechanism is outside the standard's scope; the presence of a field named nonce does not prove replay protection is implemented.

Check any supplied expiration and not-before bounds. Apply a deliberate freshness policy to issued-at rather than inventing a universal few-minute validity window. The optional expiration field is not automatically present in every conforming message.

Recovering an EOA signer is only one check

For an externally owned account, ERC-191 defines the personal-message framing used by SIWE. That framing separates these signed bytes from an ordinary Ethereum transaction.

In ethers v6, hashMessage and verifyMessage provide message hashing and signer recovery. Recovery identifies the address associated with a signature over the supplied message. It does not itself parse SIWE, compare your application's domain or consume your application's nonce. Those checks remain necessary.

Contract accounts use contract validation

For contract accounts, SIWE recommends ERC-1271, with the validating contract resolved on the declared chain. ERC-1271 defines isValidSignature(hash, signature) and the successful return value 0x1626ba7e.

This is a validation interface, not a claim that a contract has a private key or produces a signature by calling ERC-1271. The contract evaluates supplied signature data under its own rules. Those rules may depend on state, time, signer permissions or the signature scheme, so an EOA-recovery-only path is not a general contract-account verifier. SIWE also calls for considering session invalidation when relevant validation state changes.

Keep authentication, sessions and permissions distinct

Ethereum's authentication documentation separates sharing a wallet address from signing a login challenge. After authentication, the application still needs session management, such as a session cookie or JWT. SIWE requires the session to bind to the verified address rather than a mutable resolved resource.

The standard leaves interpretation of the optional resources list and authorization to server resources outside its scope. Likewise, ERC-191 framing does not make every offchain signature harmless: ERC-1271's motivation describes signed orders that can authorize later asset movement.

Before accepting the login

Check the displayed site and account; validate the complete message; compare its fields with the expected login context; verify through the appropriate account method; and enforce challenge and session handling. A chain ID in a message is context that must be checked, not a standalone guarantee against misuse.

This is an AI-assisted review of the cited specifications and documentation. It does not certify a particular wallet, application or live login session, and no signature or wallet test was performed.

Evidence and source-review method

  • source audit — Specification-based field and verification checklist separating origin checks, application challenge handling, EOA recovery, contract-account validation and application sessions. Documentation comparison only; no wallet or login session was tested. · observed Nov 9, 2026
  • structured comparison — Illustrative SIWE message with expected origin, nonce, time and account-method checks. No signature executed. · observed Nov 10, 2026

Editorial transparency

AI-assisted review of SIWE and account-signature documentation. No wallet signature or live login session was tested. No affiliate links are enabled. Examples are explicitly illustrative. They do not represent live chain observations or completed wallet or validator tests.

Sources

Continue reading

Browse all articles