Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ERC4361, a proposal for authenticating to off-chain services using Ethereum accounts.

This article translates, summarizes, and expands on the following proposal.

As of January 7, 2024, ERC4361 was at the Review stage.

For other EIP articles, see the proposal index.

Overview

Sign-In with Ethereum is a method of signing in to off-chain services, such as internet applications, using an Ethereum account. Users sign a message containing information about the scope and session, along with security elements such as a nonce (a random value intended for one-time use). The goal is to offer a self-managed alternative to centralized identity providers, such as Google or Facebook login, and make Ethereum-based authentication interoperable across services. The specification also enables wallet providers to interpret messages consistently, improving the user experience and consent management.

Motivation

When signing in to online services, many people rely on identity providers (IdPs) operated by large companies such as Google and Facebook. Although convenient, these services exercise extensive control over users' personal information. Their incentives may not align with users' interests, raising privacy and security concerns.

Sign-In with Ethereum offers one solution to these problems. This Ethereum-based sign-in method allows users to hold and manage their own digital identities. Users can thus control their own identifying information and access services without depending on a centralized company.

Many services already support Ethereum account authentication through message signing. This allows users to demonstrate their identity securely when signing in. Sign-In with Ethereum standardizes this signing process, enables interoperability between services, and improves the user experience by making sign-in requests recognizable to wallet vendors.

An identity provider (IdP) is a system or platform that manages identity information and provides authentication services. Its primary purpose is to let users prove their identities and securely access online services.

Authentication An IdP verifies user identity through various mechanisms, including usernames and passwords, two-factor authentication, and biometrics. When users provide valid credentials, the IdP confirms their identity and allows access.

Single sign-on (SSO) An IdP often supports single sign-on. This enables users to access several related but independent software systems after signing in once. SSO improves convenience and helps reduce password-related risks.

Authorization and access management An IdP manages permissions that define the resources users can access and the operations they can perform. This ensures that only authorized users have access to sensitive information and features.

Federation Multiple IdPs establish trust relationships that allow users to move seamlessly across domains. Users can consequently reuse their credentials across different services.

Privacy and security An IdP employs security measures such as encryption, security policies, and audit logs to protect personal information.

Common IdPs include social login services such as Google Accounts, Facebook Login, and Twitter authentication, and enterprise or educational systems such as Microsoft Active Directory and LDAP. IdPs play an essential role in managing online identities and security.

Specification

Overview

Sign-In with Ethereum (SIWE) allows users to sign in to services using Ethereum accounts. The process consists of the following steps.

  1. Role of the service provider

    • The service provider (relying party) first creates a special message called a SIWE message.
    • The message is prefixed as shown below, in accordance with the Ethereum standard ERC191.
      • \x19Ethereum Signed Message:\n<length of message>
    • The prefix identifies the format of the signed message.
  2. Roles of the user and wallet

    • The user's wallet, an application for managing Ethereum accounts, displays the message and requests a signature.
    • The user signs the message through the wallet, producing data signed in the ERC191 format.
  3. Signature verification

    • After the user signs, the signed message is returned to the service provider.
    • The service provider verifies the signature and checks whether the message contents meet its requirements.
  4. Retrieving additional data

    • After verification, the service provider may retrieve additional data associated with the user's Ethereum address as needed.
    • This may include publicly available blockchain information, such as ENS names, account balances, and ownership of ERC20, ERC721, and ERC1155 tokens, or information from other data sources.

For more information on ERC191, see the following article.

[ERC191] Safely Using Signed Data

For more information on ERC20, see the following article.

https://chaldene.net/erc20

For more information on ERC721, see the following article.

https://chaldene.net/erc721

For more information on ERC1155, see the following article.

https://chaldene.net/erc1155

This process allows users to securely sign in to different online services using their Ethereum accounts.

Message format

ABNF message format

A Sign-In with Ethereum (SIWE) message has a specific format used when signing in to online services with an Ethereum account. The message follows strict rules defined in Augmented Backus-Naur Form (ABNF) to support secure authentication.

text
sign-in-with-ethereum =
    [ scheme "://" ] domain %s" wants you to sign in with your Ethereum account:" LF
    address LF
    LF
    [ statement LF ]
    LF
    %s"URI: " uri LF
    %s"Version: " version LF
    %s"Chain ID: " chain-id LF
    %s"Nonce: " nonce LF
    %s"Issued At: " issued-at
    [ LF %s"Expiration Time: " expiration-time ]
    [ LF %s"Not Before: " not-before ]
    [ LF %s"Request ID: " request-id ]
    [ LF %s"Resources:"
    resources ]

scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
    ; See RFC 3986 for the fully contextualized
    ; definition of "scheme".

domain = authority
    ; From RFC 3986:
    ;     authority     = [ userinfo "@" ] host [ ":" port ]
    ; See RFC 3986 for the fully contextualized
    ; definition of "authority".

address = "0x" 40*40HEXDIG
    ; Must also conform to captilization
    ; checksum encoding specified in EIP-55
    ; where applicable (EOAs).

statement = *( reserved / unreserved / " " )
    ; See RFC 3986 for the definition
    ; of "reserved" and "unreserved".
    ; The purpose is to exclude LF (line break).

uri = URI
    ; See RFC 3986 for the definition of "URI".

version = "1"

chain-id = 1*DIGIT
    ; See EIP-155 for valid CHAIN_IDs.

nonce = 8*( ALPHA / DIGIT )
    ; See RFC 5234 for the definition
    ; of "ALPHA" and "DIGIT".

issued-at = date-time
expiration-time = date-time
not-before = date-time
    ; See RFC 3339 (ISO 8601) for the
    ; definition of "date-time".

request-id = *pchar
    ; See RFC 3986 for the definition of "pchar".

resources = *( LF resource )

resource = "- " URI
  • sign-in-with-ethereum
    • Marks the beginning of the message and tells the user that the service is requesting sign-in with an Ethereum account.
  • scheme
    • Identifies the website or application's protocol, such as HTTP or HTTPS.
  • domain
    • The domain name of the website or service requesting sign-in.
  • address
    • The user's Ethereum address, which must follow the specified format (EIP55) where applicable.

For more information on EIP55, see the following article.

[EIP55] Understanding Ethereum Address Checksums

  • statement
    • An optional message or statement that the service provider wants to communicate to the user.
  • uri
    • A web address associated with the service or transaction.
  • version
    • The version of the message format.
  • chain-id
    • The Ethereum chain ID associated with the transaction.
  • nonce
    • A random string used to ensure that the message is unique.
  • issued-at, expiration-time, not-before
    • When the message was issued, when it expires, and when it becomes valid.
  • request-id
    • A unique identifier for the transaction.
  • resources
    • A list of additional resources associated with the transaction.

A SIWE message therefore contains several elements intended to ensure secure communication between users and service providers. By signing and sending the message to the service provider, users can authenticate using their Ethereum accounts.

Message fields

A Sign-In with Ethereum (SIWE) message is a collection of information used to securely sign in to a service with an Ethereum account. Each field supplies information about a different aspect of the authentication process. The following descriptions explain what the fields mean and how they work.

  • scheme (optional)

    • Indicates the website's protocol, such as HTTP or HTTPS.
    • It identifies the type of connection through which the request was made.
  • domain (required)

    • The address of the website requesting sign-in.
    • It tells users which site is requesting authentication.
  • address (required)

    • The user's Ethereum address, representing the account signing the message.
    • It represents the user's digital identity in this context.
  • statement (optional)

    • A message included in the signed content that clarifies what the user is approving.
    • It is typically a short, easily understood sentence.
  • uri (required)

    • The address of the specific web page or resource associated with the sign-in.
    • It identifies what the sign-in relates to.
  • version (required)

    • The version of the SIWE message format; the current value in this specification is 1.
    • This allows future updates and changes to be managed.
  • chain-id (required)

    • Identifies the Ethereum chain associated with the transaction.
    • Different chains have different characteristics.
  • nonce (required)

    • A random string that prevents reuse of the same message.
    • This is important for strengthening security.
  • issued-at (required)

    • The precise time at which the message was generated.
    • It helps establish the freshness of the message.
  • expiration-time (optional)

    • The message's expiration time.
    • After this time, the message becomes invalid.
  • not-before (optional)

    • The time at which the message becomes valid.
    • The message cannot be used before this time.
  • request-id (optional)

    • An identifier for a particular sign-in request.
    • This enables individual requests to be tracked.
  • resources (optional)

    • A list of additional information that may be referenced during authentication.
    • It allows the sign-in process to include more contextual information.

