OnChain Sage is a decentralized trading intelligence platform that combines AI-driven market analysis, community insights, and multi-chain trading capabilities with a reputation-based forum system.
┌─────────────────────────────────────────────────────────────┐
│ Frontend Layer │
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ Trading Bot │ │ Community Forum │ │ Dashboard & │ │
│ │ Interface │ │ & Rankings │ │ Analytics │ │
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ API Gateway Layer │
│ ┌─────────────────────────────┐ │
│ │ NestJS Backend API │ │
│ │ (Authentication, Logic, │ │
│ │ Data Processing) │ │
│ └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ Smart Contract Layer │
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ User Profiles │ │ Reputation & │ │ Payment & │ │
│ │ & Subscriptions│ │ Badge System │ │ Gas Fees │ │
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────────────────────────────────────────────┐
│ External Data Layer │
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ Twitter/X API │ │ DEX Screener │ │ Raydium & │ │
│ │ (Narratives) │ │ (Pricing) │ │ Other DEXs │ │
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
- Framework: Next.js 14+ (App Router)
- Styling: Tailwind CSS
- State Management: Zustand/Redux Toolkit
- Web3 Integration: Starknet.js, get-starknet
- Charts: TradingView Lightweight Charts
- UI Components: shadcn/ui or custom component library
- Framework: NestJS (Node.js)
- Database: PostgreSQL + Redis (caching)
- Message Queue: Bull Queue (Redis-based)
- Authentication: JWT + Wallet signature verification
- WebSocket: Socket.io for real-time updates
- APIs: Twitter API v2, DEX Screener API, Raydium API
- Framework: Dojo (StarkNet)
- Language: Cairo
- Network: StarkNet Mainnet/Testnet
- Storage: On-chain for critical data, IPFS for metadata
- Cloud: AWS/GCP
- CDN: Cloudflare
- Monitoring: DataDog/Grafana
- CI/CD: GitHub Actions
External APIs → Data Ingestion Service → AI Processing Engine →
Risk Assessment → Signal Generation → User Notification
User Actions → Performance Tracking → On-chain Reputation Update →
Badge Assignment → Access Level Adjustment
- Twitter/X Scraping: Narrative analysis using NLP
- DEX Screener: Real-time pricing and volume data
- Raydium/Jupiter: Liquidity and trading metrics
- On-chain Analytics: Whale movements, holder analysis
- Sentiment Analysis: Process social media narratives
- Pattern Recognition: Technical analysis algorithms
- Risk Scoring: Multi-factor risk assessment
- Signal Generation: Buy/sell recommendations
- Conservative: Low-risk, established tokens
- Moderate: Balanced risk/reward
- Aggressive: High-risk, high-reward opportunities
- Degen: Maximum risk, meme coin focus
// Example Cairo contract structure
#[starknet::contract]
mod ReputationSystem {
struct User {
wallet_address: felt252,
reputation_score: u256,
badges: Array<Badge>,
performance_history: Array<Trade>,
call_accuracy: u8,
total_calls: u32,
}
struct Badge {
badge_type: BadgeType,
earned_at: u64,
criteria_met: felt252,
}
}- Sage (90%+ accuracy, 100+ calls)
- Expert (80%+ accuracy, 50+ calls)
- Trader (70%+ accuracy, 25+ calls)
- Apprentice (60%+ accuracy, 10+ calls)
- Novice (Default level)
- Gas Fees: Paid in STRK for extended bot usage
- Premium Tiers: Monthly subscriptions in STRK
- Community Rewards: STRK rewards for top performers
Epic: Project Setup & Core Infrastructure
onchainsage-onchain Issues:
-
Project Setup & Configuration
- Initialize Dojo project structure
- Configure Scarb.toml and build system
- Set up testing framework
- Create deployment scripts
-
Core Smart Contracts
- User profile contract implementation
- Basic reputation system contract
- Payment handling contract (STRK integration)
- Access control system
onchainsage-offchain Issues:
-
NestJS Backend Foundation
- Project initialization and configuration
- Database setup (PostgreSQL + Redis)
- Authentication module with wallet verification
- Basic API structure and middleware
-
External API Integrations
- Twitter/X API service setup
- DEX Screener API integration
- Raydium API integration
- Data ingestion pipeline foundation
onchainsage-frontend Issues:
-
Next.js Application Setup
- Project initialization with App Router
- Tailwind CSS and UI component setup
- Web3 wallet integration (StarkNet)
- Basic routing and layout structure
-
Core UI Components
- Authentication components
- Dashboard layout
- Trading interface mockups
- Community forum basic structure
// Shared type definitions across repositories
export interface User {
walletAddress: string;
reputationScore: number;
badges: Badge[];
subscriptionTier: SubscriptionTier;
}
export interface TradingSignal {
id: string;
token: string;
action: 'BUY' | 'SELL' | 'HOLD';
confidence: number;
riskLevel: RiskLevel;
timestamp: number;
}- Frontend → Offchain: REST API calls, WebSocket connections
- Offchain → Onchain: Smart contract interactions via StarkNet.js
- Frontend → Onchain: Direct wallet interactions for payments
- Semantic versioning across all repositories
- API versioning for backward compatibility
- Coordinated releases using GitHub releases
- Unit Tests: Each repository maintains its own
- Integration Tests: Shared testing scenarios
- E2E Tests: Full application flow testing
Create a fourth repository: onchainsage-docs for:
- Overall architecture documentation
- API specifications (OpenAPI/Swagger)
- Development guidelines
- User guides and tutorials
Each repo maintains its own:
- Setup and installation guides
- Contributing guidelines
- Technical documentation
Epic: Forum & Reputation System
-
Community Forum Frontend
- Discussion threads
- User profiles
- Real-time updates
-
Reputation Tracking
- Performance calculation
- Badge system implementation
- Hierarchy management
-
Trading Call System
- Call submission interface
- Voting mechanism
- Performance tracking
Epic: System Integration & Launch Preparation
-
Multi-chain Integration
- Additional chain support
- Cross-chain trading
- Unified wallet experience
-
Advanced Analytics
- Portfolio tracking
- Performance analytics
- Risk management tools
-
Mobile Optimization
- Responsive design
- PWA implementation
- Mobile-specific features
Smart Contracts & Blockchain Logic
onchainsage-onchain/
├── src/
│ ├── contracts/
│ │ ├── user_profile.cairo # User management
│ │ ├── reputation_system.cairo # Badge & ranking system
│ │ ├── payment_handler.cairo # STRK payments & subscriptions
│ │ └── governance.cairo # Community governance
│ ├── models/
│ │ ├── user.cairo # User data models
│ │ ├── reputation.cairo # Reputation data models
│ │ └── payment.cairo # Payment data models
│ └── systems/
│ ├── reputation_system.cairo # Reputation calculation logic
│ ├── badge_system.cairo # Badge assignment logic
│ └── subscription_system.cairo # Subscription management
├── scripts/
│ ├── deploy.sh # Deployment scripts
│ ├── migrate.sh # Migration scripts
│ └── seed.sh # Seed data scripts
├── tests/
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── docs/
│ ├── contracts/ # Contract documentation
│ └── deployment/ # Deployment guides
├── Scarb.toml # Dojo configuration
└── .github/
├── workflows/ # CI/CD for contracts
└── ISSUE_TEMPLATE/
Backend API & Data Processing
onchainsage-offchain/
├── src/
│ ├── modules/
│ │ ├── auth/ # Authentication & wallet verification
│ │ ├── trading/ # Trading signals & bot logic
│ │ ├── data-ingestion/ # External API integrations
│ │ ├── ai-processing/ # ML/AI analysis engines
│ │ ├── community/ # Forum & social features
│ │ └── notifications/ # Alert & notification system
│ ├── shared/
│ │ ├── dto/ # Data transfer objects
│ │ ├── interfaces/ # Shared interfaces
│ │ ├── utils/ # Utility functions
│ │ └── constants/ # Application constants
│ ├── database/
│ │ ├── migrations/ # Database migrations
│ │ ├── seeds/ # Seed data
│ │ └── entities/ # Database entities
│ └── config/ # Configuration files
├── scripts/
│ ├── data-migration/ # Data migration scripts
│ └── deployment/ # Deployment scripts
├── tests/
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── e2e/ # End-to-end tests
├── docs/
│ ├── api/ # API documentation
│ └── deployment/ # Deployment guides
├── docker/ # Docker configurations
├── package.json
└── .github/
├── workflows/ # CI/CD for backend
└── ISSUE_TEMPLATE/
User Interface & Web Application
onchainsage-frontend/
├── src/
│ ├── app/ # Next.js app directory
│ │ ├── (dashboard)/ # Dashboard routes
│ │ ├── (trading)/ # Trading interface routes
│ │ ├── (community)/ # Community forum routes
│ │ └── (profile)/ # User profile routes
│ ├── components/
│ │ ├── ui/ # Reusable UI components
│ │ ├── trading/ # Trading-specific components
│ │ ├── community/ # Community-specific components
│ │ └── layout/ # Layout components
│ ├── hooks/ # Custom React hooks
│ ├── lib/
│ │ ├── web3/ # Web3 integration utilities
│ │ ├── api/ # API client functions
│ │ ├── utils/ # Utility functions
│ │ └── constants/ # Application constants
│ ├── stores/ # State management
│ ├── styles/ # Global styles
│ └── types/ # TypeScript type definitions
├── public/ # Static assets
├── docs/ # Frontend documentation
├── tests/
│ ├── components/ # Component tests
│ └── e2e/ # End-to-end tests
├── package.json
└── .github/
├── workflows/ # CI/CD for frontend
└── ISSUE_TEMPLATE/
- Type:
contract,deployment,security,testing - Component:
user-profile,reputation,payment,governance - Network:
mainnet,testnet,devnet
- Type:
api,database,ml-processing,integration - Component:
auth,trading,data-ingestion,ai-engine - Service:
twitter,dex-screener,raydium
- Type:
component,page,styling,web3-integration - Component:
dashboard,trading,community,profile - Platform:
desktop,mobile,tablet
- Priority:
critical,high,medium,low - Difficulty:
beginner,intermediate,advanced - Status:
ready-for-dev,in-progress,review-needed - Community:
good-first-issue,help-wanted,bounty
- Master Roadmap: High-level milestones across all repos
- Integration Tasks: Issues requiring coordination between repos
- Community Contributions: Track open-source contributions
- Release Planning: Coordinate releases across repositories
- Good First Issues: Label beginner-friendly tasks
- Documentation: Comprehensive setup guides
- Code Review: Establish review process
- Bounty System: Reward significant contributions
- Core Development: Smart contracts, backend, frontend
- Data Science: AI/ML algorithms, data analysis
- UI/UX: Design and user experience
- Documentation: Technical writing and guides
- Testing: Quality assurance and testing
- Audit Requirements: All contracts must be audited
- Access Control: Role-based permissions
- Upgrade Patterns: Secure upgrade mechanisms
- Testing: Comprehensive test coverage
- API Key Management: Secure key storage
- User Privacy: Data encryption and privacy
- Rate Limiting: Prevent API abuse
- Input Validation: Sanitize all inputs
- Signal Accuracy: >75% profitable signals
- System Uptime: >99.5% availability
- Response Time: <2s API response time
- User Growth: 1000+ active users in 6 months
- Contributors: 50+ active contributors
- Code Quality: >80% test coverage
- User Engagement: Average session >15 minutes
- Reputation System: Active participation >60%
- Fork the repository
- Set up development environment
- Choose an issue from "good first issues"
- Follow contribution guidelines
- Submit pull request
- Connect wallet (StarkNet compatible)
- Choose bot configuration
- Join community forum
- Start following signals
- Build reputation through performance
- AI-Powered Portfolio Management
- Cross-chain Arbitrage Detection
- Advanced Risk Management Tools
- Integration with Traditional Finance
- Mobile Application
- API for Third-party Developers
This architecture provides a solid foundation for building OnChain Sage as a community-driven, open-source project while maintaining the technical sophistication needed for a professional trading platform.