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

forge-verify

v1.0.1

Published

A utility for verifying Foundry/Forge compiled smart contracts on Etherscan

Downloads

17

Readme

Forge-Verify

A utility for verifying Foundry/Forge compiled smart contracts on Etherscan.

Description

Forge-Verify is a command-line tool that simplifies the process of verifying smart contracts deployed with Foundry on Etherscan. It automatically extracts necessary information from your Foundry deployment files and submits verification requests to Etherscan through their API.

Features

  • Automatic verification of all contracts in a deployment
  • Support for verifying specific contracts
  • Automatic detection of compiler versions and optimizer settings
  • Support for constructor arguments
  • Flexible command-line interface
  • No configuration files needed

Installation

# Install globally
npm install -g forge-verify

# Or use with npx
npx forge-verify

Prerequisites

  • Node.js >= 14.0.0
  • Foundry/Forge toolchain installed
  • An Etherscan API key
  • RPC URL for the target network

Usage

Basic Usage

Verify all contracts from the latest deployment by providing the required parameters:

forge-verify --chainId=1 --etherscan=YOUR_API_KEY --rpcUrl=YOUR_RPC_URL

Command Line Options

Usage: forge-verify [options]

Options:
  -c, --chainId     The chain ID of the network                [string] [required]
  -e, --etherscan   Your Etherscan API key                     [string] [required]
  -r, --rpcUrl      RPC URL for the network                    [string] [required]
  -t, --target      Target deployment by block number          [string] [default: "latest"]
  -s, --script      Deployment script name                     [string]
  -h, --help        Show help                                  [boolean]
      --contracts   Comma-separated list of specific contracts to verify [string]

Examples:
  forge-verify --chainId=1 --etherscan=YOUR_API_KEY --rpcUrl=YOUR_RPC_URL      Verify all contracts from the latest deployment
  forge-verify --chainId=1 --etherscan=YOUR_API_KEY --rpcUrl=YOUR_RPC_URL --contracts=MyToken,Vault    Verify specific contracts

Examples

Verify a specific deployment using block number:

forge-verify --chainId=1 --etherscan=YOUR_API_KEY --rpcUrl=YOUR_RPC_URL --target=15784932

Verify specific contracts:

forge-verify --chainId=1 --etherscan=YOUR_API_KEY --rpcUrl=YOUR_RPC_URL --contracts=MyToken,Vault

Specify deployment script:

forge-verify --chainId=1 --etherscan=YOUR_API_KEY --rpcUrl=YOUR_RPC_URL --script=Deploy.s.sol

Use with a different network (Goerli testnet):

forge-verify --chainId=5 --etherscan=YOUR_API_KEY --rpcUrl=YOUR_GOERLI_RPC_URL

How It Works

  1. Reads deployment data from Foundry broadcast files
  2. Extracts contract addresses and constructor arguments
  3. Determines compiler version and optimizer settings from contract artifacts
  4. Submits verification requests to Etherscan with proper parameters
  5. Monitors verification status until completion

Troubleshooting

  • Error: No deploy scripts found in the script directory

    • Ensure you have at least one script file in the ./script directory
  • Error: Specified contract not found in deployment data

    • Check that the contract name matches exactly what's in your deployment script
    • Verify that the contract was deployed in the targeted deployment run
  • Verification failure

    • Check that your Etherscan API key is valid
    • Ensure the contract was deployed on the specified chain
    • Verify that the exact compiler version used for deployment is available

License

Apache License 2.0 - See LICENSE for details.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

Programmatic Usage

You can also use forge-verify programmatically in your Node.js applications:

const { verifyContracts } = require('forge-verify');

// Example usage
const main = async () => {
  try {
    await verifyContracts({
      chainId: '1',
      etherscan: 'YOUR_ETHERSCAN_API_KEY',
      rpcUrl: 'YOUR_RPC_URL',
      target: 'latest',
      script: 'Deploy.s.sol',
      contracts: 'MyToken,Vault' // Optional
    });
    console.log('Verification completed successfully!');
  } catch (error) {
    console.error('Error verifying contracts:', error);
  }
};

main();