# 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'
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tutorial.neoline.io/reference/neo3-provider-api/signmessage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
