# Abstraction Mode

## **Overview**

CAGA’s Abstraction Mode addresses a major friction point in blockchain adoption: **gas fees and complex multi-token transactions.** By shifting gas payment to a dedicated Relayer, end-users no longer need to maintain native network tokens. Instead, they pay in CAGA, which the network uses to cover the underlying gas. This makes **transactions effectively “gasless”** from a user’s perspective.

### **Key Benefits**

* **Gasless Transactions:** Users do not hold or spend native gas tokens; the system automatically deducts fees in CAGA post-execution.
* **Enhanced Security:** A dual-signature verification flow ensures only authorized transactions are relayed.
* **Simplicity:** One-time token approval handles all future transactions for that token.
* **Broad Utility:** Can be integrated with DApps, wallets, and any system needing a frictionless user experience.

***

<figure><img src="https://924614038-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAmseckznagDpUOxJphXX%2Fuploads%2FLiLBd9QwyLd93nzfzBKx%2FScreenshot%202025-01-20%20120222.jpg?alt=media&#x26;token=e00fcd95-78dd-4f60-977f-8cb79cfa1bf7" alt=""><figcaption><p>How it works</p></figcaption></figure>

## **How It Works**

1. **One-Time Token Approval**
   * The user grants a single approval for tokens (e.g., CAGA, USDT, USDC) to a Relayer Smart Contract.
   * This authorizes the Relayer to access a portion of user tokens to cover transaction costs.
2. **Relayer Smart Contract**
   * A specialized contract on CAGA that **executes transactions on the user’s behalf** and pays the gas upfront.
   * After completing the user’s requested action on-chain, it deducts the associated fees from the user’s pre-approved token balance (prioritizing CAGA for the fee deduction).
3. **Backend Coordination**
   * A secure backend service receives the user’s **transaction details** and **signature** from the frontend (the DApp or wallet).
   * It verifies the user’s ownership and intent, then forwards the data to the Relayer Contract.
4. **Dual-Signature Verification**
   * **Owner Verification:** Ensures the correct wallet initiated the transaction.
   * **User Signature Verification:** Confirms the user indeed signed the specific data being relayed.
   * Only upon passing both checks does the contract proceed.
5. **Gasless Frontend Experience**
   * During normal usage, a user simply **signs** a transaction request in their wallet.
   * **No need** to hold or manage extra tokens for gas; the Relayer covers it, then collects fees (in CAGA) post-transaction.

***

## **User Flow**

1. **Initial Setup:** The user logs into a DApp or wallet integrated with CAGA’s Abstraction Mode.
2. **Approval Prompt:** The user sees a one-time request to grant token approval to the Relayer.
3. **Transaction Signing:** For each action (e.g., swapping on DEX, interacting with a smart contract), the user just signs a message.
4. **Backend Verification:** The backend checks the user’s signature and transaction data.
5. **Relayer Execution:** The Relayer calls the appropriate contract on-chain, paying gas itself.
6. **Fee Deduction:** Upon success, the Relayer deducts the gas fee in CAGA from the user’s pre-approved token balance.

***

## **Security Model**

* **Strict Contract Logic:** The Relayer contract’s code ensures it can only act when properly authorized by the user’s signature.
* **Transparent Auditing:** All Relayer transactions are on-chain and visible, ensuring accountability.
* **Risk Mitigation:** Because the user pre-approves only certain tokens and amounts, the Relayer can’t exceed set limits.

***

## **Fee Model**

* **Transaction Fees:** Always denominated in CAGA, reinforcing the token’s utility.
* **Flexible Rate:** The exact fee can be variable, influenced by real-time gas prices on underlying networks and market-driven rates.
* **Backend Settlement:** The backend handles conversion logic where necessary—end-users see only one consistent CAGA fee.

***

## **Implementation in the CAGA Ecosystem**

* **DEX Integration:** Traders can swap tokens without needing the network’s native gas. After the trade, a small portion of CAGA covers the gas used.
* **Wallet Integration:** The Multichain Wallet can incorporate Abstraction Mode so that cross-chain transactions remain frictionless.
* **dApp Partnerships:** Projects building on CAGA can adopt Abstraction Mode to reduce onboarding hurdles and boost user adoption.

***

## Examples and Real-World Use Cases

Below are a few practical scenarios illustrating how Abstraction Mode can transform the user experience:

<figure><img src="https://924614038-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAmseckznagDpUOxJphXX%2Fuploads%2F79hBQOv3N6F0tu18aQe3%2Fdex%20example.jpg?alt=media&#x26;token=fc9c7fdb-0349-4fe7-a367-66d76b6fba9e" alt=""><figcaption><p>DEX Example</p></figcaption></figure>

#### 1. Trading on a DEX

**Connect Once, Trade Anywhere:**

1. The user connects their wallet to the CAGA DEX (no need for separate gas tokens).
2. Chooses to swap, for example, **CAGA → ETH on the BSC network**.
3. Gas fees are settled in CAGA automatically—no BNB is required.
4. The Relayer finalizes the swap, deducts a small CAGA fee from the user’s pre-approved balance, and delivers ETH on BSC to the user.

<figure><img src="https://924614038-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAmseckznagDpUOxJphXX%2Fuploads%2FtnWS6sVdVIkyf0EZhzMg%2Fjohn%20example.jpg?alt=media&#x26;token=f52bd49b-04da-464a-8545-1e744d7337cc" alt=""><figcaption><p>John's Swap</p></figcaption></figure>

**Concrete Example (John’s Swap):**

* John has **7,692,308 CAGA** (worth $1,000).
* He swaps **CAGA** for **ETH** on BSC; a **38,462 CAGA** (\~$5) fee is deducted.
* He ends up with \~**0.2618 ETH** and **7,653,846 CAGA** used for the swap.
* John never needs BNB for gas—the Relayer handles it behind the scenes.

***

#### 2. Retail and Mobile Payments

**Seamless Checkout:**

* A user shops online and pays with their preferred token (USDT, BTC, etc.).
* The website back-end uses CAGA’s Relayer to handle gas, automatically deducting fees in CAGA.
* The user only signs once, never touching extra gas tokens.

**Mobile Use Case:**

* In-app purchases in a mobile game can be transacted in any token, with fees seamlessly paid in CAGA.

***

#### 3. Cross-Border Transactions

**Hotel Booking:**

* A traveler books a hotel on a site like Travala, paying in BTC or ETH.
* Gas fees are quietly settled in CAGA.
* **Benefit:** Eliminates the hassle of holding multiple tokens just to cover transaction costs.

**Payment Conversion:**

* If a site requests USDT, the user can pay in CAGA; the system auto-converts on the backend and covers gas in CAGA.

***

<figure><img src="https://924614038-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAmseckznagDpUOxJphXX%2Fuploads%2FcRJ3VipwhgoVKpOIamV2%2Fgaming%20example.jpg?alt=media&#x26;token=24d95297-b660-49db-b8cd-87217f98075d" alt=""><figcaption><p>Gaming Integration</p></figcaption></figure>

#### 4. Gaming Integration

**Expanding Gaming Universes:**

* Many blockchain games only accept certain ERC tokens, limiting their user base.
* By adopting CAGA’s Abstraction Mode, a game can accept **any EVM-compatible token**.
* Players only sign one approval; all bridging/fees across different blockchains are managed by the Relayer.
