Sign messages and transactions directly with Para’s 2-of-2 MPC signing infrastructure. While Para provides direct signing methods, we recommend using Web3 libraries for better type safety and functionality.

Prerequisites

Before signing messages with Para, ensure you have completed the setup and can access user wallets.

Core Signing Methods

Para provides two fundamental signing methods that power all signing operations across the SDK.

signMessage

The foundation of all Para signing operations. Signs raw bytes of any base64-encoded message using Para’s 2-of-2 MPC infrastructure.

SignMessageExample.tsx
import { useSignMessage, useWallet } from '@getpara/react-sdk';

export default function SignMessageExample() {
  const { mutateAsync: signMessageAsync } = useSignMessage();
  const { data: wallet } = useWallet();

  const handleSign = async () => {
    if (!wallet) {
      console.error('No wallet available');
      return;
    }

    // Replace with your message
    const message = "Hello, Para!";
    const messageBase64 = btoa(message);
    
    const result = await signMessageAsync({
      walletId: wallet.id,
      messageBase64
    });
    
    console.log('Signature result:', result);
  };

  return (
    <button onClick={handleSign}>Sign Message</button>
  );
}

signTransaction

Para client method for signing EVM transactions directly. Only supports RLP-encoded EVM transactions.

Use Web3 libraries like Viem or Ethers for better type safety and transaction construction. This method is for EVM chains only and does not support Solana or Cosmos transactions.

SignTransactionExample.tsx
import { useSignTransaction, useWallet } from '@getpara/react-sdk';

export default function SignTransactionExample() {
  const { mutateAsync: signTransactionAsync } = useSignTransaction();
  const { data: wallet } = useWallet();

  const handleSignTx = async () => {
    if (!wallet) {
      console.error('No wallet available');
      return;
    }

    // Replace with your RLP encoded transaction
    // Use ethers or viem to construct this properly
    const rlpEncodedTx = "0xf86c0a85046c7cfe0083016dea94d1310c1e038bc12865d3d3997275b3e4737c6302880de0b6b3a7640000801ca0f1f8e1bd0770b23de7c54c062ba7a067fa79e1b2457abbb33d1d5d3da117c5ba05d8b420ae9ee4522b061b159244653d2ba6e16cb15e250539354c3d3714ea08a";
    const rlpEncodedTxBase64 = btoa(rlpEncodedTx);
    
    const result = await signTransactionAsync({
      walletId: wallet.id,
      rlpEncodedTxBase64,
      chainId: "1" // Ethereum mainnet
    });
    
    console.log('Transaction signature:', result);
  };

  return (
    <button onClick={handleSignTx}>Sign Transaction</button>
  );
}

Understanding signMessage

Since signMessage signs raw bytes, it can sign any type of data:

  • Simple text messages
  • EVM transactions
  • Solana transactions
  • Cosmos transactions
  • Typed data (EIP-712)
  • Any arbitrary data structure

While signMessage is powerful, using Web3 libraries provides type safety, proper encoding, and chain-specific functionality.

Next Steps