ERC-190 · Final · ERC · 2017-01-10
ERC-190: Ethereum Smart Contract Packaging Standard
The first ethPM packaging standard: a content-addressed "release lockfile" that bundles contract sources, ABIs, bytecode and deployed addresses so code can be reused and verified.
What problem does it solve?
In 2017 Ethereum had no equivalent of npm or PyPI. If you wanted to reuse a well-audited token or owned contract, you copied the source by hand, or more often wrote your own. The spec points out that this hurt both productivity and security. To use an already-deployed library or service, you also had to find its address and ABI on your own.
ERC-190 was written jointly by the maintainers of Truffle, Populus, Dapple, Eris PM and Embark. It defines one package format that every framework could read and write.
How it works
The standard itself is short. It points to version 1.0.0 of the external ethPM spec, which defines a single JSON document called a Release Lockfile. A lockfile can describe three kinds of package:
- Base contracts meant to be inherited, such as
owned. - Ready-to-use contracts, such as an ERC-20 token.
- Deployed contracts, such as libraries or services already on chain.
The format is designed so that package managers can offer:
- Deterministic builds. Sources and dependencies are referenced by content hash (for example IPFS URIs), so they cannot change after release.
- Bytecode verification. The lockfile has enough compiler information for a tool to rebuild the code and check it against what is deployed.
- Multi-chain deployments. One package can list addresses on mainnet and testnets, keyed by chain.
- Trusted packages. Minimal packages may leave out the source when no verification is needed.
Sample code
An illustrative, trimmed release lockfile in the v1 style (hashes and addresses are placeholders):
{
"lockfile_version": "1",
"package_name": "owned",
"version": "1.0.0",
"meta": {
"authors": ["Alice <[email protected]>"],
"license": "MIT",
"description": "Basic ownership pattern"
},
"sources": {
"./contracts/Owned.sol": "ipfs://Qm...source-hash"
},
"contract_types": {
"Owned": {
"abi": [{ "type": "function", "name": "owner", "inputs": [], "outputs": [{ "type": "address" }] }],
"runtime_bytecode": "0x6080..."
}
},
"deployments": {
"blockchain://<genesis-hash>/block/<block-hash>": {
"Owned": { "contract_type": "Owned", "address": "0x..." }
}
},
"build_dependencies": {}
}
Things to know
- The normative details live in the external
ethpm/epm-specrepository at tagv1.0.0, not in the EIP text. Read that repository for the full field list. - The format was revised later. ERC-1123 (ethPM v2) was withdrawn, and ERC-2678 (ethPM v3) is the current revision. New tooling should target v3.
- The spec expected wallets to use packages together with ENS names to build interfaces for deployed contracts. That vision never became mainstream. Today most code reuse happens through Git or npm packages such as OpenZeppelin Contracts, and verification happens through block explorers.
- Several of the frameworks listed as supporters are no longer maintained.