Enhancing MuSig2 protocol with Klave
Technology | Published on April 30, 2025
Learn how to optimise MuSig2 multi-signature scheme with Klave's confidential computing technology.
Enhancing MuSig2 protocol with Klave
Multisignature Protocols
Multisignature (MultiSig) protocols offer enhanced collaborative control over operations. By requiring multiple signatures to authorise transactions or actions, MultiSig effectively eliminates the risks associated with single points of failure and centralised control. This approach is indispensable in high-stake environments such as financial transactions, corporate governance, digital assets, and collaborative projects where security and trust are non-negotiable.
Within the context of Web3 and blockchain technology, MultiSig has become a game-changer. It enables more democratic and transparent governance structures within decentralised autonomous organisations (DAOs) and other collaborative platforms. By mandating consensus among participants, MultiSig fosters a culture of trust and accountability, embodying the very essence of decentralisation. As digital innovation accelerates, the adoption of advanced MultiSig protocols, like MuSig2, is not just an option, but a necessity.
Key features of MultiSig2
MuSig2 is an optimised multi-signature scheme designed to significantly improve privacy, efficiency, and security in cryptographic applications. By allowing multiple participants to jointly generate a single aggregated signature, MuSig2 reduces both computational and bandwidth overhead while ensuring strong security guarantees.
MuSig2 introduces several advantages over earlier MultiSig protocols
- Faster Signing Process: MuSig2 significantly reduces the number of rounds required for key aggregation and signing. The first round of sharing public nonces can be precomputed independently of the message being signed.
- Reduced Communication: The protocol optimises the multi-party signing process by reducing the number of required interactions.
- Enhanced Privacy: The generated signature looks like a regular Schnorr signature, preserving anonymity and avoiding linkability to individual signers.
Optimising MuSig2 with Trusted Execution Environments
The integration of MuSig2 with Trusted Execution Environments (TEEs) represents a significant advancement for decentralised applications. TEEs provide isolated and secure environments for code execution, ensuring that sensitive operations occur in a protected space, shielded from potential attacks or unauthorised access. When combined with MuSig2, the security benefits are substantially amplified.
This synergy offers several compelling advantages. Firstly, it enhances the resilience of the system against both external threats and internal compromises, ensuring that even if part of the system is breached, the signing process remains secure. Secondly, TEEs can verify the integrity and authenticity of the code being executed, providing an additional layer of trust.
While deploying such schemes in TEEs can be complex, the Klave platform simplifies the process significantly, enabling not only easy integration but also meaningful improvements to the protocol itself.
A New Architecture: Single Aggregator Model in Klave
Instead of asking N participants to exchange 1-to-1 messages for signature computation (N2 messages), a single aggregator within Klave facilitates the whole process by drastically reducing the number of messages to N. This reduces communication complexity and enhances security by keeping the cryptographic operations within the enclave.
Schematics below illustrate the MuSig2 Aggregator (right) VS standard MuSig2 protocol (left), showing a step of public key sharing. On one side, the aggregator improves the efficiency of the scheme by reducing the number of sharing, and on the other side, Klave greatly improves the security of the scheme.
Building MuSig2 on Klave
We’ve implemented MuSig2 on Klave through two key applications:
- Aggregator App: Collects each participant’s public key, public nonce, and partial signature, then computes and outputs the final signature.
- Client App: Allows users to register, manage their public/private keys, initiate MuSig2 sessions, and compute their public nonces and partial signatures securely.
Rust Crates Integrated with the Latest Klave SDK
- klave = "0.3.0"
- musig2 = {version = "0.2.4", default-features = false, features = ["secp256k1","serde"]} => specific use of the secp256k1 crate maintained by the Bitcoin Core team
Code Snippets
1pub fn create_musig_context(public_keys: Vec<String>) -> Result<KeyAggContext, Box<dyn std::error::Error>>{23 if !public_keys.windows(2).all(|w| w[0] <= w[1]) {4 return Err("Public keys must be sorted".into());5 }67 let pub_keys: Vec<PublicKey>= public_keys.iter()8 .map(|pk|pk.parse::<PublicKey>())9 .collect::<Result<Vec<PublicKey>, _>>()?;1011 let ctx: KeyAggContext = musig2::KeyAggContext::new(pub_keys)?;12 return Ok(ctx);13}
MuSig2 Platform steps
MuSig2 improved by TEE
Klave and its confidential computing technology reduces the pote ntial for attacks on the MuSig2 aggregator: the whole aggregation session happens within a TEE which prevents unauthorised observation or tampering of data during execution. Klave also guarantees the integrity of the data as well as the code used through a cryptographic attestation.
Developer-Friendly Deployment Using Klave
Klave offers a Confidential Computing Platform-as-a-Service model, eliminating the need for developers to manage infrastructure or maintenance. Particularly, Klave offers an SDK providing our confidential computing capabilities to simplify application development in multiple languages and eases the deployment of such CC applications. The deployment of confidential computing within Klave is greatly facilitated by WebAssembly (WASM). WASM provides a portable and efficient bytecode format that can be executed within the secure enclave environment. Rust's ability to compile to WASM makes it an ideal language for developing secure applications on Klave.
MuSig2 Deployment Template
To simplify adoption, we’ve built a ready-to-use template that encapsulates the necessary steps for compiling the Rust code to WASM, packaging it for deployment on Klave, and interacting with the library through a secure API. By abstracting away the complexities of WASM compilation and enclave deployment, our template empowers developers to focus on building secure multi-signature applications without worrying about the underlying infrastructure.
Our Musig2 template will be available soon in the Klave template library: https://klave.com/marketplace. In the meantime, we invite you to explore our existing templates to get familiar with Klave’s capabilities.
Read next
We actively engage in highly innovative projects. Explore our latest publications featuring our cutting-edge technology.