Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

Setting Up Multi-Party Computation (MPC) Key Management

A technical tutorial for developers on implementing MPC-based key management to eliminate single points of failure in institutional custody.
Chainscore © 2026
introduction
SECURITY

Introduction to MPC for Key Management

Multi-Party Computation (MPC) is a cryptographic technique that distributes a private key among multiple parties, eliminating single points of failure for enhanced security.

Traditional private key management presents a critical vulnerability: a single point of failure. If a seed phrase or hardware wallet is compromised, funds are lost. Multi-Party Computation (MPC) solves this by splitting a private key into multiple secret shares, distributed among different devices or parties. No single party ever has access to the complete key. Cryptographic protocols like Shamir's Secret Sharing (SSS) or threshold signatures (t-of-n) enable the key to be used for signing transactions only when a pre-defined threshold of parties (e.g., 2-of-3) collaborate, without ever reconstructing the full key in one place.

Setting up an MPC wallet involves generating these secret shares in a secure, distributed manner. For a 2-of-3 setup, three key shares are created on separate, air-gapped devices during an initialization ceremony. The process uses secure multi-party computation protocols to ensure that even the devices generating the shares never learn the others' data. Popular libraries for developers include ZenGo's kms-ecdsa and TSS (Threshold Signature Scheme) libraries from Binance or Coinbase. The security of the entire system hinges on this initial setup being performed in a trusted environment.

For developers, implementing MPC requires choosing a signature scheme like ECDSA or EdDSA, and a threshold scheme like Feldman's Verifiable Secret Sharing. A basic conceptual flow involves: 1) Distributed Key Generation (DKG), 2) Creating signature shares for a transaction, and 3) Combining shares into a valid signature. Below is a simplified pseudo-code structure using a hypothetical mpc-lib.

javascript
// Pseudo-code for MPC signing flow
const { Keygen, Sign } = require('mpc-lib');
// 1. Distributed Key Generation (2-of-3)
const party1Shares = Keygen.createShare(1, 3);
const party2Shares = Keygen.createShare(2, 3);
const party3Shares = Keygen.createShare(3, 3);
// 2. Parties sign locally with their share
const sigShare1 = Sign.partialSign(party1Share, transactionHash);
// 3. Combine any 2 signature shares
const finalSig = Sign.combine([sigShare1, sigShare2]);

The primary advantage of MPC over multisig wallets is privacy and interoperability. An MPC wallet generates a single standard blockchain address (like a 0x... or bc1... address), unlike multisig which creates a custom, on-chain smart contract. This makes MPC transactions cheaper, faster, and indistinguishable from regular transactions, while providing superior custody security. It's the technology underpinning institutional custodians like Fireblocks and Coinbase Prime.

When implementing MPC, critical considerations include the communication layer between parties (requiring a secure, authenticated channel), protection against malicious actors during the protocol (achieved through verifiable secret sharing), and key refresh protocols to proactively update shares without changing the public address. For production systems, auditing the cryptographic implementation and using battle-tested libraries is non-negotiable.

MPC is becoming the standard for secure digital asset management, balancing unparalleled security with practical usability. For teams managing treasury wallets or developers building secure onboarding flows, understanding MPC setup is essential. Further resources include the MPC Alliance whitepapers and the IETF draft standards for Threshold Cryptography.

prerequisites
MPC KEY MANAGEMENT

Prerequisites and System Requirements

Before implementing a Multi-Party Computation (MPC) wallet, ensure your development environment meets the necessary technical and security standards.

A foundational understanding of cryptographic primitives is essential. You should be familiar with concepts like Elliptic Curve Cryptography (ECC), specifically the secp256k1 curve used by Ethereum and Bitcoin, and threshold signature schemes (TSS). Knowledge of how traditional public/private key pairs differ from MPC's distributed key generation (DKG) and signing is crucial. Familiarity with a programming language like Go, Rust, or TypeScript is required, as most production-grade MPC libraries are written in these languages for performance and security.

