Start a conversation

g4mma / Insights

From the Labs 7 min read

From the Labs

A Wallet Address Is Not a Login

Most "connect wallet" logins prove nothing. Here is the check they skip, what a real proof needs, and how we carried the same rules into exam attestations that anyone can verify.

By
sanneh
Published
Reading
7 min
An open silver padlock hanging unlatched on a dark door.

A lot of sites that offer "log in with your wallet" never ask the wallet to sign anything.

The page connects to the wallet, reads the address it exposes, and sends that address to the server. The server looks it up and starts a session. The user feels like they authenticated with cryptography. They didn't. They typed in a username that happened to be 42 characters long.

We have seen this flaw in competing products: a wallet connection treated as a login, with no signature requested at any point.

How the spoof works

A wallet address is public. It is on-chain, in block explorers, on profile pages. If the only thing the server receives is an address, the server has no way to know whether the request came from the person who holds the key or from anyone who copied the address.

Illustrative only, not taken from any real product:

js
// Client: "log in" with whatever address the wallet reports
const [address] = await window.ethereum.request({ method: "eth_requestAccounts" });
await fetch("/api/login", { method: "POST", body: JSON.stringify({ address }) });

Nothing stops a request to /api/login with someone else's address in the body. No wallet needed. One curl command and you are inside another person's account, with their history, their holdings on display and whatever permissions the address carries.

The fix is not complicated, but every part of it matters.

What a real proof needs

A login, or any claim, is only proven when the server verifies a signature over a message it controls. Each of these is there because something breaks without it.

  • A server-issued nonce. The server generates a random, single-use value and stores it. Without it, one captured signature can be replayed forever.

  • Server-side verification. The signature is checked on the server. A check that runs only in the browser can be skipped by anyone who controls the browser, which is everyone.

  • Recover, then compare. On Ethereum, the server recovers the signing address from the signature and compares it to the claimed one. A signature that is merely "valid" proves nothing until it is tied to the address making the claim.

  • Domain binding. The message names the site and the purpose. Otherwise a signature collected by one site can be presented to another.

  • Chain ID. The signed payload is bound to the network it was issued on. Without it, a signature from one chain can be replayed on another.

  • Expiry. The nonce is valid for minutes, not days. A request signed now must not be usable later.

  • Burn on use. The nonce is invalidated the moment it is consumed, whether verification succeeds or fails.

We bound the chain ID into every signed payload and checked it on the server, so a signature from one network could not be replayed on another.

On Ethereum, personal_sign (EIP-191) adds a fixed prefix before signing so a signed message can never be passed off as a transaction. EIP-712 signs typed, structured data with a domain, and wallets show it field by field. Sign-In with Ethereum (EIP-4361) standardises the login message itself.

This system verified EOA signatures only. Smart-contract wallets cannot produce a plain key signature and need on-chain verification through ERC-1271. That was out of scope this time and is a separate case.

The Cardano detail most people miss

On Cardano an address is not the public key. It contains a hash of the key. When a wallet signs through the CIP-30 signData call, it returns a COSE signature (CIP-8) together with the public key it used.

So there are two checks, not one. The signature has to verify against that public key, and that public key has to hash to the payment credential inside the claimed address. Skip the second check and an attacker can sign with any key they own and attach your address to it. The signature verifies. The proof is worthless.

We always ran both checks on the server. The signing key's hash had to match the payment credential in the claimed address. We also stored the public key captured at signing time next to the address. It is the only moment you get that key and signature together, and it is what lets anyone prove later that this address signed these claims.

Raw payload or hash

You can give the wallet the payload as it is, or hash it and give the wallet the hash.

A raw payload is readable. The user sees what they are agreeing to. But a full set of exam answers is long, awkward in a wallet prompt and exposes more than the signing step needs.

A hash locks any amount of content into a fixed-size digest. Change one character and the hash changes. But a bare hash shown to the user is 0x3f9a...c41e. Asking someone to sign that is asking them to sign blind, and training users to sign blind is how wallet drainers make money.

We used both. The wallet signs a short, readable statement: who, what, for which course, when. One field in it is a SHA-256 hash of the answers. The answers travel to the server next to the signed statement, the server hashes them again and compares. A mismatch means the answers changed after signing, and the submission is rejected.

The advanced case: exams you can prove

