Wallet & Blockchain Connectors
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Wallet and Blockchain Connectors serve as the essential bridge between X3 Star user interfaces—such as the Desktop application and the Decentralized Exchange (DEX)—and the underlying blockchain infrastructure. These systems facilitate secure identity management, encrypted asset storage, and real-time communication with the X3 Chain and external networks like Ethereum and Solana.
The scope of these connectors includes frontend React hooks for state management, backend Rust modules for secure storage and RPC handling, and cross-chain bridge adapters for multi-network interoperability.
Sources: apps/dex/CLAUDE.md:85-89, apps/x3-desktop/PHASE_2_INTEGRATION.md:5-10
Desktop Core Integration Architecture
The Tauri-based desktop application utilizes a multi-layered architecture to separate frontend concerns from sensitive backend logic. The integration wires together Inter-Process Communication (IPC), Substrate hooks, and the x3ChainService.
System Components
- Frontend (Next.js/React): Consumes functionality through custom hooks such as
useSubstrate,useWalletStore, anduseX3ChainService. - Tauri Backend (Rust): Contains the
wallet_coremodule which handles encrypted storage, event subscriptions, and blockchain queries. - IPC Service: Defines message types like
IntentDraft,AssetRequirement, andAttestationfor secure communication between the UI and Rust backend.
The following diagram illustrates the data flow from the user interface to the X3 Chain Node via the Tauri backend.
This diagram shows the relationship between the Tauri frontend, the specialized Rust core modules, and the external blockchain node.
Sources: apps/x3-desktop/PHASE_2_INTEGRATION.md:12-58
Wallet Management and Storage
X3 Star implements a robust wallet management system that supports both local encrypted storage and external browser extensions.
Encrypted Wallet Store
Located in apps/x3-desktop/src-tauri/src/wallet_core/wallet_store.rs, the wallet store provides secure persistence for mnemonics and seeds.
| Command | Description |
|---|---|
store_wallet_encrypted | Stores mnemonic, seed, and derivation path with encryption. |
retrieve_wallet_encrypted | Decrypts and retrieves stored wallet data for signing. |
export_wallet_backup | Exports an encrypted backup for recovery purposes. |
import_wallet_backup | Restores a wallet from an exported backup string. |
Sources: apps/x3-desktop/PHASE_2_INTEGRATION.md:104-124
External Wallet Integration
The DEX frontend integrates with the Polkadot.js browser extension to manage accounts without storing private keys locally in the browser. It uses the @polkadot/extension-dapp library to request account access and sign transactions.
Sources: apps/dex/README.md:83-95
This sequence diagram shows the authorization flow between the DEX frontend and the browser wallet extension.
Sources: apps/dex/README.md:85-103
Blockchain RPC Services
Communication with the blockchain is handled via high-performance WebSocket RPC clients. These services manage real-time data streaming, such as balance updates and swap estimations.
X3 Chain Service Methods
The x3ChainService provides a standardized interface for querying the chain and submitting extrinsics.
| Method | Purpose |
|---|---|
query_block | Retrieves block data by number or hash. |
query_account | Queries account state at a specific block height. |
submit_extrinsic | Submits a signed call to the network. |
walletDex_estimateSwap | Estimates output amount for a token swap via the AMM. |
Sources: apps/x3-desktop/PHASE_2_INTEGRATION.md:143-167, apps/dex/README.md:43-55
Failover and Reliability
To ensure high availability, the blockchain connectors implement RPC failover procedures. If a primary provider (e.g., Alchemy or Infura) experiences high latency or downtime, the system automatically switches to configured backup providers.
Performance Targets:
- EVM Finality: 60 - 180 seconds.
- SVM Finality: 10 - 50 seconds.
- RPC Response Latency: < 200ms.
Sources: crates/x3-relayer/PHASE_13F_MASTER_INDEX.md:46-60, crates/x3-relayer/PHASE_13F_MASTER_INDEX.md:144-150
External Bridge Connectivity
Beyond the native X3 Chain, the system includes connectors for external ecosystems including Ethereum (EVM), Solana (SVM), and Bitcoin (BTC).
Cross-Chain Adapters
The architecture utilizes bridge adapters to validate state across disparate networks.
- Ethereum: Validates block headers and transaction receipts using the
AtlasHTLC.solcontract and requires approximately 12 block confirmations. - Solana: Utilizes a BPF-based runtime (Anchor/Rust) and requires 5 block confirmations for finality.
- Bitcoin: Implements Merkle proof validation (SHA-256) for block headers to verify transactions.
Sources: plans/Off-Chain-Assets-Audit-Blockchain-Integration-Epic-Plan.md:45-80, production/public/x3-validators.html:128-145
This diagram demonstrates how specialized adapters connect the X3 Atomic Kernel to various external Layer 1 networks.
Sources: plans/Off-Chain-Assets-Audit-Blockchain-Integration-Epic-Plan.md:40-100
Conclusion
The Wallet and Blockchain Connectors in X3 Star provide a unified interface for both internal and external chain operations. By combining secure Tauri-based backend storage with flexible RPC clients and cross-chain adapters, the system ensures that user assets remain secure while maintaining high-speed connectivity to the decentralized ecosystem. Proper configuration of these connectors, including failover strategies and encryption parameters, is critical for the stability of the DEX and Desktop applications.
Sources: apps/x3-desktop/PHASE_2_INTEGRATION.md:200-210, apps/dex/README.md:145-155