ERC-1056 · Stagnant · ERC · 2018-05-03
ERC-1056: Ethereum Lightweight Identity
A shared registry contract that turns every Ethereum address into a free, DID-compatible identity, with rotating owners, time-limited delegate keys and attributes stored as events.
What problem does it solve?
Earlier identity proposals such as ERC-725 gave every user their own identity contract. Deploying a contract costs gas, so creating an identity was expensive and impossible offline. The uPort team behind this ERC wanted identities that:
- cost nothing to create and work offline, for example in a refugee scenario,
- keep the same identifier when keys are rotated,
- can be used both on-chain and off-chain.
ERC-1056 meets this by making any Ethereum address an identity by default. One shared registry contract stores only the changes.
How it works
One EthereumDIDRegistry contract is deployed once and used by everyone. For each identity (an address) it tracks:
- Owner. By default the identity owns itself.
changeOwner(identity, newOwner)lets you rotate to a new key or a multisig without changing the identifier. - Delegates.
addDelegate(identity, delegateType, delegate, validity)authorizes another key for a purpose, such as signing JWTs, forvalidityseconds.validDelegate(...)checks it, andrevokeDelegateremoves it. - Attributes.
setAttribute(identity, name, value, validity)publishes data such as service endpoints or encryption keys.revokeAttributeremoves it.
Every write function has a …Signed variant that takes a raw (v, r, s) signature from the owner, so a third party can pay the gas.
To save gas, delegates and attributes are mainly recorded as events (DIDOwnerChanged, DIDDelegateChanged, DIDAttributeChanged). Each event includes previousChange, the block of the identity's previous update, and the contract stores the latest one in changed[identity]. A resolver walks backwards through these linked blocks to rebuild the full history cheaply, then assembles a W3C DID document.
Sample code
Adding a 30-day signing delegate (ethers v6). REGISTRY is the deployed registry address on your network:
import { Contract, Wallet, JsonRpcProvider, encodeBytes32String } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const owner = new Wallet(process.env.PRIVATE_KEY!, provider);
const registry = new Contract(REGISTRY, [
"function addDelegate(address identity, bytes32 delegateType, address delegate, uint validity)",
"function validDelegate(address identity, bytes32 delegateType, address delegate) view returns (bool)",
"function changed(address) view returns (uint)",
], owner);
const delegate = Wallet.createRandom().address;
const type = encodeBytes32String("veriKey");
await (await registry.addDelegate(owner.address, type, delegate, 30 * 24 * 3600)).wait();
console.log(await registry.validDelegate(owner.address, type, delegate)); // true
Things to know
- This ERC is Stagnant and never reached Final. Its reference implementation became the basis of the
did:ethrDID method (ethr-did-registry,ethr-did-resolver). - The spec leaves the exact delegate types and attribute names "to be determined". Real resolvers follow conventions defined by the
did:ethrmethod spec. - Data published in events is public and permanent. Never put personal data in attributes.
- Delegates expire automatically, but revoking early still needs a transaction.
- Related identity work includes ERC-725 (Draft) and ERC-1812 (Stagnant).