How hussainbasha559/smart-contract-analysis works
ReTrace accepts EVM runtime bytecode and returns an opcode listing, decompiler output, security findings and instruction-linked evidence, while explicitly marking incomplete analysis when tools fail or are skipped. Users can also manage accounts, files, scan history, AI explanations and usage. The graph includes the documented platform branches; several router and service implementations were not excerpted, so those connections are shown only where the index or README supports them.
Main entry points: api.js API client · main.py Backend application · report_service.py Analysis orchestration · routes.py Direct analysis API
Components 28
Web application
- Dashboard
frontend/src/App.jsx - Analyze workspace
frontend/src/pages/AnalyzePage.jsx - Analysis panels
frontend/src/components/FindingsPanel.jsx - API client
frontend/src/services/api.js - Sign-in and registration
frontend/src/pages/AuthPage.jsx
Bytecode analysis
- Direct analysis API
backend/app/api/routes.py - Bytecode validation
backend/app/utils/validation.py - Analysis orchestration
backend/app/services/report_service.py - Opcode decoding
backend/app/services/bytecode_service.py - Structural reentrancy check
backend/app/services/reentrancy_service.py - Decompilation service
backend/app/services/decompiler_service.py - Mythril analysis service
backend/app/services/mythril_service.py
Workspace platform
- Background scans and history
backend/app/routers/scans.py - Scan worker
backend/app/services/scan_runner.py - File management
backend/app/routers/files.py - Projects
backend/app/routers/projects.py - AI explanations
backend/app/routers/ai.py - Grounded AI service
backend/app/services/ai_service.py - Usage analytics
backend/app/routers/usage.py
Identity and persistence
- Account and sessions
backend/app/routers/auth.py - Application database
backend/app/db.py - Platform records
backend/app/models.py - Backend application
backend/app/main.py
Analysis integrations
- Heimdall adapter
backend/app/adapters/heimdall_adapter.py - Mythril adapter
backend/app/adapters/mythril_adapter.py - Tool runtime selection
backend/app/adapters/runtime.py
Other components
- User
- Heimdall and Mythril
Connections 39
- User → Dashboard: uses
frontend/src/App.jsx - Dashboard → Sign-in and registration: shows when signed out
frontend/src/App.jsx - Dashboard → Analyze workspace: shows workspace
frontend/src/App.jsx - Analyze workspace → API client: requests analysis
frontend/src/pages/AnalyzePage.jsx - Analyze workspace → Analysis panels: renders findings
frontend/src/pages/AnalyzePage.jsx - Sign-in and registration → API client: registers or logs in
frontend/src/pages/AuthPage.jsx - API client → Account and sessions: calls account endpoints
frontend/src/services/api.js - API client → Direct analysis API: calls analysis endpoints
- API client → Background scans and history: calls scan endpoints
- API client → File management: calls file endpoints
- API client → Projects: calls project endpoints
- API client → AI explanations: calls AI endpoints
- API client → Usage analytics: calls usage endpoints
- Backend application → Direct analysis API: registers router
backend/app/main.py - Backend application → Account and sessions: registers router
backend/app/main.py - Backend application → Background scans and history: registers router
backend/app/main.py - Backend application → File management: registers router
backend/app/main.py - Backend application → Projects: registers router
backend/app/main.py - Backend application → AI explanations: registers router
backend/app/main.py - Backend application → Usage analytics: registers router
backend/app/main.py - Direct analysis API → Bytecode validation: validates input
backend/app/api/routes.py - Direct analysis API → Analysis orchestration: requests analysis
backend/app/api/routes.py - Analysis orchestration → Opcode decoding: decodes bytecode
backend/app/services/report_service.py - Analysis orchestration → Decompilation service: requests decompilation
backend/app/services/report_service.py - Analysis orchestration → Mythril analysis service: requests symbolic analysis
backend/app/services/report_service.py - Analysis orchestration → Structural reentrancy check: runs heuristic
backend/app/services/report_service.py - Structural reentrancy check → Opcode decoding: uses instructions
backend/app/services/reentrancy_service.py - Mythril analysis service → Mythril adapter: invokes
backend/app/services/mythril_service.py - Decompilation service → Heimdall adapter: uses adapter
- Heimdall adapter → Tool runtime selection: selects execution mode
backend/app/adapters/heimdall_adapter.py - Mythril adapter → Tool runtime selection: selects execution mode
backend/app/adapters/mythril_adapter.py - Heimdall adapter → Heimdall and Mythril: runs Heimdall
- Mythril adapter → Heimdall and Mythril: runs Mythril
- Background scans and history → Scan worker: delegates scans
backend/app/routers/scans.py - Scan worker → Analysis orchestration: runs analysis
- AI explanations → Grounded AI service: requests explanations
- Account and sessions → Application database: persists accounts and sessions
backend/app/routers/auth.py - Application database → Platform records: maps records
backend/app/db.py - Backend application → Scan worker: recovers interrupted scans
backend/app/main.py