Coordinator Architecture
The DWalletCoordinator is the central shared object that manages all dWallet operations on the Ika network. Understanding how it works is essential for building Move contracts that integrate with Ika.
Overview
The coordinator serves as:
- Entry Point: All dWallet operations go through the coordinator
- State Manager: Stores dWallets, presigns, and signing sessions
- Fee Handler: Collects protocol fees for operations
- Event Emitter: Emits events that the Ika network processes
Coordinator Structure
The coordinator uses dynamic fields to store its inner state, which includes:
- dWallets: All created dWallet objects
- Presign sessions: Requested and completed presigns
- Sign sessions: Signature requests and results
- Network encryption keys: Keys for each network epoch
- Pricing information: Fee structure for operations
Using the Coordinator in Move
The coordinator is a shared object that you reference by ID in your Move functions:
Mutable vs Immutable Reference
| Reference Type | Use When |
|---|---|
&mut DWalletCoordinator | Performing operations (DKG, presign, sign) |
&DWalletCoordinator | Reading state (checking dWallet existence, getting pricing) |
Most operations require a mutable reference because they modify coordinator state.
Key Coordinator Functions
DKG (Create dWallet)
Presigning
Signing
Session Management
Query Functions
Getting the Coordinator ID
In your TypeScript code, get the coordinator ID from the Ika client:
Then pass it to your Move function:
Coordinator Versioning
The coordinator supports upgrades through a versioning system:
- The
versionfield tracks the current inner state version - Upgrades migrate the inner state to new versions
- Your code doesn't need to handle versioning directly
The coordinator validates its version internally. If you encounter version errors, ensure you're using the latest Ika packages.
Next Steps
- Learn about Capabilities and Approvals that control dWallet authorization
- Understand Session Management for protocol operations