ERC-1056 Lightweight Ethereum Identity (DID) Registry (Ethereum Lightweight Identity)
Stagnant · Accounts & wallets · created 2018-05-03
A lightweight identity standard that lets a keypair account serve directly as both an identity and a DID, while a registry contract manages its owner, delegates, and attributes without gas cost.
Why it is needed
Under the ERC-725 approach, a contract had to be deployed every time an identity was created, which cost gas and made it impossible to even create an identity in offline environments with no internet access (such as refugee situations). There was also a problem where, even if you wanted to rotate keys for security, the key itself was the identity's identifier, so changing the key effectively changed the identity too. Furthermore, since smart contract accounts are authenticated in transactions only via msg.sender, they could not directly participate in off-chain signature-based interactions where a third party pays the gas or that operate on a receiver-pays basis. These constraints were an obstacle for services that needed to run identities cheaply, both on-chain and off-chain, at the same time.
What to implement
function identityOwner(address identity) public view returns(address);: Returns the current owner address of the given identity.function changeOwner(address identity, address newOwner) public;: Changes the owner of the identity to a different Ethereum account.function changeOwnerSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, address newOwner) public;: Same as changeOwner, but changes the owner using a separate raw signature instead of the transaction signer.function validDelegate(address identity, bytes32 delegateType, address delegate) public view returns(bool);: Returns whether the given delegate is a valid delegate for the identity under the given delegateType.function addDelegate(address identity, bytes32 delegateType, address delegate, uint validity) public;: Adds a new delegate with the given delegateType to the identity, valid for validity seconds.function addDelegateSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 delegateType, address delegate, uint validity) public;: Same as addDelegate, but adds the delegate using a raw signature.function revokeDelegate(address identity, bytes32 delegateType, address delegate) public;: Revokes the given delegate for the identity.function revokeDelegateSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 delegateType, address delegate) public;: Same as revokeDelegate, but revokes the delegate using a raw signature.function setAttribute(address identity, bytes32 name, bytes value, uint validity) public;: Sets name and value on the identity as an attribute valid for validity seconds.function setAttributeSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 name, bytes value, uint validity) public;: Same as setAttribute, but sets the attribute using a raw signature.function revokeAttribute(address identity, bytes32 name, bytes value) public;: Revokes the given attribute for the identity.function revokeAttributeSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32 name, bytes value) public;: Same as revokeAttribute, but revokes the attribute using a raw signature.
In depth
Managing identity ownership
By default, an identity is owned by itself, meaning the Ethereum account that controls that address. identityOwner(address identity) returns the current owner of the identity. changeOwner(address identity, address newOwner) changes the owner to a new account, and the new owner can be a smart contract account such as a multisig, not just a keypair account. changeOwnerSigned performs the same action using a separate raw signature (sigV, sigR, sigS) instead of the transaction signer. Changing the owner does not change the identity's identifier, the address itself.
Managing delegates
A delegate is an address granted authority to perform specific functions on behalf of an identity for a set period. delegateType is a delegation purpose defined by a higher level protocol or application, such as did-jwt or raiden. addDelegate(identity, delegateType, delegate, validity) adds a delegate valid for validity seconds, and validDelegate checks whether a given delegate is valid for that delegateType. revokeDelegate revokes a delegate, and addDelegateSigned and revokeDelegateSigned perform the same actions using raw signatures.
Managing attributes
An attribute is simple data attached to an identity that only the owner can manage. setAttribute(identity, name, value, validity) sets name and value valid for validity seconds, and revokeAttribute revokes an attribute. setAttributeSigned and revokeAttributeSigned are the raw signature versions of each.
Looking up events via previousChange
DIDOwnerChanged, DIDDelegateChanged, and DIDAttributeChanged events fire whenever an owner, delegate, or attribute change succeeds respectively. Each event has a previousChange field pointing to the block number of the most recent prior change for that identity. Since the changed mapping stores the last change block per identity, off-chain code can start from the changed value and follow previousChange backward to efficiently reconstruct the full history.
How to build a DID document
The first publicKey in the DID document is the owner key obtained from identityOwner(identity). Iterating over DIDDelegateChanged events builds additional keys and authentication entries, and iterating over DIDAttributeChanged events builds public names such as service entries and encryption public keys. However, the source notes that the list of delegateTypes and attribute names to include is still to be determined.
Background on signature delegation
Ethereum transactions always have a sender verified via msg.sender, but as receiver-pays setups where a third party covers gas fees become more common, transactions are increasingly authenticated by externally generated signatures rather than the actual sender. Since such signatures must be produced by an actual keypair, smart contract accounts cannot create them directly. This ERC proposes a way for a smart contract or a regular keypair to delegate signing authority to an externally managed keypair, allowing smart contract accounts to be represented through temporary or permanent delegates not only on-chain but also off-chain or in payment channels.
Implementation and deployment
The reference implementation is provided as the EthereumDIDRegistry contract (ethr-did-registry), a DID-compatible resolver (ethr-did-resolver), and a JavaScript library (ethr-did). EthereumDIDRegistry is deployed at the same address, 0xdca7ef03e98e0dc2b855be647c39abe984fcf21b, on mainnet, Ropsten, Rinkeby, and Kovan, so everyone can use it as a shared resource.
Proposal status
This proposal is currently Stagnant, meaning it is no longer being actively discussed and has stalled. Its content may change or may never be adopted.