Your system must provide a secure, isolated execution environment. For local development, this means using a hardware security module (HSM) emulator or a trusted execution environment (TEE) like Intel SGX for critical operations. In production, actual HSMs (e.g., from AWS CloudHSM, Google Cloud HSM, or YubiHSM) are non-negotiable for safeguarding the master secret shares. Network infrastructure must support secure, authenticated communication channels (TLS 1.3+) between all participating parties or nodes to prevent man-in-the-middle attacks during the DKG and signing phases.

You will need to select and integrate a robust MPC protocol library. For Ethereum and EVM chains, consider ZenGo's multi-party-ecdsa (written in Rust) or Fireblocks' MPC-CMP implementation. For a more generalized approach, LibTSS or MP-SPDZ provide frameworks for various schemes. Ensure your chosen library is actively maintained and has undergone third-party security audits. The development environment should include tools for deterministic build processes and reproducible builds to verify the integrity of the cryptographic code.

Establish a rigorous key lifecycle management policy from the start. Define clear procedures for key generation (DKG ceremony), rotation, backup of secret shares using techniques like Shamir's Secret Sharing, and secure deletion. Your architecture must account for the signing quorum (e.g., 2-of-3), specifying which parties are required to authorize a transaction. Plan for latency tolerance, as MPC signing involves multiple network rounds; this is critical for time-sensitive DeFi transactions.

Finally, prepare for comprehensive testing. Beyond unit tests, you must implement integration tests that simulate the entire multi-party network, including failure scenarios like node dropout or malicious behavior. Penetration testing and formal verification of the cryptographic implementation are highly recommended before moving to mainnet. Set up monitoring for signing latency, error rates, and protocol deviations to ensure operational reliability and security.

key-concepts-text
CORE CRYPTOGRAPHIC CONCEPTS

Setting Up Multi-Party Computation (MPC) Key Management

Multi-Party Computation (MPC) enables secure key management by distributing cryptographic operations across multiple parties, eliminating single points of failure. This guide explains how to implement a basic threshold signature scheme (TSS) for wallet security.

Multi-Party Computation (MPC) is a cryptographic protocol that allows a group of parties to jointly compute a function over their private inputs without revealing those inputs to each other. In the context of key management, this means a private key is never fully assembled in one location. Instead, it is split into secret shares distributed among multiple participants (e.g., different devices or servers). A transaction can only be signed when a pre-defined threshold (e.g., 2 out of 3) of these parties collaborate, using advanced algorithms like Shamir's Secret Sharing (SSS) or more efficient threshold ECDSA schemes. This fundamentally improves security over traditional single-key storage or multi-signature setups.

Setting up an MPC wallet typically involves a key generation ceremony. Each participant generates their own secret share locally. Using a secure peer-to-peer communication channel, they engage in a distributed key generation (DKG) protocol to collectively derive a public key without any single entity ever knowing the full private key. Libraries like ZenGo's KZen (for ECDSA) or MPC-based SDKs from Fireblocks or Coinbase abstract this complexity. The resulting public address is usable like any other, but signing requires coordination. For developers, integrating with an MPC service provider's API is the most practical approach, as implementing secure DKG from scratch carries significant risk.

The signing process demonstrates MPC's power. To sign a transaction, the required threshold of participants (say, 2 out of 3) each use their secret share to compute a partial signature. These partial signatures are exchanged and combined to produce a single, valid ECDSA signature that can be verified on-chain against the original group's public key. Critically, the combined secret key is never reconstructed. This process, often called threshold signature scheme (TSS), provides resilience: losing one share doesn't compromise the wallet, and compromising fewer than the threshold number of shares reveals nothing about the key.

When implementing MPC, key refresh protocols are essential for long-term security. These protocols allow the group to generate new secret shares from the existing ones without changing the underlying public key and address. This proactively mitigates the risk of share leakage over time. Furthermore, malicious participant detection mechanisms within advanced MPC protocols can identify and exclude parties acting dishonestly during the signing ceremony. For production systems, choosing between honest-majority and dishonest-majority security models is crucial, as they offer different trade-offs between robustness and trust assumptions.

