Package management via EthPM

When installing EthPM packages, an installed_contracts directory is created if it doesn't exist. This directory can be treated in a manner similar to the node_modules directory.

Installing a package from EthPM is nearly as easy as installing a package via NPM. You can simply run the following command:

truffle install <package name>

You can also install a package at a specific version:

truffle install <package name>@<version>

Like NPM, EthPM versions follow semver. Your project can also define an ethpm.json file, which is similar to package.json for npm packages. To install all dependencies listed in the ethpm.json file, run the following:

truffle install

An example ethpm.json file looks like this:

{  "package_name": ...

Get Building Blockchain Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.