npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

contract-analyzer

v1.3.0

Published

A powerful command-line tool for analyzing smart contracts on Ethereum and other EVM-compatible blockchains.

Downloads

42

Readme

Cana - Smart Contract Analysis CLI

A powerful command-line tool for analyzing smart contracts on Ethereum and other EVM-compatible blockchains.

Features

  • 🔍 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

Installation

# Install globally from npm
npm install -g contract-analyzer

Quick Start

  1. Initial Setup
cana setup

This initializes the configuration at ~/.contract-analyzer/config.json and guides you through adding your first blockchain network.

  1. 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
  2. Analyze a Contract

cana analyze 0xYourContractAddress
# or use the shorthand
cana -a 0xYourContractAddress
  1. Add Additional Chains
cana setup

You can run setup anytime to add more chains.

  1. List Configured Chains
cana chains list
  1. 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.

Directory Structure

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

Commands

Contract Analysis

# Basic analysis
cana analyze <address>
cana -a <address>

# Analysis with specific chain
cana analyze <address> -c <chain>
cana -a <address> -c <chain>

Chain Configuration

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

Prerequisites

  • Node.js v16 or higher
  • npm v6 or higher

Contributing

Contributions are welcome! Please read our contributing guidelines for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Usage

# 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

Example: Proxy Contract Analysis

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