Practical use cases for MPC key management extend beyond individual wallets. Institutional custody services use it to enforce governance policies across departments. DeFi protocols can manage treasury funds with distributed signer sets. Blockchain validators can secure their signing keys against single-server compromise. When evaluating solutions, consider the underlying cryptographic library's audits, the network communication security (often using authenticated channels), and the recovery mechanisms for lost shares, which typically involve generating a new wallet with a fresh set of participants.

architecture-components
MPC KEY MANAGEMENT

System Architecture and Components

Multi-Party Computation (MPC) distributes private key control across multiple parties, eliminating single points of failure. This section covers the core components and tools for building secure MPC systems.

06

Auditing and Monitoring

A robust MPC system requires comprehensive observability. This involves:

  • Logging all signing requests, participant actions, and protocol errors without exposing secret material.
  • Monitoring node health, latency, and participation rates.
  • Alerting for failed signing rounds or nodes falling below the threshold.
  • Regular security audits of the cryptographic implementation and network setup by firms like Trail of Bits or Kudelski Security. Continuous monitoring is essential to detect and respond to operational or security issues.
step-dkg-implementation
MPC KEY MANAGEMENT

Step 1: Implement Distributed Key Generation (DKG)

Distributed Key Generation (DKG) is the foundational protocol for creating a shared private key across multiple parties without any single entity ever knowing the complete secret.

In a Multi-Party Computation (MPC) wallet setup, Distributed Key Generation (DKG) is the initial ceremony where n participants collaboratively generate a single public key and corresponding secret shares. Crucially, the full private key is never assembled in one place. Each party i ends up with a secret share s_i and the common public key P. This process establishes the trust model: the wallet's security now depends on a threshold t (e.g., 2-of-3) of participants cooperating, eliminating any single point of failure. Protocols like Pedersen's DKG or Gennaro et al.'s protocol are commonly used for their verifiable and robust properties.

A typical DKG protocol involves several rounds of communication. First, each party generates a local secret and commits to it. They then broadcast encrypted shares of their secret to all other participants. Finally, parties verify the shares they receive for correctness. If a party broadcasts invalid data, they are disqualified. This verification ensures that all honest participants agree on the same public key and that their secret shares are consistent. The result is a threshold public key that can be used for signing, while the corresponding private key exists only as mathematical fragments distributed among the participants.

Implementing DKG requires a secure networking layer. Parties must communicate over authenticated channels (e.g., using TLS or peer-to-peer signatures) to prevent man-in-the-middle attacks. Libraries like ZenGo-X's multi-party-ecdsa or KZen Networks' libraries provide production-tested implementations. Below is a conceptual outline for a 2-of-3 setup using elliptic curve cryptography:

javascript
// Pseudocode for participant's role in DKG
const mySecretShare = generateRandomScalar();
const myPublicShare = G * mySecretShare; // G is the curve's generator point
broadcastCommitment(hash(myPublicShare));
// Exchange and verify shares from other parties...
const jointPublicKey = aggregatePublicShares(allPublicShares);

Security considerations are paramount. The protocol must be proactive, allowing for periodic share refreshment to compromise long-term key security. It must also be robust, functioning correctly even if some participants (n-t) are malicious or offline. Auditing the DKG implementation is critical, as flaws here compromise the entire system. For blockchain applications, the generated public address is your wallet's address. Once DKG is complete, you can proceed to threshold signing, where signatures are collaboratively generated using the secret shares, never reconstructing the full key.

step-signing-protocol
MPC KEY MANAGEMENT

Step 2: Build the Threshold Signing Protocol

This section details the core cryptographic protocol for generating and managing a distributed private key, enabling secure multi-party signing without a single point of failure.

