---
title: Message
description: Sign off-chain messages with a configured key
source_url:
  html: https://thru.org/docs/cli-reference/message-commands/
  md: https://thru.org/docs/cli-reference/message-commands.md
---

# Message

Use `thru message sign` to sign a message that never goes on chain, for example to prove that you control an address. The signature cannot be replayed as a transaction or as any other Thru signature.

## Sign a message

```bash
thru message sign [MESSAGE] [OPTIONS]
```

**`MESSAGE` · *string***

The message as UTF-8 text, or as hex with `--hex`. Pass either `MESSAGE` or `--file`.

**`--key` · *string***

Configured key that signs the message. Defaults to `default`.

**`--file` · *path***

Read the message from a file instead: its raw bytes, or hex text with `--hex`.

**`--hex` · *boolean***

Decode the message argument or the file contents as hex. A `0x` prefix is allowed.

The message must be 1 to 32,768 bytes. The command prints the signer’s address on stderr and the `ts...` signature on stdout:

```bash
thru message sign "I control this address" --key alice
```

With `--json`, the output is a `message_sign` object with `key`, `public_key`, `signature`, `signature_hex`, `message_len`, `message_sha256`, and `domain`.

## What is signed

The signature is a standard Ed25519 signature over the 16-byte ASCII domain tag `tn_msg_sign_v1__` followed by the message bytes, with no hashing:

```plaintext
M         = "tn_msg_sign_v1__" ‖ message
signature = Ed25519_sign(secret_key, M)
```

Transactions use a different domain tag (see [Transactions](https://thru.org/docs/spec/core/transactions.md)), so a message signature never verifies as a transaction signature.

To check a signature in TypeScript, pass the raw signature (`signature_hex` in the JSON output), the message bytes, and the signer’s public key to `verifyMessage` from `@thru/sdk`. It returns `true` for a valid signature:

```ts
import { verifyMessage } from "@thru/sdk";
import { decodeAddress } from "@thru/sdk/helpers";

// `out` is the `message_sign` object from `thru --json message sign ...`
const valid = await verifyMessage(
  Uint8Array.from(Buffer.from(out.signature_hex, "hex")),
  new TextEncoder().encode("I control this address"),
  decodeAddress(out.public_key),
);
```