These fields are designed to ensure transparency, security, and convenience when users sign in to online services using Ethereum accounts.

Informal message template

The informal Sign-In with Ethereum (SIWE) template shows the information used when signing in to an online service with an Ethereum account. It is designed to make the message structure intuitive. Each placeholder variable represents a particular part of the message, as explained below.

text
${scheme}:// ${domain} wants you to sign in with your Ethereum account:
${address}

${statement}

URI: ${uri}
Version: ${version}
Chain ID: ${chain-id}
Nonce: ${nonce}
Issued At: ${issued-at}
Expiration Time: ${expiration-time}
Not Before: ${not-before}
Request ID: ${request-id}
Resources:
- ${resources[0]}
- ${resources[1]}
...
- ${resources[n]}
  • ${scheme}:// ${domain}

    • This part contains the service's web address and identifies the domain requesting authentication with an Ethereum account.
    • scheme specifies the communication protocol, normally HTTPS, and domain specifies the service's domain name (for example, example.com).
  • ${address}

    • The user's Ethereum address, indicating which account will be used to sign in.
  • ${statement}

    • The message or statement presented by the service, indicating what the user is agreeing to.
  • URI: ${uri}

    • A web address identifying the resource or service to which the signature relates.
  • Version: ${version}

    • The version of the SIWE message format.
  • Chain ID: ${chain-id}

    • Identifies the Ethereum chain associated with the transaction.
  • Nonce: ${nonce}

    • A random string that ensures uniqueness and prevents replay attacks.
  • Issued At: ${issued-at}

    • The precise date and time at which the message was created.
  • Expiration Time: ${expiration-time}

    • The date and time at which the message expires.
  • Not Before: ${not-before}

    • The starting date and time at which the message becomes valid.
  • Request ID: ${request-id}

    • A unique identifier for a specific sign-in request.
  • Resources

    • A list of additional information the service checks during authentication.
    • Each resource is represented by a URI.

This template helps explain the basic structure of a SIWE message, which in practice must conform precisely to the more detailed ABNF message format. It illustrates which information is included and the purpose of each part.

Examples

Each example identifies the service domain, the user's Ethereum address, acceptance of the terms of service, and request details.

Example with an implicit scheme
text
example.com wants you to sign in with your Ethereum account:
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

I accept the ExampleOrg Terms of Service: https://example.com/tos

URI: https://example.com/login
Version: 1
Chain ID: 1
Nonce: 32891756
Issued At: 2021-09-30T16:25:24Z
Resources:
- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/
- https://example.com/my-web2-claim.json
  • The service example.com requests sign-in using the user's Ethereum address.
  • The user accepts the service's terms and accesses a particular login page (URI).
  • The message includes the Ethereum mainnet chain ID, a nonce, and the time at which the message was issued.
  • An IPFS link and a web link are provided as additional resources.
Example with an implicit scheme and explicit port
text
example.com:3388 wants you to sign in with your Ethereum account:
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

I accept the ExampleOrg Terms of Service: https://example.com/tos

URI: https://example.com/login
Version: 1
Chain ID: 1
Nonce: 32891756
Issued At: 2021-09-30T16:25:24Z
Resources:
- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/
- https://example.com/my-web2-claim.json
  • This is essentially the same as the first example, but the domain includes a specific port, 3388.
  • This indicates that the service communicates through a particular port.
Example with an explicit scheme
text
https://example.com wants you to sign in with your Ethereum account:
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

I accept the ExampleOrg Terms of Service: https://example.com/tos

URI: https://example.com/login
Version: 1
Chain ID: 1
Nonce: 32891756
Issued At: 2021-09-30T16:25:24Z
Resources:
- ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/
- https://example.com/my-web2-claim.json
  • Here, the service explicitly specifies the https protocol, and https://example.com requests sign-in.
  • The other details are the same as in the preceding examples.

These examples demonstrate how SIWE messages are structured and what information they contain. They help illustrate how authentication with an Ethereum account proceeds using these messages.

Signing and verifying messages with Ethereum accounts

The methods for signing and verifying messages with Ethereum accounts depend on the type of account. These methods are important for securing reliable interactions.

Externally owned accounts (EOAs)

These are ordinary Ethereum accounts controlled directly by individuals. Messages are signed according to the ERC191 standard. This is a common way to authenticate signed messages.

For more information on ERC191, see the following article.

[ERC191] Safely Using Signed Data

