A decentralized application (DApp) built on Ethereum blockchain for managing user identities securely and transparently. This project demonstrates how to register, update, and retrieve user identities using a smart contract.
- Register Identity: Users can register their identity with a name and email address.
- Update Identity: Registered users can update their identity details.
- Fetch Identity: Retrieve identity details by user address.
- Fetch All Users: List all registered users.
- Fetch All Identities: Retrieve all registered identities.
- Blockchain Technology: All operations are decentralized, transparent, and immutable.
- Technologies Used
- Setup Instructions
- Smart Contract
- Tests
- Frontend Integration
- Future Enhancements
- License
- Ethereum Blockchain: Provides a decentralized ledger for all transactions.
- Solidity: Used for writing the smart contract logic.
- Truffle: Framework for smart contract deployment, testing, and development.
- Ganache: Local blockchain for testing and development.
- MetaMask: Wallet for interacting with the Ethereum blockchain.
- Infura: Ethereum node provider for connecting to the Sepolia Testnet.
- Node.js: JavaScript runtime for backend development.
- JavaScript: For writing tests and integrating the frontend.
Before starting, ensure you have the following installed:
- Node.js: Download Node.js.
- Truffle: Install globally:
npm install -g truffle
- Ganache: Download Ganache for local blockchain testing.
- MetaMask: Install the MetaMask browser extension.
Clone this project to your local machine:
git clone https://github.com/DcNi3L/decentralized-identity-management-system.git
cd decentralized-identity-management-system
Run the following command to install required dependencies:
npm install
Create a .env
file in the root directory with the following content:
MNEMONIC="your twelve word MetaMask seed phrase"
INFURA_URL="https://sepolia.infura.io/v3/your-infura-project-id"
- Open Ganache and configure it with MetaMask as a custom RPC network:
- Network Name: Ganache
- RPC URL:
http://127.0.0.1:7545
- Chain ID:
5777
- Deploy the contract locally:
truffle migrate --network development
- Note the deployed contract address from the output.
- Fund your wallet with Sepolia test ETH using a faucet.
- Deploy the contract to Sepolia:
truffle migrate --network sepolia
- Note the deployed contract address from the output.
The core functionality is implemented in the smart contract: contracts/IdentityManager.sol
.
- registerIdentity: Allows users to register with a name and email address.
- updateIdentity: Enables users to update their details.
- getIdentity: Fetches the identity of a specific user by their Ethereum address.
- getAllUsers: Returns a list of all registered users' addresses.
- getAllIdentities: Retrieves the details of all registered identities.
To verify the functionality of the smart contract, run the following command:
truffle test
The included test suite validates:
- Ensures the contract is deployed successfully.
- Users can register with valid details.
- Duplicate registrations are not allowed.
- Registered users can update their details.
- Updates are rejected for unregistered users.
- Fetches identity details accurately.
- Throws an error for unregistered addresses.
- Returns all registered users and their details.
- Handles empty cases gracefully.
npm install web3
- Registration Form: Collects name and email, and calls
registerIdentity
. - Update Form: Updates registered details using
updateIdentity
. - User List: Fetches and displays all registered users using
getAllUsers
. - Identity Details: Fetches and displays individual identity details with
getIdentity
.
- Decentralized File Storage: Use IPFS for storing additional identity metadata.
- Role-Based Access Control: Add roles for admin and users to restrict access to certain operations.
- ENS (Ethereum Name Service) Integration: Allow users to link their Ethereum addresses to human-readable names.
- Mobile DApp: Develop a mobile application for managing identities on the go.
This project is licensed under the MIT License. See the LICENSE file for details.