# truffle-source-verify

> Verify your deployed smart contracts on Etherscan/Blockscout from the Truffle CLI

Latest version **0.0.6** (published 2021-02-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install truffle-source-verify
pnpm add truffle-source-verify
yarn add truffle-source-verify
bun add truffle-source-verify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2021-02-04 |
| First published | 2020-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 184 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | @olivdb |
| Maintainers | olivdb |
| Keywords | truffle, plugin, ethereum, etherscan, blockscout, verify |

## Links

- npm: https://www.npmjs.com/package/truffle-source-verify
- Repository: https://github.com/olivdb/truffle-source-verify
- Homepage: https://github.com/olivdb/truffle-source-verify#readme
- Issues: https://github.com/olivdb/truffle-source-verify/issues
- npm.io page: https://npm.io/package/truffle-source-verify

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) 0.19.2
- [delay](https://npm.io/package/delay.md) 4.3.0
- [cli-logger](https://npm.io/package/cli-logger.md) 0.5.40
- [sol-merger](https://npm.io/package/sol-merger.md) 3.1.0
- [querystring](https://npm.io/package/querystring.md) 0.2.0

## Recent versions

- 0.0.6 (latest) — 2021-02-04
- 0.0.5 — 2021-01-13
- 0.0.4 — 2020-12-13
- 0.0.2 — 2020-12-12
- 0.0.1 — 2020-12-12

## README

# truffle-source-verify

This truffle plugin allows you to automatically verify your smart contracts' source code on Etherscan/Blockscout, straight from the Truffle CLI.

It extends [truffle-plugin-verify](https://github.com/rkalis/truffle-plugin-verify) to also support Blockscout.

## Installation

1. Install the plugin with npm or yarn
   ```
   npm i -D truffle-source-verify
   ```
2. Add the plugin to your `truffle-config.js` file

   ```js
   module.exports = {
     /* ... rest of truffle-config */

     plugins: ["truffle-source-verify"],
   };
   ```

3. Generate an API Key on your Etherscan account (see the [Etherscan website](https://etherscan.io/apis))
4. Add your Etherscan API key to your truffle config (make sure to use something like `dotenv` so you don't commit the api key)

   ```js
   module.exports = {
     /* ... rest of truffle-config */

     api_keys: {
       etherscan: "MY_API_KEY",
     },
   };
   ```

## Usage

### On the command-line

Before running verification, make sure that you have actually deployed your contracts to a public network with Truffle.

To verify your contracts on Etherscan, run:

```
npx truffle run etherscan SomeContractName AnotherContractName --network networkName [--debug]
```

Supported networks: `mainnet`, `kovan`, `rinkeby`, `ropsten`, `goerli`.

To verify your contracts on Blockscout, run:

```
npx truffle run blockscout SomeContractName AnotherContractName --network networkName --license UNLICENSED [--debug]
```

Supported networks: `mainnet`, `xdai`, `sokol`.

See [truffle-plugin-verify](https://github.com/rkalis/truffle-plugin-verify) for more information.

### In Javascript

```
// file: ./scripts/test_verify.js
// Usage: npx truffle exec ./scripts/test_verify.js --network rinkeby

const { verify } = require("truffle-source-verify/lib");

async function main() {
  const idx = process.argv.indexOf("--network");
  const network = process.argv[idx + 1];
  await verify(["BasicContract"], network, "UNLICENSED");
}

module.exports = (cb) => main().then(cb).catch(cb);
```

---
_Source: https://npm.io/package/truffle-source-verify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