Contract accounts

These accounts are controlled by code and can provide more complex functionality. Messages are normally verified according to the ERC1271 signature-verification standard. This enables the contract to verify signatures. If ERC1271 is not used, another well-defined, reliable verification method must be specified and used. For this account type, verification results may change depending on blockchain state, so particular attention must be paid to security and verification rules.

For more information on ERC1271, see the following article.

[ERC1271] Verifying Signatures with Smart Contracts

Using these methods correctly enables users to securely sign in to services and reliably exchange messages with Ethereum accounts. The key is to follow the appropriate standards and choose secure methods for the circumstances.

Resolving Ethereum Name Service (ENS) data

Ethereum Name Service (ENS) associates human-readable names and other information with Ethereum addresses. This allows users to make transactions and identify accounts using simple names rather than long, complex addresses. Examples of ENS data that can be resolved include the following.

Primary ENS name

The primary name associated with the user's Ethereum address, typically in a form such as yourname.eth.

ENS avatar

An image or icon associated with the user's address. It makes the account visually identifiable.

Other resources

Any other information described in the ENS documentation. Examples may include contact information and social media profiles.

Relying parties and wallets may improve the user experience by resolving this information, but must take care to protect privacy. In particular, resolving ENS data may disclose the user's address to third parties, so clear guidelines and consent regarding its use and sharing are necessary. Using ENS features securely and transparently is essential to preserving user trust and security.

Steps

The following are important steps for handling Sign-In with Ethereum (SIWE) messages.

  1. Matching the request origin

    • The domain (and, where applicable, scheme) from which sign-in is requested must be accurately represented in the SIWE message.
    • This verifies the precise origin requesting authentication and preserves security.
  2. Message verification

    • The SIWE message must conform to the prescribed format and be checked against expected values, including expiration time and nonce.
    • The message signature must also be verified by the appropriate method.
  3. Binding sessions

    • Sessions should be established based on the user's address.
    • Basing sessions on mutable information can introduce security risks.
  4. Handling resources

    • Resources (URIs) in the message should be presented in a way that users can understand.
    • However, the specific interpretation of those resources is outside the scope of the SIWE message.

Implementing these steps correctly enables secure sign-in with Ethereum accounts and helps ensure reliable authentication.

Wallet implementation steps

Verifying the message format

The following steps apply to wallet implementers.

  1. Strict message-format verification

    • A received SIWE message must be checked to ensure it is correctly formatted.
    • This helps ensure that the message contains accurate and reliable information.
    • In particular, verify that it conforms to the formal ABNF grammar.
  2. Warning about suspicious messages

    • Messages containing sign-in language, for example "wants you to sign in with your Ethereum account", warrant particular attention.
    • If such a message does not fully conform to the formal grammar, the wallet should warn the user.
    • This reduces the risk of users inadvertently signing inappropriate messages.

These steps are important for wallets to protect users and ensure reliable operations. A wallet provides a safer environment by enforcing the correct format and warning users about suspicious requests.

Verifying the request origin

The following steps describe how wallet implementers verify a request origin.

  1. Checking the origin match

    • Verify that the sign-in request comes from the correct website, such as https://example.com.
    • Use the domain and scheme information in the SIWE message.
    • This reduces the risk of users mistakenly providing information to unsafe impersonation sites.
  2. Obtaining the origin from a trusted source

    • The original location from which the request was sent should be obtained from a trusted source, such as a browser window or a WalletConnect session.
    • This helps establish the legitimacy of the request.
  3. Handling localhost

    • If the origin is localhost, for example during development, wallets may warn instead of rejecting the request outright.
    • This facilitates testing projects under development.
  4. Recommended verification algorithm

    • Run an algorithm to verify the origin using input variables such as the SIWE message contents, the signing request origin, and the allowed schemes.
    • Pay particular attention to handling localhost origins and using the default scheme when none is specified.

These steps are important for ensuring that users respond only to legitimate requests and are protected from phishing and other fraudulent activity. Accurate implementation and application of these verification steps are recommended for secure services.

