Sign messages

This guide will teach you how to sign messages using your Smart Wallet. Message signing is a key feature that allows users to authenticate and prove ownership of their wallet without spending gas.

Smart Wallets will generate signatures that can be validated using ERC-1271. If the wallet is an undeployed smart contract account (also known as a counterfactual address), then the signature will be wrapped according to ERC-6492.

Prerequisites

  • API key from your dashboard
  • A Smart Wallet with an associated signer

What is message signing?

Message signing allows users to:

  • Authenticate without spending gas
  • Prove ownership of their wallet
  • Sign arbitrary data for offchain verification
  • Interact with dApps that require signature-based authentication

Smart Wallets support EIP-191 message signing, which is the standard for Ethereum message signing. You may also see EIP-191 referred to as the personal_sign message format.

Text messages

Required SDK version: ^v4.59.1

See the signMessage SDK reference for full descriptions of the parameters used in the following example.

1import { client } from "./client";
2
3// Sign a simple text message
4const textSignature = await client.signMessage({
5 message: "Hello, world!",
6});
7
8console.log("Signature over text:", textSignature);

Raw hex messages

Required SDK version: ^v4.59.1

See the signMessage SDK reference for full descriptions of the parameters used in the following example.

1import { client } from "./client";
2
3// Sign a raw hex message
4const rawSignature = await client.signMessage({
5 message: {
6 raw: "0x48656c6c6f2c20776f726c6421", // "Hello, world!" in hex
7 },
8});
9
10console.log("Signature over raw data:", rawSignature);

Next steps

Build more:

Troubleshooting: