Skip to main content

Try it Live

Run SIWE examples in the interactive playground
Conceptual Guide - For API reference and method documentation, see SIWE API.
Sign-In with Ethereum (SIWE) is a decentralized authentication protocol that lets users prove address ownership by signing structured messages with their private keys. No OAuth, no passwords, no third parties - just cryptographic proof.

What is SIWE?

SIWE (EIP-4361) standardizes Ethereum-based authentication. Instead of usernames and passwords, users sign a message with their wallet to prove they control an address.

Why SIWE Exists

Traditional web authentication relies on centralized identity providers (Google, Twitter, etc.). SIWE enables:
  • Self-sovereign identity - Users own their credentials (private keys)
  • No intermediaries - Direct cryptographic proof, no OAuth handshakes
  • Privacy - No personal data required, just address ownership
  • Standardization - Common format for Ethereum authentication across dApps

Message Format

SIWE messages are human-readable structured text. Users read and sign them with wallets:

Message Components

Each field serves a specific security or usability purpose:
  • Domain - Origin where signing occurs (prevents phishing)
  • Address - Account performing authentication
  • Statement - Human-readable context (optional)
  • URI - Resource being accessed
  • Version - Protocol version (always “1”)
  • Chain ID - Which blockchain (prevents replay across chains)
  • Nonce - One-time random value (prevents replay attacks)
  • Issued At - Timestamp when message created
  • Expiration Time - When message becomes invalid (optional)
  • Not Before - When message becomes valid (optional)
  • Request ID - System identifier (optional)
  • Resources - List of granted URIs (optional)

Authentication Flow

SIWE follows a multi-step process:

Why Nonces Matter

Without nonces, attackers could replay old signed messages to impersonate users. Nonces ensure each signature is single-use:

Complete Example: Authentication

Full authentication flow from message creation to verification:

Signing and Verification

SIWE uses EIP-191 personal sign standard:

Combined Validation and Verification

Use verifyMessage() for complete validation:

Security Considerations

Domain Binding

Always verify the domain matches your origin to prevent phishing:
Attackers can’t use a signature from attacker.com on example.com because the domain is in the signed message.

Nonce Management

Implement proper nonce handling:

Expiration Times

Set reasonable expiration windows:

HTTPS in Production

Always use HTTPS in production to prevent man-in-the-middle attacks. SIWE doesn’t encrypt messages - they’re signed plaintext.

Common Use Cases

dApp Login

Authenticate users to access dApp features:

Session Management

Create time-limited sessions:

Resource Authorization

Grant access to specific resources:

Resources

Next Steps