The following algorithm describes how a wallet verifies the request origin.

  • Setting the scheme

    • If no scheme is specified, the wallet uses the default, normally 'https'.
  • Verifying the scheme

    • If the request scheme is not in the list of allowed schemes, the wallet rejects the request.
    • Typically, only 'https' is allowed for security.
  • Matching the scheme

    • If the request scheme differs from that of the website, the wallet normally rejects it, although developer mode may warn and allow continuation.
  • Matching the domain and host

    • If the request domain differs from the website host, the wallet rejects the request.
    • Developer mode may warn and allow continuation.
  • Matching subdomains

    • If the domain and origin subdomains differ, the request is normally rejected, although developer mode may warn and allow continuation.
  • Matching ports

    • If a port is specified, verify that it matches the website's port.
    • A warning may be issued if the ports differ or the request omits a port while the website has a specific port.

These steps help wallets establish that requests originate from legitimate websites and protect users from inadvertently providing information to phishing sites. Developer mode is designed to ease testing by relaxing some checks; normal usage requires strict verification.

Creating a sign-in interface for Ethereum

  • Displaying the message contents

    • Before the user signs, wallets must display important information in the SIWE message by default, including the scheme, domain, address, statement, and resources.
    • Other fields that are present should also be shown to the user.
  • Ensuring the user scrolls through the text

    • Wallets are encouraged to require scrolling to help ensure that users have read the entire plain-text message.
  • Creating a custom interface

    • Wallet implementers can parse the message into data elements and create a more user-friendly custom interface, but important information must still be displayed.

These steps enable wallet implementers to provide clear, trustworthy signing processes and interfaces that accommodate different user needs.

Internationalization (i18n) support

After a message has been successfully parsed, the user interface may be translated into different languages. This accommodates users who speak different languages.

Rationale

Requirements

The following requirements guided the design of Sign-In with Ethereum.

  • A simple, practical specification

    • The specification should be concise and based on already widely adopted methods.
    • It takes a decentralized, open approach, avoiding unnecessary features and integrations specific to a small number of projects.
  • Core requirements

    • Use Ethereum accounts for authentication, ENS names as usernames through reverse resolution, and ENS text records to retrieve additional profile information.
    • Use only the servers an application already operates, without relying on centralized servers.
  • User interface

    • Present users with an understandable interface before they sign.
    • Avoid complex machine-oriented representations such as JSON blobs and hexadecimal code wherever possible.
  • Application server support

    • Applications should be able to implement support without requiring changes on the wallet side.
  • Upgrade path

    • Applications and wallets already using Ethereum account signatures should have a simple, direct upgrade path.
  • Security measures

    • Appropriate mitigations and guidelines are needed for man-in-the-middle attacks, replay attacks, and malicious signing requests.

These requirements are important to keeping Sign-In with Ethereum secure and easy to use.

Design goals

The design goals of Sign-In with Ethereum are described below.

  • Human-friendly

    • Aim for an interface users can understand and operate easily.
    • This includes avoiding complex technical language and making interactions intuitive.
  • Implementation simplicity

    • Keep the design simple enough for developers to understand and implement easily.
    • This promotes adoption across a broad range of applications and wallets.
  • Security

    • Prioritize security to protect user data and identities.
    • This includes robust measures against unauthorized access and data exposure.
  • Machine readability

    • Messages should be easy for machines to parse to support interoperability between systems.
    • This enables automation and efficient processing.
  • Extensibility

    • The system should be extensible to accommodate future technical developments and new use cases.
    • This preserves long-term sustainability and flexibility.

These design goals provide a foundation for Sign-In with Ethereum to be usable, secure, and broadly adopted.

Technical decisions

The following explains the technical decisions behind Sign-In with Ethereum.

  • Why ERC-191 (signed data standard) was chosen over EIP-712
    • ERC191 is widely supported by wallet user interfaces.
    • Implementing ERC191 is simple because it only requires a predetermined prefix before signing.
    • ERC191 produces more human-readable messages, whereas EIP712 is oriented toward machine processing and its signed content was not displayed in a human-friendly way by many wallets at the time.

For more information on EIP712, see the following article.

[EIP712] Hashing and Signing Typed Structured Data

  • Why JWT (JSON Web Token) was not used

    • Wallets do not support JWT, and IANA has not assigned the Keccak hash function as a JOSE algorithm.
  • Why YAML or YAML with exceptions was not used

    • YAML is more permissive than ABNF. ABNF can readily express character-set restrictions, required ordering, and strict whitespace rules.

These decisions are important for providing a simple, widely supported, user-friendly, and secure authentication method.

signing.png Source: https://eips.ethereum.org/EIPS/eip-4361

