Zcash Wallet Interchange Format (ZeWIF)
zewif is a library that defines a standard data format for migrating wallet data
between different Zcash wallet implementations. It provides a comprehensive set of
types, tools, and utilities for serializing, deserializing, and manipulating Zcash
wallet data in a way that preserves all critical information during migration.
Core Features
- Complete Wallet Data Model: Represents all aspects of a Zcash wallet including accounts, addresses, transactions, and keys
- Multi-Protocol Support: Handles the Transparent, Sapling, and Orchard Zcash protocols.
- Type-Safe Representation: Uses Rust's type system to ensure correct handling of Zcash concepts
- Extensible Metadata: Supports custom metadata through an attachments system
Core Components
The ZeWIF format is organized hierarchically:
- [
Zewif]: The root container holding wallets and global transaction data- [
ZewifWallet]: Individual wallet with accounts and network context- [
Account]: Logical grouping of addresses and transaction references- [
Address]: Individual addresses of various types (transparent, shielded, unified)
- [
- [
- [
Transaction]: Complete transaction data (inputs, outputs, metadata)
- [
Protocol Support
ZeWIF handles the Zcash protocol versions:
- Transparent: Bitcoin-compatible public transactions ([
TransparentAddress], [TxIn], [TxOut]) - Sapling: Improved shielded protocol ([
sapling] module, [sapling::SaplingSentOutput], etc.) - Orchard: Latest shielded protocol ([
orchard] module, [orchard::OrchardSentOutput], etc.)
Integration Path
This crate is part of a larger ecosystem:
zewif: Core library defining the interchange format (this crate)zmigrate: Command-line tool for wallet migrationszewif-zcashd: ZCashd-specific integration for migrationzewif-zingo: Zingo-specific integration for migration (future)
Usage Examples
use zewif::{Zewif, ZewifWallet, Network, Account, Address, BlockHeight};
// Create a new ZeWIF container
let mut zewif = Zewif::new(BlockHeight::from_u32(2000000));
// Create a new wallet for the main network
let mut wallet = ZewifWallet::new(Network::Main);
// Add a new account to the wallet
let mut account = Account::new();
account.set_name("Default Account");
// Add the account to the wallet and the wallet to the ZeWIF container
wallet.add_account(account);
zewif.add_wallet(wallet);