A Threshold Signature Scheme (TSS) is the cryptographic engine of MPC wallets. Unlike traditional multi-signature schemes that produce multiple signatures on-chain, TSS generates a single, standard-looking signature (e.g., ECDSA for Ethereum) from multiple secret shares. No single party ever reconstructs the full private key. The protocol is defined by parameters (t, n), where n is the total number of parties (key shard holders) and t is the threshold required to sign. Common configurations are (2,3) or (3,5). This setup provides resilience against key loss (you need only t of n shares) and security against compromise (an attacker needs t shares).

The process begins with a Distributed Key Generation (DKG) ceremony. Each participant, such as a user's devices or trusted nodes, locally generates a secret share. Through a secure multi-party computation protocol, they collaboratively compute the corresponding public key without revealing their individual shares. The public key is then the wallet's address. Libraries like ZenGo's tss-lib (for ECDSA/EdDSA) or Binance's tss-lib provide battle-tested implementations. A critical output of DKG is the generation of encrypted backup data, often called key_share_backup, which is securely stored by each party to allow for future resharing or recovery.

When a transaction needs to be signed, at least t participants initiate a signing protocol. Each party uses their secret share to compute a partial signature. These partials are exchanged and combined using Lagrange interpolation within the secure MPC protocol to produce the final, valid signature. Importantly, the secret shares are never combined; the math ensures the final signature is correct even though the full key remains distributed. This process involves multiple rounds of communication, so a reliable message transport layer (e.g., using WebSockets or a relay server) between parties is essential for the protocol to complete.

Implementing the network layer requires careful error handling. You must manage scenarios like party dropouts during signing. Robust implementations use asynchronous protocols and can proceed as long as t parties remain online. Furthermore, you must implement pre-signing or signature caching for applications requiring high-speed signing, as the MPC rounds introduce latency. Security audits of this component are non-negotiable, as flaws in the cryptographic implementation or communication layer can lead to key leakage.

For developers, integrating TSS typically means running a client library on each device/node. A common architecture involves a frontend client (like a browser extension) coordinating with backend signing servers or other user devices. The code snippet below illustrates a simplified initialization using a hypothetical TSS library:

javascript
import { DKGClient } from 'tss-lib-ecdsa';

// Initialize a participant for a (2,3) scheme
const participant = new DKGClient({
  partyIndex: 1, // Unique ID for this party (0-indexed)
  threshold: 2,
  partyCount: 3,
  messageTransport: myWebSocketTransport // Handles P2P messages
});

// Start the distributed key generation ceremony
const { publicKey, secretShareBackup } = await participant.startCeremony(partyPublicKeys);
console.log('Generated Public Address:', publicKey);

Finally, establish a key refresh protocol. Periodically, participants can run a resharing protocol to generate new secret shares from the old ones, invalidating previous shares. This proactively mitigates the risk of share compromise over time. The entire system's security rests on the integrity of the t-of-n assumption and the isolation of the signing environment on each device, often secured by hardware enclaves like Intel SGX or Apple's Secure Enclave for mobile implementations.

step-secure-enclave-integration
MPC KEY MANAGEMENT

Step 3: Integrate with Secure Enclaves

This guide details how to implement Multi-Party Computation (MPC) for private key management using secure enclaves, a critical step for building non-custodial wallets and institutional-grade custody solutions.

Multi-Party Computation (MPC) is a cryptographic technique that allows a group of parties to jointly compute a function over their private inputs without revealing those inputs to each other. In the context of key management, this means a private key is never stored in one place. Instead, it is split into multiple secret shares, each held by a different party or device. A transaction can only be signed when a pre-defined threshold of these shares (e.g., 2 out of 3) collaborate to produce a valid signature. This eliminates the single point of failure inherent in traditional private key storage.

Secure enclaves provide the ideal environment for generating and operating on these secret shares. An enclave is a hardware-isolated, trusted execution environment (TEE) within a processor, such as Intel SGX or Apple's Secure Enclave. Code and data inside an enclave are protected from the host operating system and other processes, even with root access. By running the MPC signing protocol inside separate, attested enclaves, you ensure that each secret share is never exposed in plaintext in memory, dramatically reducing the attack surface compared to software-only MPC implementations.

