Book a free call

How to Implement an MPC Wallet in Your App

An MPC wallet splits a private key into shares so no single device can sign alone. This guide explains the parts, the build steps and the recovery plan.

Hertiv engineering teamReviewed by a senior engineer
7 min read
How to Implement an MPC Wallet in Your App
On this page

Short answer

An MPC wallet splits a private key into shares held on separate devices, so a payment needs a set number of shares to sign. To implement one in your app, pick an MPC library or provider, generate shares across the user device, your server and a backup, set a threshold such as 2-of-3, and test recovery before real funds arrive. No single device ever holds the full key.

What is an MPC wallet?

An MPC wallet is a crypto wallet that uses multi-party computation to split a private key into shares. Each share lives on a different device or server, and a payment is signed only when enough shares take part. With a 2-of-3 setup, any two of the three shares can sign, and one share alone can do nothing.

The key point is that the full key never exists in one place. In a normal wallet, one device holds the whole key, so stealing that device steals the funds. In an MPC wallet, an attacker must take over two separate places at once, which is far harder.

MPC wallets are used by exchanges, payment apps and teams that hold funds together. They fit any app where losing one device should not mean losing the money, and where more than one person or system should approve a payment.

Implementing one is a development job, not a settings change. Your app must create shares, run signing rounds between the holders, and store shares safely. For the basic idea, see what an MPC wallet is.

How does MPC signing work?

MPC signing works in rounds. Each share holder does a small piece of maths on its own share, passes the partial result to the others, and the pieces combine into a valid signature without ever rebuilding the full key.

PartWhat it doesWhere it lives
Key sharesPieces of the split keyUser device, server, backup
ThresholdHow many shares must signSet at wallet creation, such as 2-of-3
Signing roundsMessages that build the signatureBetween the share holders
Recovery sharesSpare shares for key lossOffline backup, held apart

A signing round starts when your app asks for a payment. The server sends a signing request to the share holders, each one checks the request and returns its partial signature, and the app combines the parts into one signature the chain accepts.

The rounds take longer than a single-key signature, because messages travel between holders. For most payments that delay is a fraction of a second, but high-frequency trading apps should measure it before they commit to the design.

The threshold is the heart of the design. A 2-of-3 setup survives one lost share and blocks one stolen share. A 3-of-5 setup survives two losses but needs three holders online to sign. Pick the threshold by how much loss you can take and how many holders you can keep online.

What do you need before you start?

Before you start, you need a clear answer to four questions: who holds the shares, what the threshold is, how recovery works, and which chains you support.

Share holders are usually the user device, your server and a backup holder, such as a second device or a recovery service. Each holder needs a secure place to keep its share and a way to receive signing requests.

Next, pick how you will build it. You can use an MPC library and write the signing flow yourself, or use a provider that runs the server side for you. A library gives you more control; a provider is faster to ship. Either way, check that the code has been audited and that the provider's terms cover key handling.

Also decide which chains you support before you write code. Some MPC setups work with many chains, while others need chain-specific signing. Adding a chain later can mean changing the signing flow, so list the chains up front.

Finally, plan the user experience. A user who loses a phone must be able to recover without calling support at midnight. Write the recovery flow first, then build the signing flow around it.

How to implement an MPC wallet in 6 steps

Implementing an MPC wallet takes six steps, from key generation to a funded pilot. Do them in order, and do not skip the recovery test.

  1. Choose the stack. Pick an MPC library or provider, the chains you support, and the threshold, such as 2-of-3.
  2. Generate the shares. Run the key generation ceremony so each holder creates its share on its own device. The full key must never exist in one place, even during setup.
  3. Build the signing flow. Wire the request, the partial signatures and the final signature into your app, with a clear screen that shows what is being signed.
  4. Add policy checks. Put limits on the server side, such as daily caps and allow-lists, so a stolen share cannot drain the wallet in one go.
  5. Test recovery. Delete one share, recover it from the backup, and sign again. Repeat until the flow works without an engineer in the room.
  6. Run a funded pilot. Fund a small set of wallets with real money, watch the signing rounds, and fix what breaks before you open it to all users.

Keep the signing screen honest. Show the amount, the destination and the fee before the user approves, because a signature cannot be taken back once it is on the chain.

