personal_sign
Signs an EIP-191 personal message.
Authentication Required: Yes
Request
await jaw.provider.request({
method: 'personal_sign',
params: ['0x48656c6c6f20576f726c64', '0x1234...'],
});Parameters
| Name | Type | Required | Description |
|---|---|---|---|
message | 0x${string} | Yes | Message to sign (hex encoded) |
address | 0x${string} | Yes | Address to sign with |
Example
["0x48656c6c6f20576f726c64", "0x1234567890123456789012345678901234567890"]Response
Returns the signature as a hexadecimal string.
Type: 0x${string}
Example
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1c"Behavior
- Opens popup for user approval
- Displays human-readable message to user
- Returns EIP-191 signature with "\x19Ethereum Signed Message:\n" prefix
Errors
| Code | Description |
|---|---|
| 4001 | User rejected the request |
| 4100 | Unauthorized (not authenticated) |
| -32602 | Invalid params (message not hex encoded) |
Example
import { toHex } from 'viem';
const message = 'Hello World';
const messageHex = toHex(message);
const account = '0x1234...';
const signature = await jaw.provider.request({
method: 'personal_sign',
params: [messageHex, account],
});
console.log('Signature:', signature);Related Methods
- eth_signTypedData_v4 - Sign structured data (EIP-712)
- wallet_sign - Generic signing method