> For the complete documentation index, see [llms.txt](https://tutorial.neoline.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tutorial.neoline.io/reference/neo3-provider-api/signmessage.md).

# signMessage

Signs a message with a wallet account using ECDSA with SHA-256.

## Parameters

#### 1. message *(required)*

`string | Base64Encoded`

The message to sign.

#### 2. account *(optional)*

`UInt160`

The account script hash to sign with. If omitted, the wallet may select or prompt for an account.

#### 3. options *(optional)*

`SignOptions`

```ts
type SignOptions = {
  isBase64Encoded?: boolean;
  isTypedData?: boolean;
  isLedgerCompatible?: boolean;
};
```

## Returns

`Promise<SignedMessage>`

```ts
type SignedMessage = {
  payload: Base64Encoded;
  signature: Base64Encoded;
  account: UInt160;
  pubkey: ECPoint;
};
```

## Errors

| Code    | Name       | Description                                    |
| ------- | ---------- | ---------------------------------------------- |
| `10002` | `INVALID`  | The message or options are invalid.            |
| `10003` | `NOTFOUND` | The specified signing account cannot be found. |
| `10005` | `TIMEOUT`  | The signing request timed out.                 |
| `10006` | `CANCELED` | The user rejected the signature request.       |

## Example

### Request

```js
const signedMessage = await provider.signMessage(
  "Hello from NEP-21",
  "0x9a7c5085dcdd4adf9ec12f2d1a7d6b741ad4b20a",
  {
    isBase64Encoded: false,
    isTypedData: false,
    isLedgerCompatible: false,
  },
);
```

### Response

```js
{
  payload: 'Hello from NEP-21',
  signature: 'b8VsKY1ih+qMxgqHrRtg80AXzke2edJFNOKJG22hY0NBjLH14BVcWinqbfQjpr0wVbnFEI31fMfsfN+kUdfTrQ==',
  account: '9a7c5085dcdd4adf9ec12f2d1a7d6b741ad4b20a',
  pubkey: '02264f44fe848a87c1324c87ddb17b2acdda9d79bc00f9549dc2293064c3c07e5f'
}
```
