Raw Tx Signing

Use rawSign() to generate MPC signatures for arbitrary data, authentication challenges, and custom protocols without blockchain-specific transaction handling.

rawSign() signs an arbitrary hex digest directly with a specified curve. There is no chain context, no RPC call, and no transaction broadcasting — just a pure MPC signature over the bytes you provide.

When to Use

  • Authentication challenges (sign a nonce to prove wallet ownership)
  • Custom off-chain protocols
  • Integrating with systems that handle their own transaction construction and broadcast
  • Signing data that doesn't fit any standard RPC method

Usage

const result = await client.rawSign({
  path: { curve: "SECP256K1" },
  body: {
    params: "7369676e207468697320636f6e74656e74", // hex-encoded message, no 0x prefix
    share: shares.SECP256K1.share,
  },
});

console.log(result.data); // hex signature

For ED25519:

const result = await client.rawSign({
  path: { curve: "ED25519" },
  body: {
    params: "7369676e207468697320636f6e74656e74",
    share: shares.ED25519.share,
  },
});

Parameters

ParameterLocationTypeDescription
curvepath"SECP256K1" | "ED25519"The curve to sign with
paramsbodystringHex-encoded digest to sign (no 0x prefix)
sharebodystringMPC share for the specified curve

Encoding the Message

The message must be a hex string without a 0x prefix:

function toHex(str: string): string {
  return Buffer.from(str, "utf8").toString("hex");
}

const challenge = "Please sign this nonce: 8f3a2b1c";
const hexChallenge = toHex(challenge);

const result = await client.rawSign({
  path: { curve: "SECP256K1" },
  body: {
    params: hexChallenge,
    share: shares.SECP256K1.share,
  },
});

Response

interface RawSignResponse {
  data: string; // hex signature
}

Differences from sign()

sign()rawSign()
Chain contextRequired (chainId)None
RPC callYes (for transaction methods)No
BroadcastYes (for eth_sendTransaction, etc.)No
InputRPC method + paramsRaw hex digest
Use caseEVM/Solana/Stellar/Tron transactions, message signingCustom protocols, auth challenges