A fully on-chain chat application that redefines what Web3 messaging should look like - built on the Internet Computer blockchain.
OPTIC combines decentralized messaging with DeFi actions, allowing users to turn their chat rooms into collaborative investment pools. Every message sent contributes to a shared treasury that generates passive income for all participants through intelligent liquidity provision on ICPSwap.
- ๐ Fully Decentralized: No central servers - everything runs on-chain
- ๐ฐ Earn While You Chat: Convert chat rooms into investment pools
- ๐ค AI-Powered Analytics: Built-in AI agent for investment insights
- ๐ Automated DeFi: Intelligent liquidity provision on ICPSwap v3
- ๐ Chain-Key Tokens: Support for ICP, ckUSDC, ckETH, ckBTC, and more
- ๐ฑ Modern UI: Clean, responsive interface with real-time messaging
- ๐ Reward System: Earn fees proportional to your contributions
- โจ Key Features
- ๐ The Web3 Way
- ๐ Additional Features
- ๐๏ธ Canister Topology & Architecture
- โก Quick Start
- ๐ฐ Revenue Model
- ๐ Limitations and Improvements
- ๐ License
OPTIC is a paradigm shift in how we think about messaging applications. Instead of extracting value from users' data and attention, we create value for every interaction.
- ๐ฌ Chat Naturally: Join or create chat rooms just like any messaging app
- ๐ฐ Contribute to Pool: Members contribute ICP/ckUSDC to the room's investment treasury
- ๐ค AI Agent Invests: Our smart agent analyzes ICPSwap pools and executes optimal strategies
- ๐ Earn Passive Income: Collect fees from liquidity provision proportional to your contribution
- ๐ Withdraw Anytime: Leave with your principal + accumulated rewards
Our platform leverages the Internet Computer's unique capabilities to deliver:
- ๐ True Decentralization: All data stored on-chain, no centralized servers
- โก Near Real-time: IC's 2-second finality enables smooth chat experiences
- ๐ Automated DeFi: Smart contracts handle all investment operations
- ๐ Chain-Key Integration: Seamless interaction with Bitcoin, Ethereum tokens
- ๐ฆ Transparent Treasury: All fund movements are auditable on-chain
Beyond making DeFi as simple as sending a message, OPTIC includes powerful features that enhance the Web3 experience:
- Multi-Token Support: Manage ICP, ckBTC, ckETH, ckUSDC, and more
- Real-time Balances: Live token price feeds and portfolio tracking
- Transaction History: Complete on-chain transaction explorer
- Secure Integration: Seamless Plug Wallet connectivity
- Smart Notifications: AI-generated summaries of pool performance
- Investment Analytics: Automated analysis of DeFi opportunities
- Risk Assessment: Real-time evaluation of liquidity pool risks
- Personalized Reports: Customized insights based on your investment style
- Contribution Leaderboards: Recognition for top pool contributors
- Achievement System: Unlock badges for milestones and activities
- Referral Rewards: Earn bonuses for bringing new users to rooms
- Social Trading: Follow successful room strategies
- Multi-Signature Support: Enhanced security for high-value rooms
- Audit Trail: Complete transparency of all fund movements
- Emergency Procedures: Built-in safeguards and recovery mechanisms
OPTIC uses a sophisticated multi-canister microservices architecture designed for scalability, security, and maintainability. This separation of concerns allows us to optimize each component for its specific role while maintaining secure inter-canister communication.
Primary Role: CRUD Operations & Data Management
- ๐ Authentication: User identity management using Internet Identity
- ๐ฌ Chat Management: Real-time messaging, room administration, and history
- ๐ฅ User Management: Profiles, preferences, and social features
- ๐๏ธ Persistent Storage: Optimized data structures for chat and user data
- ๐ง Technology: Built with Azle (TypeScript for IC)
- ๐ Deployment: View on IC Dashboard
Primary Role: DeFi Operations & Treasury Management
- ๐ฐ Treasury Management: Secure handling of user contributions
- ๐ Pool Analysis: Real-time evaluation of ICPSwap opportunities
- ๐ Automated Trading: Smart contract-based token swapping
- ๐ฆ Liquidity Provision: Automated LP position management
- ๐ Reward Distribution: Proportional fee allocation to contributors
- ๐ง Technology: Built with Motoko (IC's native language)
- ๐ Deployment: View on IC Dashboard
Optic follows a multi-canister microservices architecture designed for scalability, security, and maintainability. The system is built on the Internet Computer blockchain with two main canisters that work together to provide a seamless DeFi-enabled chat experience.
graph TB
%% User Interface Layer
subgraph "Frontend Layer"
UI[React Frontend]
Plug[Plug Wallet Extension]
end
%% Canister Layer
subgraph "Canister Layer"
subgraph "Backend Canister (Azle)"
Auth[Authentication]
Chat[Chat Management]
User[User Management]
Storage[Data Storage]
end
subgraph "Agent Canister (Motoko)"
DeFi[DeFi Operations]
Swap[Token Swapping]
Pool[Liquidity Management]
Treasury[Treasury Management]
end
end
%% External Services
subgraph "External Services"
ICPSwap[ICPSwap v3]
ICPLedger[ICP Ledger]
ckUSDC[ckUSDC Ledger]
end
%% Data Flow
UI --> Plug
Plug --> Auth
UI --> Chat
UI --> User
UI --> DeFi
Chat --> Storage
User --> Storage
Auth --> Storage
DeFi --> Swap
DeFi --> Pool
DeFi --> Treasury
Swap --> ICPSwap
Pool --> ICPSwap
Treasury --> ICPLedger
Treasury --> ckUSDC
%% Cross-canister communication
Storage -.->|Contribution Records| DeFi
DeFi -.->|User Data| Storage
class UI,Plug frontend
class Auth,Chat,User,Storage,DeFi,Swap,Pool,Treasury canister
class ICPSwap,ICPLedger,ckUSDC external
class Storage storage
๐น Frontend Layer
- React Application: Modern UI built with React, TypeScript, and Tailwind CSS
- Plug Wallet Integration: Secure wallet connection and transaction signing
- Real-time Chat Interface: Messaging system with near realtime capabilities, thanks to Tanstack Query
๐น Backend Canister (Azle)
- Authentication & Authorization: User identity management and session handling
- Chat Management: Room creation, message handling, and group administration
- User Management: Profile management, preferences, and user data
- Data Storage: Persistent storage for chat history, user data, and metadata
๐น Agent Canister (Motoko)
- DeFi Operations: Automated investment strategies and pool analysis
- Token Swapping: Integration with ICPSwap for token exchanges
- Liquidity Management: Pool participation and liquidity provision
- Treasury Management: Fund allocation, fee collection, and reward distribution
๐น External Integrations
- ICPSwap v3: Decentralized exchange for token trading
- ICP Ledger: Native ICP token transactions
- ckUSDC Ledger: Chain-key USDC token operations
- User Authentication Flow
sequenceDiagram
participant U as User
participant P as Plug Wallet
participant B as Backend Canister
participant S as Storage
U->>P: Request Connection
P->>B: Authenticate User
B->>S: Store User Session
S-->>B: Session Confirmed
B-->>P: Authentication Success
P-->>U: Connected & Authenticated
- Contribution Flow
sequenceDiagram
participant U as User
participant F as Frontend
participant P as Plug Wallet
participant A as Agent Canister
participant I as ICPSwap
participant L as Pool
U->>F: Initiate Contribution
F->>P: Request ICP Transfer
P->>A: Send ICP to Treasury
A->>I: Swap ICP for Pool Tokens
I-->>A: Tokens Received
A->>L: Provide Liquidity
L-->>A: Send Position Id
A-->>F: Contribution Complete
F-->>U: Success Notification
- Chat & Investment Integration
sequenceDiagram
participant U as User
participant B as Backend Canister
participant A as Agent Canister
participant D as DeFi Operations
participant E as External Pool
U->>B: Send Chat Message
B->>A: Trigger Investment Logic
A->>D: Analyze Pool Opportunities
D->>E: Execute DeFi Strategy
E-->>D: Strategy Results
D-->>A: Investment Complete
A-->>B: Update Chat Context
B-->>U: Enhanced Chat Response
- Reward Distribution Flow
sequenceDiagram
participant P as Pool
participant A as Agent Canister
participant S as Share Calculator
participant B as Backend Canister
participant U as User
P->>A: Pool Fees Generated
A->>S: Calculate User Shares
S->>A: Share Percentages
A->>B: Update User Rewards
B->>U: Reward Notification
U->>B: Request Reward Claim
B->>A: Process Withdrawal
A->>U: Transfer Rewards
- Canister Isolation: Separate canisters for different concerns
- Cross-Canister Authentication: Secure communication between canisters
- Wallet Integration: User-controlled private keys via Plug wallet
- On-Chain Verification: All transactions verified on the IC blockchain
- Modular Design: Independent canisters can be upgraded separately
- Horizontal Scaling: Multiple canister instances for high load
- Efficient Storage: Optimized data structures for chat and financial data
- Caching Layer: In-memory caching for frequently accessed data
Get OPTIC running locally in just a few minutes!
Before you begin, ensure you have the following installed:
- Node.js (v20.0.0 or higher) - Download LTS version
- Git (v2.40+) for version control
- Internet Computer SDK (DFX) (v0.15.0+) - Installation Guide
- pnpm (Package manager) - Install with
npm install -g pnpm - Plug Wallet (Browser extension) - Install from here
- Clone the repository
# Fork and clone your own copy
git clone https://github.com/<YOUR_USERNAME>/optic.git
# Or clone directly from main repository
git clone https://github.com/divin3circle/optic.git
cd optic- Install dependencies
# Install root dependencies
pnpm install
# Install frontend dependencies
cd src/frontend && pnpm install && cd ../..- Start the Internet Computer replica
# Start IC replica in background
dfx start --clean --background
# Verify it's running
dfx ping- Deploy canisters locally
# Deploy backend canister
dfx deploy backend
# Deploy frontend canister
dfx deploy frontend
# Or deploy all at once
dfx deploy- Start the development server
# Navigate to frontend and start dev server
cd src/frontend
pnpm run dev- Set up the Agent Canister
The agent canister requires special setup. Follow the detailed guide at: ๐ Optic Agent Setup
# Note: Agent canister should be deployed on the playground
# to avoid cross-subnet call errors๐ง Common Issues & Solutions
Problem: dfx start fails with port errors
# Solution: Kill existing processes and restart
sudo lsof -ti:4943 | xargs kill -9
dfx start --clean --backgroundProblem: Frontend can't connect to backend
# Solution: Regenerate canister declarations
dfx generate backend
cd src/frontend && pnpm run devProblem: Plug Wallet connection issues
- Ensure you're on the correct network (Local/Mainnet)
- Clear browser cache and reconnect wallet
- Check that canisters are deployed and running
Problem: Build failures
# Solution: Clean and reinstall dependencies
rm -rf node_modules src/frontend/node_modules
pnpm install
cd src/frontend && pnpm installNeed help? Open an issue on GitHub with:
- Operating system and versions
- Full error messages
- Steps to reproduce the problem
OPTIC employs a sustainable, value-aligned revenue model that grows with platform usage:
- Small setup fee for creating new chat rooms
- Cycle funding included to power room operations
- Anti-spam measure while keeping barriers low
- Success fee charged only on profitable withdrawals
- Percentage of earnings (not principal) ensures alignment
- Transparent calculation shown before each withdrawal
- Freemium model for basic AI insights
- Subscription tiers for advanced analytics and predictions
- Pay-per-query option for occasional users
- Premium room features (advanced analytics, custom branding)
- Enterprise solutions for organizations and DAOs
- Third-party integrations and API access
- NFT marketplace for room achievements and badges
All fees are transparent, competitive, and designed to sustain long-term platform development while maximizing user value.
OPTIC is actively evolving. Here are current limitations and our roadmap for addressing them:
1. Single Treasury Model
- Issue: All funds currently route to a single treasury canister
- Impact: Limited scalability and increased risk concentration
- Roadmap: Individual canister per chat room with dedicated treasury
2. Fixed Room Parameters
- Issue: Room settings are immutable after creation
- Impact: No flexibility for changing investment strategies
- Roadmap: DAO-like governance system for parameter updates via proposals
3. Limited Token Support
- Issue: Currently supports only ICP/ckUSDC pool
- Impact: Reduced diversification options for users
- Roadmap: Multi-token contributions and diversified pool strategies
4. No User Verification
- Issue: Anonymous users may create spam or abuse systems
- Impact: Potential security and compliance concerns
- Roadmap: Optional KYC with mobile OTP verification
Phase 1: Decentralized Architecture
- Individual canister per chat room
- Isolated treasury management
- Cross-canister communication protocols
Phase 2: Advanced DeFi Features
- Multi-pool investment strategies
- Yield farming optimization
- Cross-chain liquidity provision
Phase 3: Governance & DAO Features
- Community-driven room management
- Proposal-based parameter updates
- Decentralized dispute resolution
Phase 4: Enterprise & Compliance
- Optional KYC/AML integration
- Institutional treasury management
- Regulatory compliance tools
We're not actively looking for community contributions! We hope to open this as soon as possible.
OPTIC represents a unique approach to Web3 messaging on the Internet Computer. By seamlessly bridging social interaction with DeFi opportunities, we're making blockchain adoption intuitive and rewarding for everyday users.
Built with โค๏ธ on the Internet Computer