The integration workflow typically follows these steps. First, you initialize the MPC protocol by having each participant's enclave generate its own secret share. The combined public key is derived from all shares. Second, for signing, the transaction data is sent to the required threshold of enclaves. Each enclave computes a partial signature using its secret share and returns it. Finally, these partial signatures are combined (often by a coordinator service) to produce the final, valid ECDSA or EdDSA signature that can be broadcast to the network.

For developers, libraries like ZenGo's multi-party-ecdsa or protocols like GG18/GG20 provide the core cryptographic primitives. A basic conceptual flow in pseudocode involves: key_share = enclave_generate_share(); public_key = combine_public_shares([share1, share2, share3]); partial_sig = enclave_sign_partial(transaction_hash, key_share); final_sig = combine_signatures([partial_sig1, partial_sig2]);. The actual implementation requires careful handling of network communication and attestation between enclaves.

Key considerations for production systems include enclave attestation (verifying the remote enclave is genuine), secure communication channels between parties, and managing the lifecycle of secret shares (e.g., rotation, backup). While MPC with enclaves significantly boosts security, it introduces complexity in coordination and potentially higher latency for signing operations. This trade-off is essential for applications managing high-value assets where the risk of a single key compromise is unacceptable.

KEY MANAGEMENT

MPC vs. Traditional Multi-Signature Comparison

A technical comparison of threshold signature schemes (MPC-TSS) and traditional multi-signature (multisig) wallets for securing digital assets.

Feature / MetricMPC (Threshold Signature Scheme)Traditional Multi-Signature

Signature Generation

Single, aggregated signature on-chain

N distinct signatures on-chain

On-Chain Privacy

Hides participant count and identities

Reveals participant addresses and threshold

Gas Cost (ETH Transfer)

~21,000 gas (standard tx)

~65,000 - 100,000+ gas

Key Storage

Distributed secret shares; no single private key

N distinct private keys

Signing Ceremony

Off-chain computation between parties

Sequential or parallel on-chain approval

Upgrade Flexibility

Can refresh/rotate shares without changing address

Requires new wallet deployment for changes

Smart Contract Support

Compatible with all chains (EVM, non-EVM)

Limited by native multisig opcodes (e.g., CHECKMULTISIG)

Institutional Adoption

Fireblocks, Coinbase Custody, Qredo

Gnosis Safe, Safe{Wallet}

Protocol Examples

GG18, GG20, CMP, FROST

P2SH (Bitcoin), Gnosis Safe, native multisig

workflow-integration
MPC KEY MANAGEMENT

Step 4: Integrate with Transaction Workflows

This guide explains how to integrate Multi-Party Computation (MPC) key management into your application's transaction signing flow, covering signature generation, user experience, and security best practices.

After generating a distributed key, the next step is to use it for signing transactions. In an MPC setup, signing is a collaborative protocol between the user's client (e.g., a browser or mobile app) and the MPC service provider. The process never reconstructs the full private key. Instead, each party uses their key share to generate a partial signature. These partial signatures are then combined mathematically to produce a single, valid ECDSA or EdDSA signature that can be broadcast to the blockchain. This is often called threshold signing, where a predefined number of parties (e.g., 2-of-2) must participate.

The integration typically involves a client-side SDK from your MPC provider. For a web application, you would install a package like @turnkey/sdk or @web3auth/mpc-core-sdk. The workflow is: 1) The app creates an unsigned transaction object. 2) It calls the SDK's signTransaction method, which communicates with the MPC service's API. 3) The user authenticates (often via a passkey or biometrics) to authorize their local key share's participation. 4) The SDK and service exchange messages to create and combine partial signatures, returning the final signed transaction ready for broadcasting via an RPC provider.

