---
eip: 2678
label: ERC-2678
title: Revised Ethereum Smart Contract Packaging Standard (EthPM v3)
status: Final
type: Standards Track
category: ERC
created: 2020-05-26
official: https://eips.ethereum.org/EIPS/eip-2678
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-2678.md
canonical: https://eips.huatuo.xyz/eip-2678/
lang: en
tldr: "EthPM v3: a JSON manifest format describing a smart contract package (sources, ABIs, bytecode, compilers, deployments and dependencies), so packages can be shared and verified across tools."
tags: [ethpm, packaging, tooling, json, erc]
---

# ERC-2678: Revised Ethereum Smart Contract Packaging Standard (EthPM v3)

> A data format describing a smart contract software package.

**TL;DR:** EthPM v3: a JSON manifest format describing a smart contract package (sources, ABIs, bytecode, compilers, deployments and dependencies), so packages can be shared and verified across tools.

## What problem does it solve?

Reusing contracts across projects means sharing more than source code: ABIs, compiled bytecode, compiler settings, library link points and the addresses where things are already deployed, on which chains. Without a common format, every framework invented its own.

EthPM defines a standard **package manifest** for all of that. Version 3 (this EIP) revises the earlier formats ([ERC-190](/eip-190/) and [ERC-1123](/eip-1123/), EthPM v2) to align with the Solidity compiler's metadata and JSON input formats. Manifests are meant to be stored on content-addressed storage such as IPFS and listed in on-chain registries ([ERC-1319](/eip-1319/)).

## How it works

A manifest is a single JSON object. Main top-level keys:

| Key | Contents |
| --- | --- |
| `manifest` | Required. Must be `"ethpm/3"` |
| `name`, `version` | Package name (`^[a-z][-a-z0-9]{0,255}$`) and version (semver recommended) |
| `meta` | Authors, license (SPDX), description, keywords, links |
| `sources` | Source files: inline `content` or `urls`, optional `checksum`, `installPath`, `license` |
| `contractTypes` | Per contract: `abi`, `deploymentBytecode`, `runtimeBytecode`, `devdoc`, `userdoc`, `sourceId` |
| `compilers` | Array of `{name, version, settings, contractTypes}` |
| `deployments` | Deployed instances, keyed by chain URI then instance name |
| `buildDependencies` | Package name → content-addressed URI of another manifest |

Key details:

- **Canonical form.** Manifests must be minified (no whitespace), keys sorted alphabetically, UTF-8, no trailing newline. That guarantees the same package always hashes to the same IPFS URI.
- **Chains are identified by BIP-122 URIs**: `blockchain://<genesis_hash>/block/<block_hash>`, which pins both the chain and a confirmed block, distinguishing forks.
- **Linking.** Bytecode objects can list `linkReferences` (offsets of library placeholders) and `linkDependencies` (the values to fill in), so unlinked bytecode can be completed reproducibly.
- Custom fields are allowed and should start with `x-`. The v2 key `manifest_version` is forbidden in v3.

## Sample code

A small manifest, pretty-printed for reading (a real one must be minified with sorted keys; the address and block hash are placeholders):

```json
{
  "compilers": [
    { "contractTypes": ["Owned"], "name": "solc",
      "settings": { "optimizer": { "enabled": true, "runs": 200 } },
      "version": "0.8.20" }
  ],
  "contractTypes": {
    "Owned": { "abi": [], "runtimeBytecode": { "bytecode": "0x6080..." }, "sourceId": "Owned.sol" }
  },
  "deployments": {
    "blockchain://d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3/block/<block_hash>": {
      "Owned": { "address": "0x1234567890123456789012345678901234567890", "contractType": "Owned" }
    }
  },
  "manifest": "ethpm/3",
  "meta": { "authors": ["Alice"], "license": "MIT" },
  "name": "owned",
  "sources": { "Owned.sol": { "type": "solidity", "urls": ["ipfs://<cid>"] } },
  "version": "1.0.0"
}
```

Producing the canonical form (TypeScript):

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

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

## Things to know

- **Status: Final.** A JSON Schema for the format is published with the EIP.
- Reference a dependency's contract in a deployment as `<package-name>:<contract-alias>`.
- Exact byte-for-byte reproducibility matters: a different key order or whitespace yields a different IPFS hash.
- A manifest guarantees you get exactly the code the author published, not that the code is safe. Only install packages from authors you trust.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-2678
