ERC-2942 - EthPM URI Specification

Created 2020-09-04
Status Stagnant
Category ERC
Type Standards Track
Authors
Requires

Simple Summary

A custom URI scheme to identify an EthPM registry, package, release, or specific contract asset within a release.

Abstract

When interacting with the EthPM ecosystem, users and tooling can benefit from a URI scheme to identify EthPM assets. Being able to specify a package, registry, or release with a single string makes simplifies the steps required to install, publish, or distribute EthPM packages.

Specification

scheme://registry_address[:chain_id][/package_name[@package_version[/json_pointer]]]

scheme

registry_address

chain_id

package_name

package_version

json_pointer

Rationale

Most interactions within the EthPM ecosystem benefit from a single-string representation of EthPM assets; from installing a package, to identifying a registry, to distributing a package. A single string that can faithfully represent any kind of EthPM asset, across the mainnet or testnets, reduces the mental overload for new users, minimizes configuration requirements for frameworks, and simplifies distribution of packages for package authors.

Test Cases

A JSON file for testing various URIs can be found in the ethpm-spec repository fixtures.

Implementation

The EthPM URI scheme has been implemented in the following libraries: - Brownie - Truffle - EthPM CLI

Security Considerations

In most cases, an EthPM URI points to an immutable asset, giving full security that the target asset has not been modified. However, in the case where an EthPM URI uses an ENS name as its registry address, it is possible that the ENS name has been redirected to a new registry, in which case the guarantee of immutability no longer exists.

Copyright

Copyright and related rights waived via CC0.