The same rules carry a much heavier load in an exam system we built for a web3 learning platform.

Proof of submission. Before an exam that counts toward certification, the student signs an attestation that they will follow the rules. When they finish, they sign their submission. Both signatures travel with the answers, so every attempt carries a provable start and an untouched hand-in from that student's wallet.

The server opens every signing flow. It issues a single-use nonce bound to the course, the exam and the user, with a short expiry. On the way back it checks the signature, the key-to-address link, the nonce, the chain ID, the timestamps and the course context, then burns the nonce. Signature IDs are tracked so the same submission cannot count twice.

Proof of knowledge. When the student passes, the certificate is not the student's claim. It is the platform's and the instructor's. The certificate metadata names the platform, the instructor, the student's address, the course and the score, and its content hash is signed by both the instructor's wallet and the platform. The PDF carries that hash as its ID, and a public verify endpoint checks it.

The records sit in the platform's database. The proof does not depend on trusting that database.

Proof that survives the upgrade

A signature over data is only useful if you can verify it years later, after the code has changed.

  • Canonical serialization. The same object must always produce exactly the same string. JavaScript's JSON.stringify does not guarantee key order, and one reordered key breaks every old signature. Client and server share one serialization function.

  • A version field. Every payload records the shape it was signed in, so the schema can evolve without invalidating anything signed under the old one.

  • Store what was signed, not what you think was signed. The serialized payload, the signature, the public key and the address are stored exactly as they were at signing time. Rebuilding the message from current data later is how valid proofs become unverifiable.

Bad request, good request

You can tell a careless system from a careful one the moment the wallet prompt opens. Both examples are illustrative only, not our production payloads; all values are placeholders.

Bad: no signature at all. The site reads your address and logs you in. There is no prompt to show, which is exactly the problem.

Bad: an opaque hex blob. The user cannot know what they are approving.

text
Signature request
learn.example.com

Message:
0x7b22636f75727365223a22636f757273655f78797a222c22616e737765727322
3a5b2241222c2243222c2242225d7d

Bad: readable, but unbound. No domain, no nonce, no expiry. Sign it once and that signature works for anyone, anywhere, forever.

text
Signature request

Message:
I agree to the exam rules.

Good: readable, bound and short-lived.

text
Signature request
learn.example.com

learn.example.com wants you to sign an exam submission
with your wallet:
addr1q9...x7k2

Statement: I submit these answers as my own work and confirm
that I followed the exam rules I agreed to.

Purpose: exam-submission
Course: course_xyz
Exam: exam_abc
Answers hash (SHA-256): 3f9a...c41e
Nonce: 8Kq2Zp7Xw1Lm
Issued at: 2026-11-16T09:41:07Z
Expires at: 2026-11-16T09:46:07Z
Version: 1.0

Every line earns its place. The statement and purpose are for the user. The domain, nonce, timestamps, version and hash are what let the server refuse a replay, an expired request, a request from another site or a tampered set of answers.

A checklist for your own wallet login

If you run a wallet login, check it against this:

  1. Does the server ever verify a signature, or does it trust the address the client sends?

  2. Is the message issued by the server, with a fresh nonce, every time?

  3. Does the nonce expire in minutes and die on first use?

  4. Is the recovered address (or, on Cardano, the hashed public key) compared to the claimed address?

  5. Does the message name your domain and its purpose?

  6. Is the signature bound to a chain ID, so it cannot be replayed on another network?

  7. Could a user read the prompt and understand what they are signing?

A "no" on any of these means the login proves less than it looks like it does. A "no" on the first means it proves nothing.

What I take from it

The cryptography in a wallet is solid. It has never been the weak point. The weak point is the thin layer of application code around it, where a missing server check turns a cryptographic identity back into a public username.

We treated that layer as the real work. Before release we threat-modelled the attack vectors, closed each one, and ran a structured, near-formal verification pass against the threat model. The same rules cover login and then exams, where every answer and every certificate has to stand up to scrutiny. That is the difference between using a wallet and actually relying on one.

From the Labs by sanneh.

→ / Keep reading

More from Insights

More insights

  1. From the LabsAn Ordinary RAG Wasn't Going to Cut ItFood queries have hard constraints. Here’s how we combined vector, structural and lexical search and kept the LLM interpreter from inventing menu facts.

Begin

Bring us the hard part.

Join our Discord