Out of scope

The following items are outside the scope of the version of Sign-In with Ethereum discussed here.

  • Authentication methods other than Ethereum addresses

    • The specification focuses on authentication based on Ethereum addresses and does not include other methods.
  • Authorization for server resources

    • Authorization processes for managing access to server-side resources are outside the specification's scope.
  • Handling URIs in the resources field

    • The specification does not define how to interpret URIs in the resources field as claims or other resources.
  • Domain-binding mechanisms

    • Specific technical mechanisms for binding domains to requests are not covered.
  • Nonce generation and evaluation

    • How to generate nonces and evaluate their suitability is outside the scope of the specification.
  • Protocols without TLS

    • Protocols for use over unencrypted connections without TLS are also not covered.

These items are excluded from this version of the specification but could be added in the future. The primary objective of this version is to provide a simple and effective Ethereum-based authentication system.

Compatibility considerations

The following considerations concern future compatibility for Sign-In with Ethereum.

  • Decentralized identifiers and verifiable credentials

    • The system could integrate digital identity technologies such as DIDs and verifiable credentials, enabling richer and more secure identity management.
  • Cross-chain support

    • Interoperability with blockchains other than Ethereum could support users of different blockchain technologies.
  • SIOPv2 support

    • Supporting new authentication protocols and standards could expand functionality to meet a broader range of user needs.
  • Future EIP-712 support

    • Supporting proposals such as EIP712 may enable users to experience a more understandable signing process.
  • Version interpretation rules

    • Rules for version management and interpretation could provide a stable upgrade path while accommodating future updates to the specification.

These considerations aim to preserve future extensibility and flexibility and provide users with more convenient, secure authentication.

Backwards compatibility

ERC191, the basis of Sign-In with Ethereum, is already supported by many wallets. Building on that support, SIWE combines additional features such as acceptance of terms of service, a nonce to prevent replay attacks, and an Ethereum address embedded in the message. These requirements draw on existing implementations used by similar sign-in workflows.

This approach builds Sign-In with Ethereum on widely adopted technology while providing a more user-friendly and secure authentication experience. Users can follow clear steps to accept the service's terms and sign in reliably using their Ethereum addresses. The nonce further strengthens security.

Reference implementation

Reference implementations are available below.

https://eips.ethereum.org/assets/eip-4361/example.js

Security considerations

Identifier reuse

The considerations around identifier reuse in Sign-In with Ethereum focus on user privacy.

  • Maximizing privacy

    • Users can achieve greater privacy by using a new, unrelated Ethereum address for each interaction.
    • This limits the disclosed information to what is necessary and avoids unnecessary exposure.
  • Impact on early adopters

    • Such privacy considerations may be less important to early adopters, including users who already have Ethereum addresses publicly associated with themselves.
    • They often prefer identifier reuse to maintain the same identity across services.
  • Mainstream adoption and stronger privacy

    • Privacy becomes more important as mainstream adoption progresses.
    • Advanced technologies such as HD wallets and zero-knowledge proofs may further protect privacy, but are outside the scope of this version.

The specification emphasizes privacy while accommodating early adopters whose privacy requirements may be less strict at present. More advanced privacy-preserving technologies could be incorporated in the future.

Key management

Key management in Sign-In with Ethereum gives users control through their own keys, but introduces new responsibilities. For mainstream users accustomed to centralized identity providers, key management may be unfamiliar and difficult because there is no straightforward equivalent to recovering a forgotten password.

Early adopters may already understand key management, but the issue becomes more important as adoption expands and more ordinary users encounter it. Possible solutions include wallets using smart contracts or multisignature mechanisms, which can simplify key use and recovery through ERC1271 signatures and improve the user experience.

Key management is an important aspect of Sign-In with Ethereum. Providing simpler and more secure approaches for everyone from early adopters to mainstream users remains a challenge.

Combined wallet and relying-party security

This section explains security measures involving wallets and relying parties in Sign-In with Ethereum.

  • Strengthening security through cooperation

    • To improve end-user security, both the wallet and the relying party must implement the specification correctly and cooperate.
  • Importance of verifying the request origin

    • The wallet is responsible for verifying that the SIWE message comes from the correct origin, such as the legitimate website.
    • This protects users from deceptive requests, including those originating from phishing websites.
    • Wallets are also expected to give users a way to perform their own checks, such as visual verification.
  • Mitigating phishing attacks

    • If origin verification is not performed correctly, users may be exposed to phishing and similar risks.
    • It is therefore important for wallets to have a rigorous process for establishing the legitimacy of requests.

