Type Definition

type ServerKeyShare = 
  | EcdsaKeygenResult
  | Ed25519KeygenResult
  | BIP340KeygenResult;

Description

ServerKeyShare is a union type that represents different types of key shares used in Multi-Party Computation (MPC) operations. The specific type depends on the signing algorithm used by the blockchain:
  • EVM chains: Use EcdsaKeygenResult (ECDSA signing)
  • Solana: Use Ed25519KeygenResult (Ed25519 signing)
  • Bitcoin: Use BIP340KeygenResult (BIP340/Schnorr signing)

Key Share Types

EcdsaKeygenResult

Used for EVM chains (Ethereum, Polygon, etc.)
interface EcdsaKeygenResult {
  pubkey: EcdsaPublicKey;
  secretShare: string;
}

Ed25519KeygenResult

Used for Solana and other Ed25519-based chains
interface Ed25519KeygenResult {
  pubkey: Uint8Array;
  secretShare: string;
}

BIP340KeygenResult

Used for Bitcoin and BIP340/Schnorr-based chains
interface BIP340KeygenResult {
  pubkey: Uint8Array;
  secretShare: string;
}

Example

import { ServerKeyShare } from '@dynamic-labs-wallet/node';

// EVM key share
const evmKeyShare: ServerKeyShare = {
  pubkey: {
    x: '0x1234567890abcdef...',
    y: '0xfedcba0987654321...'
  },
  secretShare: '0xabcdef1234567890...'
};

// Solana key share
const solanaKeyShare: ServerKeyShare = {
  pubkey: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]),
  secretShare: 'base64-encoded-secret-share'
};

Usage

Server key shares are used in various MPC operations:
  • Wallet creation: Generated during key generation ceremony
  • Message signing: Used to create signatures
  • Transaction signing: Used to sign transactions
  • Key backup: Stored securely for wallet recovery