Sub topic 11
MPC and smart contract wallets as middle paths
This chapter assumes you know the following from earlier chapters:
- A wallet manages keys and signs transactions. It does not store coins.
- Custody means control of the signing keys.
- Seed phrases are a single secret that can recreate all keys.
- Multisignature (multisig) wallets require several keys to approve a spend.
Custodial wallets put one company in control of your keys. Self-custody puts you in control, along with the risk of losing one seed phrase. MPC wallets and smart contract wallets try to sit between those two. They split or reshape control so that no single secret, and no single party, decides everything.
The problem these designs address
A standard self-custody wallet has a single point of failure. Anyone who learns the seed phrase can spend everything, and losing the seed phrase can lose everything. Multisig reduces this, but it is visible on-chain, awkward to set up, and works differently on each blockchain.
The two designs in this chapter take different approaches:
- MPC (multi-party computation) wallets split the signing key into pieces. The pieces cooperate to produce a signature, and the full key is never assembled in one place.
- Smart contract wallets (also called account abstraction wallets) make the account a program on the blockchain. The program's rules decide which signatures are valid.
MPC wallets
How MPC signing works
Multi-party computation is a family of cryptographic protocols. In wallets, the most common form is threshold signing. A private key is generated as several shares. A threshold, such as 2 of 3, of those shares must take part in a signing protocol to produce one valid signature.
Two points define MPC:
- No device ever holds the whole private key. This applies even at the moment the key is created, if the wallet uses distributed key generation.
- The blockchain sees an ordinary signature from an ordinary address. Nothing on-chain shows that several parties were involved.
A common consumer layout has three shares: one on your phone, one with the wallet provider, and one in an encrypted cloud backup. Any two can sign. The provider cannot move your funds alone. If you lose your phone, the provider share and the backup share can restore access.
MPC compared with multisig
| Property | Multisig | MPC |
|---|---|---|
| Where the rule is enforced | On-chain script or contract | Off-chain, in the signing protocol |
| What the blockchain sees | Several keys and signatures | One key and one signature |
| Fee cost | Higher, because more data is posted | Same as a normal transaction |
| Chain support | Depends on chain features | Works on any chain that uses the supported signature scheme |
| Key rotation | New addresses needed | Shares can often be refreshed without changing the address |
| Auditability | Anyone can verify the policy | You must trust the implementation |
The last row is the main trade-off. A multisig policy is public and verifiable. An MPC policy lives in software and in the provider's servers. The cryptography may be sound, but you cannot check it from the chain.
Failure modes of MPC
- Provider dependence. If the design needs the provider's share to sign, the provider can refuse to cooperate or go offline. A good design includes an exit path, such as an exportable backup share that lets you rebuild a full key.
- Implementation bugs. Threshold signature protocols are complex. Researchers have found serious flaws in several widely used implementations, and some allowed key extraction. Prefer audited, widely reviewed code.
- Collusion. If the provider and whoever holds your backup share cooperate, they meet the threshold without you.
- Compromised devices. If an attacker controls your phone and your cloud account, they hold two shares.
Smart contract wallets
How they work
On Ethereum and similar chains, an ordinary account is controlled by one private key. A smart contract wallet is an account whose behavior is written as code. The code defines what counts as valid authorization. The standard approach, ERC-4337, lets a wallet contract validate a "user operation" using custom rules instead of one fixed signature check.
Because the rules are code, the wallet can offer features that a plain key cannot:
- Social recovery. Trusted contacts, called guardians, can together approve a change of the signing key if you lose it.
- Spending limits. A daily cap, or a list of approved destinations.
- Session keys. A temporary key with narrow permissions, for example one game for one hour.
- Batched transactions. Approve a token and swap it in one step.
- Gas sponsorship. Another party pays the network fee, or you pay it in a token other than the chain's native coin.
- Alternative signers. A passkey on your phone (using fingerprint or face unlock) can authorize transactions in place of a seed phrase.
A small example
The following Python sketch models the recovery logic of a social recovery wallet. It is a simulation of the rule, not contract code, but it shows what the on-chain program decides.
class SocialRecoveryWallet:
def __init__(self, owner, guardians, threshold):
if threshold > len(guardians):
raise ValueError("threshold exceeds number of guardians")
self.owner = owner
self.guardians = set(guardians)
self.threshold = threshold
self.approvals = {} # new_owner -> set of guardians who approved
def approve_recovery(self, guardian, new_owner):
if guardian not in self.guardians:
raise PermissionError("not a guardian")
self.approvals.setdefault(new_owner, set()).add(guardian)
if len(self.approvals[new_owner]) >= self.threshold:
self.owner = new_owner
self.approvals.clear()
return True
return False
wallet = SocialRecoveryWallet("old_key", ["alice", "bob", "carol"], threshold=2)
print(wallet.approve_recovery("alice", "new_key")) # False
print(wallet.approve_recovery("bob", "new_key")) # True
print(wallet.owner) # new_keyTwo of three guardians approved, so the owner changed. The address stays the same, which is the point: you replace the key without moving funds to a new address.
A real contract also needs a time delay before recovery takes effect. That lets the current owner cancel a recovery they did not start.
Failure modes of smart contract wallets
- Code risk. The wallet is a program, and programs have bugs. A flaw in the contract or in a module you installed can drain funds. The 2017 Parity multisig library incident froze a large amount of Ether permanently.
- Guardian risk. Guardians who collude, lose their own keys, or get phished weaken recovery. Guardians who are all on one exchange or one phone are not independent.
- Chain specificity. The wallet is deployed per chain. An address that works on one network may not be controlled by you on another, so you must check each chain's support.
- Higher gas costs. Running contract logic costs more than a simple transfer, although cheaper networks reduce this.
- Upgrade authority. If the wallet can be upgraded, someone controls the upgrade. That is a custody question in itself.
Where each design sits on the custody spectrum
Neither design has a fixed custody status. It depends on who holds enough shares or authority to act alone.
| Setup | Who can move funds alone | Custody status |
|---|---|---|
| Exchange account | The exchange | Custodial |
| MPC where provider holds the threshold | The provider | Custodial |
| 2-of-3 MPC, you hold two shares | You | Self-custody |
| 2-of-3 MPC, you hold one and provider one | Nobody alone | Shared |
| Smart wallet, you hold the only key | You | Self-custody |
| Smart wallet with provider-run recovery | You, plus a provider who can override | Shared |
Ask one question of any product: if the company disappeared tomorrow, could I still move my funds with what I hold? If yes, you have meaningful control. If no, you are relying on the company.
Choosing between the two
- Pick MPC when you want a familiar address on any chain, normal fees, and no seed phrase to write down, and you accept trust in a provider's software.
- Pick a smart contract wallet when you want programmable rules, such as limits and recovery by guardians, on a chain that supports them, and you accept code risk and extra gas.
- Pick multisig with hardware wallets when the amount is large, and you want a public, auditable policy and independent keys.
The options combine. A treasury might use smart contract wallet rules with signers that are themselves MPC wallets or hardware devices.
Exercise
A wallet app advertises "no seed phrase, no single point of failure." It uses 2-of-3 MPC. One share is on your phone, one is on the company's server, and one is in your cloud backup. The company shuts down. Can you still access your funds, and what does your answer depend on?
Show answer
You can still access your funds if the company's design lets you combine your phone share and your cloud backup share to sign, since those two meet the 2-of-3 threshold, or if it lets you export those shares into a full key. It depends on whether the signing protocol and the recovery tools work without the company's servers. If the protocol requires the company to take part in every signing round, the two shares you hold may be unusable. Test the exit path with a small amount before you depend on it.
Exercise
Name one risk that a smart contract wallet has and a standard single-key wallet does not, and one feature it has that a single-key wallet lacks.
Show answer
Risk: bugs in the wallet's contract code or in an installed module can lead to loss of funds, or an upgrade authority can change the rules. Feature: social recovery, where guardians approve a replacement key, so a lost key does not mean lost funds. Spending limits, session keys and batching are also valid features.