> For the complete documentation index, see [llms.txt](https://tmawallet.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tmawallet.gitbook.io/docs/architecture-overview.md).

# Architecture Overview

**Core Components**

* **`TMAWalletClient`**: This is the main class that developers interact with to manage wallets and perform wallet-related operations. It is responsible for initializing the wallet, creating bundles, and interacting with Ethereum.
* **Controllers**: The SDK includes two key controllers:
  * **`ClientBundleController`**: Manages client-side bundles, including creating, retrieving, and clearing bundles. It helps manage cryptographic keys and other user-specific data securely.
  * **`WalletBundleController`**: Handles wallet addresses, storing, retrieving, and clearing wallet addresses linked to client bundles.
* **Storage**: Storage plays a crucial role in handling sensitive data:
  * **`TelegramCloudStorage`**: Implements storage functionality using Telegram's cloud infrastructure. This class ensures user data is stored securely and is accessible across devices via Telegram.

**How It Works**

The TMAWallet SDK works by leveraging Multi-Party Computation (MPC) to securely generate and manage wallet keys, which are split across multiple parties to eliminate the risk of a single point of failure. The wallet keys are not stored in one location, ensuring maximum security.

**Workflow Overview**:

1. **Initialization**: The `TMAWalletClient` is initialized with a project token, establishing the connection to the Telegram environment and setting up the initial configuration.
2. **Key and Wallet Management**: Using the `ClientBundleController`, the SDK manages key bundles for each user, securely creating and storing keys using MPC.
3. **Storage**: User data, including key information, is stored in `TelegramCloudStorage`, ensuring seamless access across devices while maintaining security.
4. **Interaction with Ethereum**: The SDK allows users to sign transactions and interact with Ethereum-based smart contracts through the `ethers.js` library, using the generated wallet keys.

The combination of MPC and Telegram's cloud storage ensures a balance between security and user convenience, allowing users to access their wallets effortlessly while ensuring that private keys are always kept safe.
