Skip to main content

Crate tenzro_wallet

Crate tenzro_wallet 

Source
Expand description

MPC Wallet System for Tenzro Network

This crate provides auto-provisioned threshold wallets for Tenzro Network, an AI-Native, Agentic, Tokenized Settlement Layer blockchain.

§Key Features

  • Seamless Onboarding: Auto-provisioned MPC wallets - no seed phrases to manage
  • Threshold Signatures: 2-of-3 (configurable) multi-party signing
  • Multi-Asset Support: TNZO (native settlement), plus USDC, USDT, and major tokens
  • Encrypted Storage: Password-protected keystore for key shares (Argon2id)
  • Transaction Validation: Chain ID, nonce, gas, address, and data size checks
  • Signature Verification: Automatic post-signing cryptographic verification
  • Nonce Management: Per-address sequential nonces with replay protection
  • Transaction History: Full lifecycle tracking with filtering and pagination
  • Address Book: Contact management with name resolution and tag filtering
  • State Sync: On-chain balance/nonce synchronization via ChainStateProvider
  • Transaction Builder: Type-safe builder pattern with auto gas estimation
  • Key Zeroization: Sensitive key material zeroized on drop

§Architecture

The wallet system uses Multi-Party Computation (MPC) to distribute key shares across multiple parties. A threshold number of shares (e.g., 2 out of 3) are required to generate signatures, providing security without single points of failure.

§Examples

§Provisioning a new wallet

use tenzro_wallet::service::TenzroWalletService;
use tenzro_wallet::traits::WalletService;

let service = TenzroWalletService::new()?;

// Auto-provision a new MPC wallet
let wallet = service.provision_wallet().await?;

println!("Wallet created: {}", wallet.wallet_id);
println!("Address: {}", wallet.address);
println!("Threshold: {}-of-{}", wallet.threshold, wallet.total_shares);

§Building and signing a transaction

use tenzro_wallet::service::TenzroWalletService;
use tenzro_wallet::traits::WalletService;
use tenzro_wallet::builder::TransactionBuilder;
use tenzro_types::primitives::{Address, Nonce};

let service = TenzroWalletService::new()?;
let wallet = service.provision_wallet().await?;

// Build a validated transfer transaction. `from_wallet_pq` binds the
// wallet's classical address AND its ML-DSA-65 verifying key into the
// transaction so the hybrid signature stays self-consistent.
let tx = TransactionBuilder::default_chain()
    .from_wallet_pq(&wallet)
    .to(Address::new([2u8; 32]))
    .nonce(service.next_nonce(&wallet.address))
    .transfer(1000)
    .build_validated()?;

// Sign (validates, signs with MPC threshold + ML-DSA-65, verifies both legs)
let signature = service.sign_transaction(&wallet.wallet_id, &tx).await?;
println!(
    "Signature: classical={} bytes, pq={} bytes",
    signature.classical.len(),
    signature.pq.len(),
);

Re-exports§

pub use asset_manager::AssetManager;
pub use asset_manager::DefaultAssetConfig;
pub use asset_manager::SharedAssetManager;
pub use balance::Balance;
pub use balance::BalanceProvider;
pub use balance::BalanceTracker;
pub use builder::TransactionBuilder;
pub use contacts::AddressBook;
pub use contacts::Contact;
pub use error::Result;
pub use error::WalletError;
pub use history::HistoryFilter;
pub use history::TransactionHistory;
pub use history::TxDirection;
pub use history::TxRecord;
pub use history::TxStatus;
pub use keystore::Keystore;
pub use mpc_signing::MpcSigner;
pub use mpc_signing::TransactionSigner;
pub use nonce::NonceManager;
pub use provisioning::ProvisioningConfig;
pub use provisioning::WalletProvisioner;
pub use service::TenzroWalletService;
pub use service::WalletServiceConfig;
pub use signing::HybridSignatureBytes;
pub use state_sync::ChainStateProvider;
pub use state_sync::LocalStateProvider;
pub use state_sync::WalletStateSync;
pub use traits::WalletService;
pub use userop::encode_user_op_json;
pub use userop::pack_validator_signature;
pub use userop::user_op_hash;
pub use userop::UserOp;
pub use userop::UserOpBuilder;
pub use validation::TransactionValidator;
pub use validation::ValidationConfig;
pub use wallet::KeyShare;
pub use wallet::MpcWallet;
pub use wallet::WalletId;

Modules§

asset_manager
Asset management for Tenzro Network wallets.
balance
Balance tracking for MPC wallets in Tenzro Network.
builder
Transaction builder for Tenzro Network wallets.
contacts
Address book and contact management for Tenzro Network wallets.
error
Error types for Tenzro Network wallet operations.
history
Transaction history tracking for Tenzro Network wallets.
keystore
Encrypted local storage for FROST-Ed25519 threshold wallets.
mpc_signing
FROST-Ed25519 threshold signing coordinator (RFC 9591).
nonce
Nonce management for Tenzro Network wallets.
pluggable_signer
Pluggable hardware-signer surface for advanced custody.
provisioning
Auto-provisioning for FROST-Ed25519 threshold wallets.
rpc_provider
Real Tenzro JSON-RPC adapter for ChainStateProvider.
service
Wallet service implementation for Tenzro Network.
signing
Hybrid signature output type for tenzro-wallet.
state_sync
Wallet state synchronization for Tenzro Network.
traits
Wallet service trait for Tenzro Network.
userop
Client-side ERC-4337 v0.8 UserOperation builder + EIP-712 hashing.
validation
Transaction validation for Tenzro Network wallets.
wallet
FROST-Ed25519 threshold wallet types for Tenzro Network.