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 signatureFor ED25519:
const result = await client.rawSign({
path: { curve: "ED25519" },
body: {
params: "7369676e207468697320636f6e74656e74",
share: shares.ED25519.share,
},
});Parameters
| Parameter | Location | Type | Description |
|---|---|---|---|
curve | path | "SECP256K1" | "ED25519" | The curve to sign with |
params | body | string | Hex-encoded digest to sign (no 0x prefix) |
share | body | string | MPC 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()sign() | rawSign() | |
|---|---|---|
| Chain context | Required (chainId) | None |
| RPC call | Yes (for transaction methods) | No |
| Broadcast | Yes (for eth_sendTransaction, etc.) | No |
| Input | RPC method + params | Raw hex digest |
| Use case | EVM/Solana/Stellar/Tron transactions, message signing | Custom protocols, auth challenges |