A critical design consideration is managing the signing latency introduced by the network round-trips between client and server. For optimal user experience, implement optimistic UI updates while the asynchronous signing process completes. Security-wise, your application must verify the transaction details (like recipient address and amount) with the user before initiating the MPC signing protocol. This is often done with a confirmation modal. Never send raw private key shares over the network; reputable MPC protocols use secure enclaves and zero-knowledge proofs to ensure share privacy during the signing ceremony.

For developers, here is a conceptual code snippet for a simple Ethereum transaction using a hypothetical MPC SDK:

javascript
// 1. Create transaction payload
const txPayload = {
  to: '0x...',
  value: ethers.parseEther('0.1'),
  gasLimit: 21000,
};
// 2. Initiate MPC signing
const signedTx = await mpcClient.signTransaction({
  walletId: 'your-mpc-wallet-id',
  transaction: txPayload,
});// 3. Broadcast
const txHash = await provider.sendTransaction(signedTx);

The SDK handles the underlying multi-round protocol, authentication, and partial signature combination.

Finally, integrate comprehensive error handling for scenarios like network timeouts, user rejection, or insufficient gas. Log signing events for audit purposes but ensure no sensitive key material is recorded. By embedding MPC signing into your transaction workflow, you maintain a non-custodial model where users control authorization, while eliminating the risks of single-point-of-failure private key storage. The next step is to implement recovery mechanisms in case a user loses access to their device or authentication method.

MPC KEY MANAGEMENT

Frequently Asked Questions (FAQ)

Common questions and troubleshooting for developers implementing Multi-Party Computation (MPC) wallets and key management systems.

While both enhance security by distributing control, they operate on fundamentally different cryptographic principles.

MPC (Multi-Party Computation) generates a single private key that is mathematically split into multiple secret shares, held by different parties or devices. Signing a transaction requires collaboration to compute a signature without ever reconstructing the full key on a single machine. This results in a single on-chain signature, similar to a regular wallet.

Multisig wallets (like Gnosis Safe) use multiple distinct private keys, each controlling a separate on-chain address. A transaction requires a predefined number of valid signatures (e.g., 2-of-3) to be submitted and verified on-chain.

Key difference: MPC's security is off-chain/cryptographic (no single point of failure), while multisig's security is on-chain/contract-based (reliant on smart contract audits). MPC often has lower gas costs as it produces one signature.

conclusion-next-steps
MPC KEY MANAGEMENT

Conclusion and Security Best Practices

Implementing MPC is a significant step toward secure key management, but its security is only as strong as its configuration and operational practices.

A robust MPC setup requires careful consideration of the signing quorum. This defines the minimum number of parties required to authorize a transaction. For a 2-of-3 configuration, losing one key share does not compromise the wallet, but losing two does. The quorum should balance security against operational resilience; a 3-of-5 setup is common for high-value institutional wallets, providing fault tolerance for two lost or compromised shares while maintaining strong security guarantees.

The security of the entire system depends on the secure generation and storage of key shares. Each share must be generated in a trusted execution environment (TEE) or on an air-gapped device to prevent exposure. Shares should never be transmitted over the network in plaintext. Standard practice involves encrypting each share with its party's independent secret (like a hardware security module key) before storage. Regular key share rotation procedures should be established to limit the blast radius of a potential long-term compromise.

Operational security is critical. Establish clear governance policies for signing operations, including transaction validation checklists and multi-party approval workflows. All signing sessions should produce auditable logs without revealing the private shares. Furthermore, integrate rate limiting and transaction simulation (using tools like Tenderly or OpenZeppelin Defender) before signing to prevent malicious or erroneous transactions from being approved by the quorum.

Finally, treat your MPC library or service provider as a critical dependency. For self-hosted solutions like libmpc, maintain a process for applying security patches. When using a provider like Fireblocks, Coinbase Prime, or Safeheron, verify their security attestations (SOC 2 Type II, ISO 27001) and understand their fault-tolerant architecture. Always maintain an incident response plan specific to MPC, detailing steps for share revocation, quorum reconfiguration, and fund migration in case of a suspected breach.

How to Implement MPC for Institutional Key Management | ChainScore Guides