Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ERC: Decentralized Identity Verification (DID) #517

Merged
merged 28 commits into from
Dec 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cfcc81d
Create erc-64.md
64anushka Jul 2, 2024
46ec3f9
Rename erc-64.md to erc-7734.md
64anushka Jul 3, 2024
70e3a87
Update erc-7734.md
64anushka Jul 3, 2024
b8ce50d
Merge branch 'master' into patch-1
64anushka Jul 3, 2024
f35fb42
Merge branch 'master' into patch-1
64anushka Jul 4, 2024
446a742
Merge branch 'master' into patch-1
64anushka Jul 8, 2024
de9cceb
Rename erc-7734.md to ERCS/erc-7734.md
SamWilsn Jul 23, 2024
5999900
Update erc-7734.md
64anushka Jul 23, 2024
d513455
Update erc-7734.md
64anushka Jul 23, 2024
3cc7424
Update erc-7734.md
64anushka Jul 23, 2024
16fccc0
Update erc-7734.md
64anushka Jul 23, 2024
2fe82ef
Update erc-7734.md
64anushka Sep 27, 2024
cff8663
Update ERCS/erc-7734.md
64anushka Sep 27, 2024
57d79b5
Update erc-7734.md
64anushka Sep 27, 2024
5a20c36
Update erc-7734.md
64anushka Sep 27, 2024
0572bf7
Merge branch 'master' into patch-1
64anushka Sep 27, 2024
d8a73ce
Update erc-7734.md
64anushka Nov 21, 2024
a694d4f
Update erc-7734.md
64anushka Nov 21, 2024
3fe3833
Update erc-7734.md
SamWilsn Dec 10, 2024
5fb5d29
Update erc-7734.md
SamWilsn Dec 10, 2024
9478bf6
Update erc-7734.md
SamWilsn Dec 10, 2024
ac1e8fb
Update erc-7734.md
64anushka Dec 10, 2024
327025f
Merge branch 'master' into patch-1
64anushka Dec 10, 2024
f1f40bb
Update erc-7734.md
64anushka Dec 10, 2024
6cbffc8
Merge branch 'master' into patch-1
64anushka Dec 11, 2024
ccdffa5
Update erc-7734.md
64anushka Dec 12, 2024
e4caeec
Merge branch 'master' into patch-1
SamWilsn Dec 16, 2024
1f8973e
Update erc-7734.md
SamWilsn Dec 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 153 additions & 0 deletions erc-64.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
---
eip: xx
title: Decentralized Identity Verification (DID) Standard
description: A standard for decentralized identity verification on the Ethereum blockchain.
author: Anushka Yadav <64anushka@gmail.com>
discussions-to: https://ethereum-magicians.org/t/discussion-on-decentralized-identity-verification-did-standard/20392
status: Draft
type: Standards Track
category: ERC
created: 2024-07-02
---

## Abstract

This proposal introduces a standard for decentralized identity verification (DID) on the Ethereum blockchain. The standard aims to provide a secure, privacy-preserving method for identity verification that can be used by decentralized applications (dApps).

## Motivation

Centralized identity verification methods are often cumbersome, prone to data breaches, and do not give users control over their identity data. A decentralized identity verification standard will allow users to maintain control over their identity information while ensuring security and privacy.

## Specification

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.

### Interface

```solidity
pragma solidity ^0.8.0;

interface IDecentralizedIdentity {
// Struct to represent an identity
struct Identity {
address userAddress; // Ethereum address of the user
bytes32 identityHash; // Hash of the identity data
bytes32[2] verificationHashes; // Hashes used for verifying identity
bool isVerified; // Indicates if the identity is verified
uint256 timestamp; // Timestamp of identity creation
}

// Event emitted when a new identity is created
event IdentityCreated(address indexed userAddress, bytes32 identityHash, uint256 timestamp);

// Event emitted when an identity is verified
event IdentityVerified(address indexed userAddress, bytes32[2] verificationHashes, uint256 timestamp);

// Event emitted when an identity is revoked
event IdentityRevoked(address indexed userAddress, uint256 timestamp);

// Function to create a new decentralized identity for the caller.
// Parameters:
// - identityHash: Hash of the identity data.
function createIdentity(bytes32 identityHash) external;

// Function to verify the decentralized identity for the caller.
// Parameters:
// - verificationHashes: Hashes used for verifying the identity.
function verifyIdentity(bytes32[2] calldata verificationHashes) external;

// Function to revoke the decentralized identity for the caller.
function revokeIdentity() external;

// 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 returns (Identity memory);
}

```

## Rationale

The design leverages cryptographic hashes to represent identity information, ensuring that sensitive data is not stored directly on the blockchain. The use of verification hashes allows for flexible identity verification mechanisms, and the inclusion of events ensures transparency and traceability.

## Reference Implementation

```solidity
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];
}
}
```

## Security Considerations

**Secure Hashing**: Ensure that identity and verification hashes are generated using a secure hashing algorithm to prevent collisions and ensure the integrity of the identity data.

**User Control**: Users have control over their identity data, which reduces the risk of unauthorized access and ensures privacy.

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).
Loading