Overview
Signing is a cryptographic operation that proves ownership of a Solana account without broadcasting anything to the blockchain. You can sign arbitrary data (like authentication challenges or terms of service) to prove account ownership without sending the message to the blockchain. You can also sign transactions locally without broadcasting them. This is useful when you want to batch multiple transactions, use a custom RPC endpoint, or implement advanced transaction flows before broadcasting. This guide shows how to sign both messages and transactions using CDP React Hooks.Sign messages
UseuseSignSolanaMessage
to sign arbitrary messages. The hook takes a base64-encoded message and returns an Ed25519 signature. This is commonly used for authentication (proving you own an account) or signing terms of service. The message is never broadcast to the blockchain.
signMessage.tsx
Sign transactions (without broadcasting)
UseuseSignSolanaTransaction
to sign a transaction locally without broadcasting it. The hook takes a base64-encoded transaction and returns a signed transaction that you can broadcast yourself. This provides control over how transactions are broadcast and allows the use of a custom RPC endpoint.
signTransaction.tsx
Looking to sign and broadcast in one action? See Sending Transactions to use
useSendSolanaTransaction
, which signs and broadcasts your transaction to the network.What to read next
- Sending Transactions: Learn how to build and send Solana transactions with hooks and components
- React Hooks: Explore all available CDP hooks for embedded wallets