EIPs Explained

ERC-1123 · Withdrawn · ERC · 2018-06-01

ERC-1123: Revised Ethereum Smart Contract Packaging Standard

Version 2 of the EthPM package manifest: a strict JSON format describing smart contract sources, ABIs, bytecode and deployments, later replaced by EthPM v3.

What problem does it solve?

Reusing someone else's smart contracts is harder than reusing a normal library. You need the source, the compiler settings, the ABI, the bytecode, and often the addresses where the contracts are already deployed on each chain. Without a shared format, every tool invented its own.

EIP-190 introduced the EthPM "release lockfile". ERC-1123 is the revised version 2: it renames the file to a package manifest, supports languages other than Solidity, generalizes storage URIs beyond IPFS, and makes link references more flexible. The idea is that a manifest carries enough information to install a package, build on it, and verify its deployed bytecode.

How it works

A manifest is a single JSON object, usually stored on content-addressed storage such as IPFS and pointed to by a registry. Top-level fields include:

Field Purpose
manifest_version Always "2" for this spec (required)
package_name Human-readable name (required)
version Release version, ideally semver (required)
meta Authors, license, description, keywords, links
sources Map of ./relative/path to source text or a content-addressed URI
contract_types Contract names with ABI, deployment/runtime bytecode, compiler info
deployments Deployed instances keyed by chain
build_dependencies Other EthPM packages this one depends on

Chains in deployments are identified by BIP122-style URIs, blockchain://<genesis_hash>/block/<block_hash>, rather than by a numeric chain ID.

Link references describe gaps in bytecode (for example, a library address) by offset and length, so a tool can fill them in when deploying.

The format is deliberately strict so that the same package always hashes the same: no whitespace or line breaks, keys sorted alphabetically, UTF-8, no trailing newline. Custom fields are allowed but should start with x-.

Sample code

A minimal manifest, pretty-printed here for reading. The canonical form must be minified with sorted keys:

{
  "contract_types": {
    "Owned": {
      "abi": [
        { "type": "function", "name": "owner", "inputs": [],
          "outputs": [{ "name": "", "type": "address" }], "stateMutability": "view" }
      ]
    }
  },
  "manifest_version": "2",
  "meta": { "authors": ["Alice"], "license": "MIT" },
  "package_name": "owned",
  "sources": { "./contracts/Owned.sol": "ipfs://<cid-of-source>" },
  "version": "1.0.0"
}

Producing the canonical bytes in TypeScript:

const sortKeys = (v: any): any =>
  Array.isArray(v) ? v.map(sortKeys)
  : v && typeof v === "object"
    ? Object.fromEntries(Object.keys(v).sort().map((k) => [k, sortKeys(v[k])]))
    : v;

const canonical = JSON.stringify(sortKeys(manifest)); // no spaces, no trailing newline

Things to know

  • Status: Withdrawn. The authors abandoned it in favor of EthPM v3, ERC-2678. Use that spec if you need the EthPM format at all.
  • The spec covers only the data format. Registry interfaces and how tools store packages on disk were explicitly out of scope.
  • The spec text is inconsistent about allowed package_name characters; a lowercase name with letters and digits only satisfies both versions.
  • Tool support listed in the spec (Truffle, Populus, Embark) reflects 2018; several of those tools are no longer maintained.

#ethpm #packaging #tooling #manifest #json

Details

Authors
g. nicholas d’andrea (@gnidan), Piper Merriam (@pipermerriam), Nick Gheorghita (@njgheorghita), Danny Ryan (@djrtwo)
Status
Withdrawn
Type
Standards Track / ERC
Created
2018-06-01

Machine-readable: Markdown · JSON