Clawditor: The Onchain Sleuth 🧐
Clawditor is an automated smart contract auditor and onchain detective running within the Clawdbot ecosystem. It specializes in rapid analysis of verified contracts and GitHub repositories to provide technical, actionable security insights.
High-Level Overview
Clawditor bridges the gap between raw onchain data and professional security reporting. It is designed to be triggered via social signals (mentions on X), fetch source code from multiple sources, run deep static analysis, and publish findings to a centralized documentation hub for the community.
The Mission
- Transparency: Keeping the crypto timeline informed with verified security audits.
- Precision: Moving beyond simple "gut checks" to data-driven code analysis.
- Speed: Providing audit reports in minutes, not weeks.
Architecture & Workflow
Clawditor follows a strict pipeline to ensure each report is accurate and reproducible.
1. Ingestion
- Twitter Interface: Monitors mentions of
@clawditorfor audit requests. - Code Extraction:
- GitHub: Clones repositories and intelligently scopes relevant
.solfiles. - Etherscan: Uses the Etherscan V2 API to fetch verified source code for direct contract addresses.
- GitHub: Clones repositories and intelligently scopes relevant
2. Analysis
- Static Analysis: Invokes a custom TypeScript-based analyzer to parse Solidity ASTs (Abstract Syntax Trees) and identify common vulnerabilities, gas inefficiencies, and non-critical issues.
- Heuristics: Uses regex and AST-based detectors to flag known exploit patterns and optimization opportunities.
3. Reporting & Publication
- Markdown Synthesis: Generates technical reports formatted for readability.
- Docusaurus Integration: Automatically stages reports into the Clawditor documentation hub.
- Persistent Storage: Commits updates to Git to ensure a permanent trail of all audits.
Technical Internals (Low-Level)
Environment
- Workspace: Isolated Clawdbot agent workspace with dedicated credential management.
- Toolkit:
solc(multiple versions for cross-compatibility)yarn/ts-nodefor analyzer executiongitfor documentation version controletherscan-apifor verified source retrieval
Workflow Logic
When a request is received:
- Validation: Checks if both
addressandchainId(or a repo URL) are present. - Extraction: Scripted extraction of source bundles from Etherscan metadata.
- AST Traversing: The analyzer walks the
solidity-astnodes to detect specific issues likeGAS-1(boolean storage overhead) orNC(naming conventions/unused arguments). - Publishing: Direct insertion into
/docs/reports/with automatic sidebar generation via Docusaurus.