> ## Documentation Index
> Fetch the complete documentation index at: https://docs.startale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# personal_sign

> Sign a plain string with the user's smart account.

Produces an ERC-1271-compatible signature over a plain message.

## Request

```ts theme={null}
import { stringToHex } from 'viem'

const signature = await provider.request<`0x${string}`>({
  method: 'personal_sign',
  params: [stringToHex('I acknowledge the terms.'), address],
})
```

## Parameters

<ParamField path="params[0]" type="`0x${string}`" required>
  Hex-encoded message bytes.
</ParamField>

<ParamField path="params[1]" type="`0x${string}`" required>
  Smart-account address. Must match the connected account.
</ParamField>

## Returns

`0x${string}`, the signature, packed for ERC-1271 verification.

## Errors

| Code   | Cause                       |
| ------ | --------------------------- |
| `4001` | User rejected the signature |
| `4100` | Wallet not connected        |

## Verification

```ts theme={null}
import { publicClient } from './viem'

const isValid = await publicClient.verifyMessage({
  address,
  message: 'I acknowledge the terms.',
  signature,
})
```

viem handles ERC-1271 (and ERC-6492 for undeployed accounts) automatically.

## Related

* [`eth_signTypedData_v4`](/api-reference/rpc-methods/eth-sign-typed-data-v4), for structured data.
* [Sign messages](/app-sdk/sign-messages)
