EIPs Explained

ERC-7734 · Final · ERC · 2024-06-26

ERC-7734: Decentralized Identity Verification (DID)

A minimal on-chain identity registry where each address stores only hashes of its identity data and verification proofs, with events for creation, verification and revocation.

What problem does it solve?

Many dApps need to know that a user has passed some identity check: KYC for a DeFi pool, age verification for a game, a "real human" check for an airdrop. Centralised identity providers hold raw personal data, are frequent breach targets, and leave users with little control. Existing decentralised identity standards can be heavy to integrate.

ERC-7734 proposes a deliberately small interface: keep personal data off-chain, store only cryptographic hashes on-chain, and emit events so anyone can trace when an identity was created, verified or revoked.

How it works

Each address can hold one Identity record:

Field Meaning
userAddress The owner's address (the identity itself)
identityHash Hash of off-chain identity data
verificationHashes Two hashes derived from off-chain proofs or attestations
isVerified Current status
timestamp When the identity was created

The caller manages only their own record:

  • createIdentity(identityHash) registers it (once per address) and emits IdentityCreated.
  • verifyIdentity(bytes32[2]) stores the two verification hashes, marks the record verified and emits IdentityVerified.
  • revokeIdentity() sets isVerified back to false and emits IdentityRevoked.
  • getIdentity(user) returns the record for anyone to read.

What the verification hashes mean, and how they are produced (third-party attestation, signed document, cryptographic challenge), is left to the implementer. Names, ages and other attributes stay off-chain.

Sample code

The interface from the standard:

// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IDecentralizedIdentity {
    struct Identity {
        address userAddress;
        bytes32 identityHash;
        bytes32[2] verificationHashes;
        bool isVerified;
        uint256 timestamp;
    }

    event IdentityCreated(address indexed userAddress, bytes32 identityHash, uint256 timestamp);
    event IdentityVerified(address indexed userAddress, bytes32[2] verificationHashes, uint256 timestamp);
    event IdentityRevoked(address indexed userAddress, uint256 timestamp);

    function createIdentity(bytes32 identityHash) external;
    function verifyIdentity(bytes32[2] calldata verificationHashes) external;
    function revokeIdentity() external;
    function getIdentity(address userAddress) external view returns (Identity memory);
}

Checking a user's status from a dApp (ethers v6):

import { Contract, JsonRpcProvider } from "ethers";

const abi = [
  "function getIdentity(address) view returns (tuple(address userAddress, bytes32 identityHash, bytes32[2] verificationHashes, bool isVerified, uint256 timestamp))",
];
const registry = new Contract(REGISTRY_ADDRESS, abi, new JsonRpcProvider(RPC_URL));
const id = await registry.getIdentity(user);
console.log(id.isVerified ? "verified" : "not verified");

Things to know

  • Status is Final.
  • In the reference implementation, verifyIdentity is called by the user on their own record and is not checked against any external verifier. On its own, isVerified therefore means "the owner submitted proofs", not "a trusted party approved them". Real deployments need to restrict who can verify, or have dApps check the hashes against a trusted attester.
  • The spec recommends that verification hashes include nonces or timestamps to prevent replay, and that strong hash functions are used.
  • Hashes of low-entropy personal data (a birth date, a passport number) can be brute-forced; salt them before hashing.
  • For a different, older approach to on-chain identity, see ERC-1056; for user profiles, see ERC-7866.

#identity #did #privacy #registry

Details

Authors
Anushka Yadav (@64anushka) <[email protected]>
Status
Final
Type
Standards Track / ERC
Created
2024-06-26

Machine-readable: Markdown · JSON