Cooperation between wallets and relying parties, together with origin verification, strengthens security and helps protect users from phishing risks.

Minimizing wallet-server interaction

Minimizing interaction between the wallet and server in Sign-In with Ethereum is important for user privacy.

  • Choosing the sign-in workflow

    • Two implementation approaches are possible: sending parameters from the server to the wallet, or generating the complete SIWE message on the client side.
    • From a privacy perspective, the latter approach is recommended because it minimizes interaction with the server.
  • Preventing replay attacks

    • While a backend server may generate the nonce to prevent replay attacks, privacy-preserving alternatives are also considered.
  • Wallet-server communication

    • The wallet may consult the server to determine the signed message contents, such as an appropriate nonce or set of resources.
    • In doing so, it is important to take measures against disclosure of user information.
  • Accommodating user preferences

    • The wallet may ask users about their preferences before signing.
    • For example, users may choose one address from several available addresses, or select their preferred ENS name from multiple names.

Carefully handling wallet-server interaction and respecting user preferences and privacy helps provide a secure, reliable sign-in experience.

Preventing replay attacks

The discussion of replay attacks in Sign-In with Ethereum emphasizes the importance of choosing an appropriate nonce when a session starts. A replay attack may occur when a man-in-the-middle attacker obtains a user's signature and uses it to establish an unauthorized new session. To prevent this, each session should begin with a one-time value (nonce) that has sufficient entropy, or unpredictability. The proposal also considers privacy-respecting, widely available nonce inputs, such as a recent Ethereum block hash or a Unix timestamp. The aim is to protect users against replay attacks while preserving privacy.

Preventing phishing attacks

To prevent phishing attacks, wallets need a process to verify that a request was sent from a legitimate origin. This is called origin verification: the wallet checks whether the SIWE message really comes from the origin of the service the user intended to use. This check helps prevent attackers from sending fraudulent requests and tricking users into unintended actions. Accurately verifying the request origin is therefore essential for user protection and a secure sign-in experience.

Channel security

Channel-security measures in web applications are important for protecting communications and providing a secure Sign-In with Ethereum experience. The following measures are recommended.

Using HTTPS

HTTPS is recommended for all communication during message signing to prevent man-in-the-middle attacks. HTTPS encrypts communication and protects confidentiality, integrity, and the authenticity of communicating parties.

Protection when using protocols other than HTTPS

If a different protocol is used, appropriate protection is still recommended to preserve confidentiality, data integrity, and the authenticity of communicating parties. This includes applying strong encryption techniques and security protocols.

These measures protect user communications and enable authentication in a secure environment. Secure channels are essential for mitigating phishing, data exposure, and other security risks, and for improving user trust and service reliability.

Session invalidation

Session invalidation in Sign-In with Ethereum involves monitoring state changes that affect session security. In particular, if an ERC1271 implementation or data on which it depends changes, the change may affect signature verification, so the server must invalidate sessions as appropriate. Similarly, if a resource specified in the resources field changes, the server should invalidate the relevant session. The specific interpretation of resources is outside the scope of this specification. These measures are important to keep user sessions current and secure and to prevent unauthorized access and misuse of data.

For more information on ERC1271, see the following article.

[ERC1271] Verifying Signatures with Smart Contracts

Maximum lengths of ABNF terms

The specification does not impose normative maximum string lengths for specific ABNF terms. Implementers are encouraged to choose appropriate maximum lengths that balance denial-of-service prevention, accommodation of different use cases, and readability. Excessively long strings may burden the system or make it difficult to use, so appropriate limits are important for security and usability. Implementers should therefore carefully choose maximum lengths for each term to maintain system security and the quality of the user experience.

References

Wayne Chang (@wyc), Gregory Rocco (@obstropolos), Brantly Millegan (@brantlymillegan), Nick Johnson (@Arachnid), Oliver Terbu (@awoie), "ERC-4361: Sign-In with Ethereum [DRAFT]," Ethereum Improvement Proposals, no. 4361, October 2021. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-4361.

Conclusion

This article examined ERC4361, a proposal for signing in to off-chain services using Ethereum accounts. I hope it was useful.