Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
Background
ERC-7734 proposes using cryptographic hashes for decentralized identity verification in decentralized applications (dApps) while keeping detailed identity data private.
This article translates and explains the proposal below.
I also cover other EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
ERC-7734 proposes a standard for decentralized identity verification. It uses cryptographic hashes to represent identity and verification data and emits events to make state changes observable.
The design emphasizes simplicity, privacy, and user control. Keeping detailed data off-chain reduces integration overhead for developers and limits what users must publish on-chain.
The on-chain identity record is deliberately small. Users and service providers handle identity checks and attributes off-chain. The blockchain records commitments and makes later changes detectable while keeping the underlying data outside the contract.
Motivation
Traditional centralized identity systems have several drawbacks.
- Complicated workflows burden both providers and users.
- Database breaches and unauthorized access can expose personal data.
- Users depend on the entity managing their identity data.
Existing decentralized identity solutions address some of these issues, but broad feature sets can make them difficult to adopt. ERC-7734 focuses on three goals.
- Simple decentralized interface. Provide the basic operations needed for identity verification.
- Privacy. Keep detailed identity data off-chain and use hashes to represent the underlying evidence.
- Broad adoption. Keep integration straightforward for dApps and existing services in areas such as DeFi, gaming, and social networks.
Specification
The proposal defines a minimal on-chain interface for managing identity records. The application determines what evidence it accepts and how it checks that evidence.
Identity contract
The identity contract records verification status on-chain and emits events so verification state can be tracked.
Verification function
A user submits two hashes through verifyIdentity. The hashes can represent off-chain evidence or third-party attestations. An implementation can check the evidence associated with those hashes and update the verification state.
identityHashis the cryptographic hash representing the user's identity data.verificationHashis a cryptographic hash derived from evidence or an attestation. The interface groups two such hashes inverificationHashes.
IdentityVerified event
Successful verification emits IdentityVerified, which dApps and users can track.
Identity structure
The identity record is keyed by a unique Ethereum address. Attributes such as a name or age are optional and managed off-chain, allowing applications to extend the workflow without expanding the on-chain structure.
Interface
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);
}Identity
struct Identity {
address userAddress;
bytes32 identityHash;
bytes32[2] verificationHashes;
bool isVerified;
uint256 timestamp;
}This struct represents a user's decentralized identity. The minimal on-chain data supports traceability while leaving room for off-chain extensions.
userAddressis the user's Ethereum address.identityHashis the hash of the identity data.verificationHashesholds the two hashes used for verification.isVerifiedrecords whether the identity is marked as verified.timestamprecords when the identity was created.
IdentityCreated
event IdentityCreated(address indexed userAddress, bytes32 identityHash, uint256 timestamp);The contract emits this event when a user creates an identity. Other dApps and services can use it to detect registrations.
userAddressidentifies the user who created the identity.identityHashis the hash of the identity data.timestamprecords the creation time.
IdentityVerified
event IdentityVerified(address indexed userAddress, bytes32[2] verificationHashes, uint256 timestamp);The event indicates that the contract marked the identity as verified. A relying party still needs to know what verification the implementation performs.
userAddressidentifies the user whose identity was verified.verificationHashescontains the two verification hashes.timestamprecords when verification completed.
IdentityRevoked
event IdentityRevoked(address indexed userAddress, uint256 timestamp);The event indicates that a user revoked their identity. A user might do this for security reasons or when leaving a service.
userAddressidentifies the user who revoked the identity.timestamprecords the time of revocation.
createIdentity
function createIdentity(bytes32 identityHash) external;Registers the caller's decentralized identity on-chain using the supplied identityHash.
verifyIdentity
function verifyIdentity(bytes32[2] calldata verificationHashes) external;Submits two verificationHashes derived from external evidence or attestations. Successful verification emits IdentityVerified.
revokeIdentity
function revokeIdentity() external;Lets the user invalidate their identity, for example after a security incident or when they stop using a service.
getIdentity
function getIdentity(address userAddress) external view returns (Identity memory);Returns the full Identity struct for the specified Ethereum userAddress. A dApp or service can read the struct to check its verification status.
Additional notes
The design uses cryptographic hashes to represent identity data instead of storing plaintext personal information on-chain. A hash can serve as a commitment to the original data and support tamper detection and traceability. A hash of easily guessed data can still be vulnerable to guessing, which is why input handling matters.
Projects can use verificationHashes to represent different types of off-chain evidence, including responses to cryptographic challenges, third-party attestations, or hashes produced by an external KYC process. The standard leaves the hashes' meaning to the implementation.
The IdentityCreated, IdentityVerified, and IdentityRevoked logs let dApps and external audit systems reconstruct the history of state changes. Together, commitments and event logs let different identity workflows share a small on-chain interface.
Reference implementation
Here is a minimal implementation of the interface.
pragma solidity ^0.8.0;
import "./IDecentralizedIdentity.sol";
contract DecentralizedIdentity is IDecentralizedIdentity {
// Mapping to store identities by user address
mapping(address => Identity) private identities;
// Function to create a new decentralized identity for the caller.
// Parameters:
// - identityHash Hash of the identity data.
function createIdentity(bytes32 identityHash) external override {
// Ensure identity does not already exist
require(identities[msg.sender].userAddress == address(0), "Identity already exists");
// Create the identity for the caller
identities[msg.sender] = Identity({
userAddress: msg.sender,
identityHash: identityHash,
verificationHashes: [bytes32(0), bytes32(0)], // Initialize with empty hashes
isVerified: false,
timestamp: block.timestamp
});
// Emit event for the creation of a new identity
emit IdentityCreated(msg.sender, identityHash, block.timestamp);
}
// Function to verify the decentralized identity for the caller.
// Parameters:
// - verificationHashes: Hashes used for verifying the identity.
function verifyIdentity(bytes32[2] calldata verificationHashes) external override {
// Ensure identity exists
require(identities[msg.sender].userAddress != address(0), "Identity does not exist");
// Update verification hashes and mark identity as verified
identities[msg.sender].verificationHashes = verificationHashes;
identities[msg.sender].isVerified = true;
// Emit event for the verification of identity
emit IdentityVerified(msg.sender, verificationHashes, block.timestamp);
}
// Function to revoke the decentralized identity for the caller.
function revokeIdentity() external override {
// Ensure identity exists
require(identities[msg.sender].userAddress != address(0), "Identity does not exist");
// Mark identity as not verified
identities[msg.sender].isVerified = false;
// Emit event for the revocation of identity
emit IdentityRevoked(msg.sender, block.timestamp);
}
// Function to retrieve the decentralized identity for a given user address
// Parameters:
// - userAddress Ethereum address of the user.
// Returns:
// identity The decentralized identity struct.
function getIdentity(address userAddress) external view override returns (Identity memory) {
return identities[userAddress];
}
}The implementation stores one Identity per address in a mapping(address => Identity). Creation, verification, and revocation act only on the caller's own record, identified by msg.sender. Each state change emits an event.
| Operation | Prerequisite | State change | Event |
|---|---|---|---|
createIdentity |
The address has no existing identity. | Create an Identity with isVerified=false. |
IdentityCreated |
verifyIdentity |
The address has an Identity. |
Update verificationHashes and set isVerified=true. |
IdentityVerified |
revokeIdentity |
The address has an Identity. |
Set isVerified=false and retain the hashes. |
IdentityRevoked |
getIdentity |
None. | Read state only. | None. |
The off-chain workflow determines what goes into verificationHashes. For example, one slot could hold the hash of a challenge response and the other the hash of an attester's signature. The sample above records the hashes supplied by the caller and sets the flag. A production verifier must independently validate the actual evidence before treating that flag as proof of identity.
Example of generating hashes off-chain
// 例:EIP-712のような「誰が・何に・いつ同意したか」を明確化する型付きデータに対し、
// 署名とハッシュを作るフロントエンド側の疑似コード(ethers.js想定)
import { keccak256, toUtf8Bytes, solidityPackedKeccak256 } from "ethers";
// アイデンティティ本体(PII)は絶対に送らず、ソルト付きでハッシュ化
const identityPlain = JSON.stringify({ name: "Alice", dob: "1990-01-01" });
const identitySalt = crypto.getRandomValues(new Uint8Array(32));
const identityHash = keccak256(
new Uint8Array([...toUtf8Bytes(identityPlain), ...identitySalt])
);
// チャレンジ応答やアテステーションを、アドレス・チェーンID・有効期限・nonceと束ねてハッシュ化
const challenge = "proof:email@domain.tld";
const nonce = crypto.getRandomValues(new Uint8Array(16));
const expiresAt = Math.floor(Date.now()/1000) + 15*60; // 15分有効
const verificationHashA = solidityPackedKeccak256(
["address","uint256","bytes32","bytes","uint256","bytes16"],
[userAddress, chainId, identityHash, toUtf8Bytes(challenge), expiresAt, nonce]
);
// もう一方は、外部アテスターの署名やサーバー側ハッシュなどを格納
const verificationHashB = keccak256(toUtf8Bytes("attestor:example.org:signatureblob"));
// これら2つを verificationHashes に渡す
// verifyIdentity([verificationHashA, verificationHashB])Security considerations
ERC-7734 leaves hash generation and verification policy to each implementation.
Secure hashing
Use collision-resistant and preimage-resistant hashing for identity and verification data. Solidity provides keccak256, and off-chain code must use a compatible hash when it needs to reproduce the commitment. Salting and domain separation help limit guessing and cross-context reuse.
- Include a salt or context such as the
chainId,userAddress, or a purpose tag so equivalent inputs can have distinct commitments across contexts. - Use a consistent serialization format, such as JSON with stable ordering or ABI encoding, so field ordering and types do not change across implementations.
Replay attacks
Other parties can observe verificationHashes. Implementations must consider how to stop an old proof from being reused.
| Threat | Example mitigation |
|---|---|
| Resubmission of stale verification data | Bind expiresAt to the evidence and reject expired proofs. |
| Repeated submission | Track usedNonce per user and reject reused nonces. |
| Reuse in another context | Bind the userAddress, chainId, and purpose tag to the hash. |
The following example illustrates nonce tracking and expiry checks. The verifier still needs to check that the proof authenticates those values.
// 例:verifyIdentity 内で nonce を消費し、二重使用を拒否する拡張イメージ
mapping(address => mapping(bytes16 => bool)) private usedNonce;
function verifyIdentity(bytes32[2] calldata verificationHashes, bytes16 nonce, uint256 expiresAt) external {
require(block.timestamp <= expiresAt, "expired");
require(!usedNonce[msg.sender][nonce], "nonce used");
require(identities[msg.sender].userAddress != address(0), "Identity does not exist");
usedNonce[msg.sender][nonce] = true;
identities[msg.sender].verificationHashes = verificationHashes;
identities[msg.sender].isVerified = true;
emit IdentityVerified(msg.sender, verificationHashes, block.timestamp);
}Implementation flexibility
Projects decide what each hash means and which rules govern verification.
- Attester authenticity. Third-party attesters can sign EIP-712 typed data. Bind the attester's key or identifier to the evidence and verify the signature against the expected attester key.
See the following article for background on EIP-712.
[EIP-712] How to hash and sign structured typed data
- Front-running resistance. The sample writes to the caller's own record, so another address cannot take over that record by copying its transaction. Bind the proof to
userAddressso it cannot serve as evidence for another address. - Privacy. Keep plaintext identity data out of event logs, and use sufficient random salt to make guessing hash inputs more difficult.
Example of signing EIP-712 typed data
// 署名対象に userAddress / chainId / purpose / identityHash / nonce / expiresAt を含めることで
// 誰が・どのチェーンで・何の目的で・いつまで有効か、を一意に固定できます。
const typedData = {
domain: { name: "DID", version: "1", chainId, verifyingContract: contractAddress },
types: {
Verify: [
{ name: "user", type: "address" },
{ name: "purpose", type: "string" },
{ name: "identityHash", type: "bytes32" },
{ name: "nonce", type: "bytes16" },
{ name: "expiresAt", type: "uint256" },
],
},
message: {
user: userAddress,
purpose: "did.verify",
identityHash,
nonce,
expiresAt,
},
};
// 署名し、そのハッシュを verificationHashes[0] に格納する運用などが可能Citation
Anushka Yadav (@64anushka) 64anushka@gmail.com, "ERC-7734: Decentralized Identity Verification (DID)," Ethereum Improvement Proposals, no. 7734, June 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7734.
Conclusion
ERC-7734 proposes a minimal interface for using commitments and event logs in decentralized identity workflows. Applications can keep sensitive identity details off-chain and provide validation rules suited to the evidence they accept.
Questions are welcome by direct message.
Find more of my writing and resources here.



