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

# Raw Signing (EVM)

<Card title="Recommended: JavaScript SDK with React Hooks" icon="react" color="#4779FE">
  For new React apps, we recommend the JavaScript SDK with React Hooks (`@dynamic-labs-sdk/react-hooks`) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the [React quickstart (JavaScript SDK)](/javascript/reference/react-quickstart) to get started.
</Card>

Raw signing lets you sign arbitrary data with an embedded MPC wallet when you need full control over hashing and formatting. This is most useful for non-standard signing flows or chain/app-specific message formats.

<Note>
  Raw signing is currently only available for **EVM** embedded wallets.
</Note>

## Basic raw signing (hash then sign)

```typescript theme={"system"}
    import { keccak256, stringToHex } from 'viem';
    import { DynamicWaasEVMConnector } from '@dynamic-labs/sdk-react-core';

    const rawMessage = "Hello World";

    // primaryWallet should be an EVM embedded wallet
    const connector = primaryWallet.connector as DynamicWaasEVMConnector;

    // Dynamic expects the message as a hex string (no 0x) when signing a pre-hashed payload
    const hash = keccak256(stringToHex(rawMessage)).slice(2);

    const signature = await connector.signRawMessage({
      accountAddress: primaryWallet.address,
      message: hash,
    });

    console.log("Signature:", signature);
```

## Encoding options

Dynamic supports different encoding formats for your raw messages depending on what you need to hash/sign.

### Hexadecimal encoding

Most common for blockchain applications. The message is encoded as a hex string.

```typescript theme={"system"}
    import { stringToHex } from 'viem';

    const message = "Hello World";
    const hexEncoded = stringToHex(message);
    // Result: "0x48656c6c6f20576f726c64"
```

### UTF-8 text encoding

For plain text messages that don't require hex encoding.

```text theme={"system"}
Hello World
```

## Hash functions

Different hash functions serve different purposes in cryptographic signing.

### Keccak256 (Ethereum standard)

```typescript theme={"system"}
import { keccak256, stringToHex } from 'viem';

const message = "Hello World";
const hash = keccak256(stringToHex(message));
```
