A powerful command-line tool for analyzing smart contracts on Ethereum and other EVM-compatible blockchains.
- 🔍 Contract Analysis
- Deployment block detection
- Source code verification status
- Contract ABI extraction
- Event signature analysis
- Proxy contract detection
- Combined ABI for Proxies (New!)
- 🌐 Multi-Chain Support
- Easy addition of any EVM-compatible chain
- Chain configuration management
- Default chain switching
- 📁 Organized Output
- All analyzed contracts stored in
contracts-analyzed/
directory - Clear folder structure with contract name and chain
- Individual contract files separated in contract/ directory
- Event information with formatted examples
- All analyzed contracts stored in
# Install globally from npm
npm install -g contract-analyzer
- Initial Setup
cana setup
This initializes the configuration at ~/.contract-analyzer/config.json
and guides you through adding your first blockchain network.
-
Add Chain Details When prompted, provide:
- Chain name (e.g., "Ethereum Mainnet", "Base Sepolia")
- Block explorer API key
- Block explorer API endpoint URL
- Block explorer name
-
Analyze a Contract
cana analyze 0xYourContractAddress
# or use the shorthand
cana -a 0xYourContractAddress
- Add Additional Chains
cana setup
You can run setup anytime to add more chains.
- List Configured Chains
cana chains list
- Switch Active Chain
cana chains --switch <chain-name>
# or use the shorthand
cana chains -s <chain-name>
All subsequent analysis commands will use the selected chain.
When analyzing a contract, Cana creates the following structure wherever you run the CLI:
contracts-analyzed/
└── ContractName_chainName_YYYY-MM-DD/
├── contract/ # Folder for individual contract source files (if available)
├── abi.json # Contract ABI (or Proxy ABI if it's a proxy)
├── combined.abi.json # Combined Proxy + Implementation ABI (if applicable and successful)
└── event-information.json # Event signatures and examples
# Basic analysis
cana analyze <address>
cana -a <address>
# Analysis with specific chain
cana analyze <address> -c <chain>
cana -a <address> -c <chain>
Chain configurations are stored in ~/.contract-analyzer/config.json
. This file contains:
- List of configured chains and their details
- Currently selected chain
- API keys for block explorers
- User preferences
- Node.js v16 or higher
- npm v6 or higher
Contributions are welcome! Please read our contributing guidelines for details.
This project is licensed under the MIT License - see the LICENSE file for details.
# Install the tool globally (or use npx/node cli.js locally)
npm install -g contract-analyzer-cli
# Initial setup (configure chains and API keys)
cana setup
# Analyze a contract address (e.g., on Ethereum)
cana analyze <contract_address> -c ethereum
# Analyze using shorthand
cana -a <contract_address> -c polygon
# List available chains
cana chains
# Switch the default chain
cana chains -s arbitrum
# Add a custom chain
cana chains add
When you analyze a known proxy contract like USDC on Ethereum:
cana analyze 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 -c ethereum
If both the proxy and its implementation are verified, the output directory (contracts-analyzed/ContractName_chainName_YYYY-MM-DD/
) will contain:
├── abi.json # Proxy ABI
├── combined.abi.json # Merged Proxy + Implementation ABI
├── contract/
│ └── contract_source.sol # Proxy Source Code (if available)
└── event-information.json # Decoded Events