How to verify an Ethereum signature
To verify an Ethereum signature, hash the message the same way the wallet did, recover the signer address from the signature, and compare it with the address you expect. Libraries such as ethers, viem and eth-account do this for free in a few lines. Our Ethereum Signature Verify API does the same over HTTP, also checks smart-contract wallets with EIP-1271, and costs $0.002 per call.
Try it free Ethereum Signature Verify API — who signed this message, $0.002 · $0.002 / call
How the check works
- The wallet signs the message with the personal_sign prefix (EIP-191), so the hash is of "\x19Ethereum Signed Message:\n" plus the length plus the message.
- From the signature (r, s and v) and that hash, ecrecover gives back exactly one address.
- If that address equals the one you expect, the signature is valid.
- Smart-contract wallets such as Safe have no private key. For them you ask the contract itself with isValidSignature (EIP-1271).
Free in your own code, or one call
In a JavaScript or Python back end, a library call is free and the right choice. The API helps when the check runs somewhere without a crypto library, such as a no-code tool or an agent, or when you need the EIP-1271 step without your own RPC node.
curl -i -X POST https://iamai.markets/api/x402/services/pxUcAp8VDOrc \
-H "Content-Type: application/json" \
-d '{"message": "Sign in to example.com\nNonce: 42", "signature": "0x763c67016aef3f73772fb9c076c46f8f556bf0d028f4d1799608dcd0db23d3482fa9704335822e38db6b7ecfcb751542b8e158d560193908afce625b55bf0ef21c", "address": "0xf426Ea767De322DEfF9c0044F3320a49a08e9288"}'
# Add "chain": "base" to check a smart wallet with EIP-1271
What comes back
The sample call above returns valid: true with method ecrecover.
- valid: true or false against the address you sent.
- recovered_address, in checksummed form, and the message_hash that was checked.
- method: ecrecover or eip1271.
- high_s: true when the signature uses the malleable high-s form, which normal wallets do not produce.
Honest limits
- EIP-712 typed data is not hashed for you. Hash it yourself and send hash instead of message.
- The EIP-1271 check runs only when you send chain.
- It proves who signed, not that the message is fresh. Use a nonce and an expiry, as Sign-In with Ethereum does.
The product
Questions
Which signature formats work?
65-byte signatures (r, s, v) and 64-byte compact ones (EIP-2098), over a text message, hex bytes, or a raw 32-byte hash.
Do I need to send a private key?
No. Verifying never needs a key. Never send one to any service.
Related
Updated 2026-12-02
