Expand description
§MPC Wallet Core
Core library for MPC-secured AI agent wallets using 2-of-3 threshold signing.
§Architecture
This crate provides:
- 2-of-3 Threshold ECDSA: AI agent holds 1 share, user holds 1 share, recovery guardian holds 1 share
- Policy Engine: Configurable rules enforced before signing (spending limits, whitelists, time bounds)
- Key Share Storage: Secure encrypted storage for key shares
- Chain Adapters: Unified interface for EVM and Solana chains
- ERC-4337 Support: Account abstraction with UserOperations and paymasters
§Quick Start
ⓘ
use mpc_wallet_core::{AgentWallet, PartyRole, PolicyConfig};
use mpc_wallet_core::chain::{ChainAdapter, EvmAdapter, EvmConfig};
// Create a new wallet with policy configuration
let policy = PolicyConfig::default()
.with_daily_limit("1.0", "ETH")
.with_whitelist(vec!["0x..."]);
let wallet = AgentWallet::create(policy).await?;
// Generate key shares for all parties
let shares = wallet.generate_shares().await?;
// Use chain adapter for transactions
let evm = EvmAdapter::new(EvmConfig::ethereum_mainnet())?;
let balance = evm.get_balance("0x...").await?;
// Sign a transaction (requires AI + User or AI + Recovery)
let signature = wallet.sign_transaction(tx, &[PartyRole::Agent, PartyRole::User]).await?;§Security Model
The 2-of-3 threshold ensures:
- AI agent cannot sign alone (prevents rogue AI)
- User maintains control (can approve/reject)
- Recovery possible if user loses access (with guardian)
All signing operations pass through the policy engine before MPC execution.
Re-exports§
pub use error::Error;pub use error::Result;pub use policy::PolicyConfig;pub use policy::PolicyDecision;pub use policy::PolicyEngine;pub use types::ChainType;pub use types::Message;pub use types::PartyId;pub use types::PartyRole;pub use types::PublicKey;pub use types::SessionConfig;pub use types::SessionId;pub use types::Signature;pub use types::TransactionRequest;pub use types::keccak256_hash;pub use chain::EvmAdapter;pub use chain::EvmConfig;pub use chain::SolanaAdapter;pub use chain::SolanaConfig;pub use chain::Balance;pub use chain::ChainAdapter;pub use chain::ChainId;pub use chain::SignedTx;pub use chain::TxHash;pub use chain::TxParams;pub use chain::UnsignedTx;
Modules§
- chain
- Chain Adapters
- error
- Error types for MPC wallet operations
- keygen
- Distributed Key Generation (DKG) for 2-of-3 Agent Wallet
- mpc
- MPC coordination utilities
- policy
- Policy Engine for MPC Agent Wallet
- sign
- Distributed Signature Generation (DSG) with Policy Enforcement
- storage
- Key Share Storage Interface
- types
- Core types for MPC agent wallet
Constants§
- N_
PARTIES - Fixed number of parties for AI agent wallet (AI, User, Recovery)
- PARTY_
AGENT - Party IDs
- PARTY_
RECOVERY - PARTY_
USER - THRESHOLD
- Fixed threshold (2-of-3)
- VERSION
- Protocol version