Skip to content

Components

Sign Message

Asks the wallet to sign a message or typed data, with labeled steps and optional verification.

For sign-in flows, off-chain orders, and proving ownership of an address. It signs plain messages (EIP-191) or typed data (EIP-712), labels each step, and can check the signature against the connected address.

Connect the Demo Wallet to try it. Demo signatures come from a throwaway key, so they wouldn’t verify against the demo address.

Sign in to 0xui docs

This request will not trigger a transaction or cost any gas.

Terminal window
npx shadcn@latest add @0xui/sign-message
import { SignMessage } from "@/components/sign-message";
<SignMessage
message="Sign in to Example"
verify
onSigned={(signature) => login(address, signature)}
>
Sign in
</SignMessage>;

Verification goes through the RPC, so smart-contract wallets (ERC-1271 and ERC-6492) verify too. It’s a convenience for the UI: always verify again on your server before trusting a signature.

For a full sign-in flow with a nonce, a server check and a session, see Sign in with Ethereum.

{
  "amount": "100",
  "token": "USDC"
}

<SignMessage typedData={{ domain, types, primaryType: "Order", message }} />
data-phase Button
idle Your label, or “Connect wallet”
signing Spinner, “Sign in wallet…”
verifying Spinner, “Verifying…”
signed Check, “Signed” or “Signature verified”
invalid Alert: the signature doesn’t match the connected address.
cancelled “Cancelled in wallet.” Not an error.
error Alert with the wallet’s message.

Also accepts shadcn Button props.

Prop Type Default Description
message string | { raw: Hex } — Message to sign. Pass this or typedData.
typedData TypedDataDefinition — EIP-712 payload.
verify boolean false Check the signature after signing.
onSigned (signature) => void — Called with the signature.
showMessage boolean false Show what is being signed.
showSignature boolean false Show the signature with copy.
children ReactNode "Sign message" Label.
agentConfirm string | false label + what it does Sets data-agent-confirm, so browser agents ask a person first. false drops it.

Headless: useSignFlow(request, { verify }).