Log every signing request and every policy decision. When a payment looks wrong, the log is the only way to find out which holder approved it and why. A crypto wallet development team can help with the audit and the key ceremony, but your team still owns the recovery plan.

How do you handle recovery and key shares?

Recovery is the part most teams under-plan. A wallet that cannot be recovered after a lost phone is a wallet that will lose a user's funds, so design recovery before you launch.

The common pattern is a backup share held offline, such as a printed recovery sheet or a second device kept apart. When a share is lost, the backup share takes its place and a fresh share is generated for the lost holder.

Test recovery with real people, not just engineers. Give a test user a lost-phone scenario and watch how long recovery takes and where they get stuck. If recovery needs an engineer, it will fail at the worst time.

Also plan for a holder that goes offline. A 2-of-3 wallet still signs when one holder is down, but a 2-of-2 wallet does not. If your server is one of the holders, it must stay up, or the threshold should allow signing without it.

Rotate shares on a schedule. Fresh shares limit how long a stolen share stays useful. Rotation is extra work, so set a schedule your team can keep, such as once a quarter, and automate it where you can.

Example (hypothetical): a payments app adds MPC wallets

Example (hypothetical): a payments app with 1,000 pilot users adds MPC wallets with a 2-of-3 setup. Each user holds one share on their phone, the app server holds one share, and a backup service holds the third.

In the first month the app processes 40 payments a day. Each payment needs 2 signing rounds, so the server handles 40 times 2, which is 80 signing rounds a day. At about half a second per round, signing adds about 40 seconds of server work a day, which the team accepts.

During the pilot, 50 users test recovery by deleting their phone share. Of those 50, 48 recover on their own from the backup, and 2 need help from support. That is 48 out of 50, or 96 percent, recovering without help.

The team fixes the two failures, which both came from the same unclear instruction screen, and re-tests with 20 more users. All 20 recover on their own. Only then does the team open MPC wallets to all users.

What are the common mistakes?

The most common mistakes are treating MPC as a magic fix, skipping the recovery test, and letting one holder see too much.

  • Thinking MPC fixes everything. MPC protects the key, not the app. A bad policy or a tricked user can still lose funds.
  • Skipping the recovery test. A wallet that cannot be recovered is a wallet that will fail. Test with real users before launch.
  • Letting one holder see the full key. If any device ever holds the full key, the MPC design is broken. Audit the ceremony.
  • No server-side limits. A stolen share should not drain the wallet. Add daily caps and allow-lists.
  • Forgetting the threshold trade-off. A higher threshold is safer but needs more holders online. Pick the balance your users can live with.

Key takeaways

  • An MPC wallet splits the key so no single device can sign alone
  • Pick the threshold by how much loss you can take and how many holders stay online
  • Build the signing flow, add server-side limits, then test recovery
  • Recovery must work for real users, not just engineers
  • Audit the key ceremony so the full key never exists in one place

Frequently asked questions

How is an MPC wallet different from a multisig wallet?

A multisig wallet needs several separate signatures on the chain, one per key. An MPC wallet needs several shares to build one signature off the chain, so the chain sees a normal payment. Multisig is simpler to check on the chain, while MPC keeps the key split.

What does 2-of-3 mean?

It means three shares exist and any two of them can sign a payment. One share alone cannot sign, and the wallet still works if one share is lost. The numbers can change: 3-of-5 needs three of five shares, which is safer but needs more holders online.

How long does MPC signing take?

Usually well under a second for a normal payment, because the rounds are small messages between holders. The time grows with the number of holders and the distance between them, so measure it on your own setup before you promise a speed to users.

Can I use MPC with any chain?

Most major chains work with MPC, but the signing maths differs by chain, so check your chain is supported before you pick a library or provider. Adding a chain later can mean changing the signing flow.

What happens if the provider goes away?

That depends on your design. If your provider holds a share, you need a way to move that share to a new holder. Keep the recovery plan in your own hands, and test moving a share before you need to.

How much does it cost to implement an MPC wallet?

Costs vary with the library or provider, the audit, and the chains you support. The main parts of the bill are the library or provider, the audit, and the chains you support. Budget for the audit and the recovery testing, not just the build.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building a wallet into your app? Talk to Hertiv.

A senior engineer replies within one business day. Or see our MPC Wallet service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call