Sign-In with Ethereum (SIWE) on Website

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Implementing Sign-In with Ethereum (SIWE) on Website

Sign-In with Ethereum (EIP-4361) is an Ethereum authorization standard. Like "Sign in with Google," but instead of OAuth — signature of a structured message with private key. The standard describes the exact format of the message user signs.

SIWE Message Format

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

Sign in to Example App

URI: https://example.com
Version: 1
Chain ID: 1
Nonce: oBbLoEldZs
Issued At: 2026-03-28T10:00:00.000Z
Expiration Time: 2026-03-28T10:15:00.000Z

Standard prevents phishing attacks: signed URI must match the website domain.

Installation

npm install siwe ethers

Frontend — React

import { SiweMessage } from 'siwe';
import { ethers } from 'ethers';

async function signInWithEthereum() {
  const provider = new ethers.BrowserProvider(window.ethereum);
  await provider.send('eth_requestAccounts', []);
  const signer = await provider.getSigner();
  const address = await signer.getAddress();
  const chainId = (await provider.getNetwork()).chainId;

  // Get nonce from server
  const nonce = await fetch('/api/siwe/nonce').then(r => r.text());

  // Create SIWE message per EIP-4361 standard
  const message = new SiweMessage({
    domain: window.location.host,           // required — your domain
    address,
    statement: 'Sign in to Example App',
    uri: window.location.origin,
    version: '1',
    chainId: Number(chainId),
    nonce,
    issuedAt: new Date().toISOString(),
    expirationTime: new Date(Date.now() + 15 * 60 * 1000).toISOString()  // 15 min
  });

  const signature = await signer.signMessage(message.prepareMessage());

  const response = await fetch('/api/siwe/verify', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ message: message.prepareMessage(), signature })
  });

  const { token } = await response.json();
  return token;
}

Backend — Verification

import { SiweMessage } from 'siwe';

// GET /api/siwe/nonce
app.get('/api/siwe/nonce', (req, res) => {
  const nonce = generateNonce();  // from siwe package
  req.session.nonce = nonce;
  res.send(nonce);
});

// POST /api/siwe/verify
app.post('/api/siwe/verify', async (req, res) => {
  const { message, signature } = req.body;

  try {
    const siweMessage = new SiweMessage(message);

    const { data: fields } = await siweMessage.verify({
      signature,
      nonce: req.session.nonce,
      domain: 'example.com',  // domain check — phishing protection
      time: new Date().toISOString()
    });

    // Nonce is one-time — delete after use
    req.session.nonce = null;

    // Create session
    const user = await userRepo.findOrCreateByAddress(fields.address.toLowerCase());

    const token = jwt.sign(
      { sub: user.id, address: fields.address, chainId: fields.chainId },
      process.env.JWT_SECRET,
      { expiresIn: '7d' }
    );

    res.json({ token, address: fields.address });

  } catch (error) {
    if (error.type === SiweErrorType.EXPIRED_MESSAGE) {
      return res.status(401).json({ error: 'Message expired, please try again' });
    }
    if (error.type === SiweErrorType.INVALID_SIGNATURE) {
      return res.status(401).json({ error: 'Invalid signature' });
    }
    if (error.type === SiweErrorType.DOMAIN_MISMATCH) {
      return res.status(401).json({ error: 'Domain mismatch' });
    }
    res.status(500).json({ error: 'Verification failed' });
  }
});

Integration with next-auth

// pages/api/auth/[...nextauth].ts
import { SiweMessage } from 'siwe';
import NextAuth from 'next-auth';
import CredentialsProvider from 'next-auth/providers/credentials';

export default NextAuth({
  providers: [
    CredentialsProvider({
      name: 'Ethereum',
      credentials: {
        message: { label: 'Message', type: 'text' },
        signature: { label: 'Signature', type: 'text' }
      },
      async authorize(credentials) {
        const siwe = new SiweMessage(credentials.message);
        const result = await siwe.verify({
          signature: credentials.signature,
          domain: process.env.NEXTAUTH_URL
        });

        if (result.success) {
          return { id: result.data.address };
        }
        return null;
      }
    })
  ],
  session: { strategy: 'jwt' }
});

Timeline

SIWE with nonce, verification, and JWT — 2–4 days.