EVM Tech Layer for Web5

Decentralized identity on Ethereum leverages the blockchain’s programmability and vast ecosystem to operationalize Web5’s principles. By integrating DIDs and Verifiable Credentials (VCs) into Ethereum’s smart contract layer, Web5 unlocks scalable, privacy-preserving identity management that works seamlessly with DeFi, DAOs, and decentralized applications.

Technical Overview

Decentralized identity on Ethereum combines several key elements:

  1. DID Mapping: DIDs anchored on Bitcoin via ION are resolved and mapped to Ethereum smart contracts for interactions.

  2. VC Issuance and Verification: Smart contracts issue, store references to, and verify Verifiable Credentials.

  3. Cross-Chain Synchronization: Validators maintain consistency between Bitcoin’s immutable identity layer and Ethereum’s programmable ecosystem.

  4. Decentralized Storage: DID metadata and credential data are stored off-chain (e.g., IPFS, Arweave) and referenced on-chain using cryptographic hashes.

This architecture ensures Ethereum acts as a dynamic layer for managing identity-based workflows while preserving the integrity and decentralization of Web5.


1. DID Integration with Ethereum

Ethereum acts as the operational layer for DIDs anchored on Bitcoin. While Bitcoin provides the immutability needed for trustless anchoring, Ethereum adds programmability to make DIDs actionable.

DID Mapping Example

A smart contract is used to map Bitcoin-anchored DIDs to Ethereum addresses. This allows dApps and other systems to query DID metadata efficiently.

Sample Solidity Code:

// DID Registry Smart Contract
pragma solidity ^0.8.0;

contract DIDRegistry {
    struct DIDDocument {
        string ipfsHash; // Reference to off-chain storage
        bool active;
    }

    mapping(address => DIDDocument) public dids;

    function registerDID(string memory ipfsHash) public {
        require(bytes(dids[msg.sender].ipfsHash).length == 0, "DID already registered");
        dids[msg.sender] = DIDDocument(ipfsHash, true);
    }

    function updateDID(string memory ipfsHash) public {
        require(dids[msg.sender].active, "DID is inactive");
        dids[msg.sender].ipfsHash = ipfsHash;
    }

    function deactivateDID() public {
        require(dids[msg.sender].active, "DID is already inactive");
        dids[msg.sender].active = false;
    }

    function getDID(address owner) public view returns (string memory) {
        return dids[owner].ipfsHash;
    }
}

2. Verifiable Credential Workflow

Ethereum’s smart contracts make issuing and verifying VCs efficient and trustless. VCs, stored off-chain, are tied to DIDs and referenced on-chain for validation.

VC Issuance Example

An entity issues a credential for a DID. This credential is hashed and stored in decentralized storage, and its reference is recorded on-chain.

Example Workflow:

  1. Issuer: A DAO or entity generates a VC for a DID.

  2. Storage: The VC is stored off-chain (e.g., IPFS).

  3. On-Chain Anchor: A reference to the VC (hash) is recorded in a smart contract.

VC Management Solidity Code:

// Verifiable Credential Contract
pragma solidity ^0.8.0;

contract VCRegistry {
    struct VC {
        address issuer;
        string vcHash; // IPFS hash
        uint256 issuedAt;
    }

    mapping(address => VC[]) public vcs;

    function issueVC(address holder, string memory vcHash) public {
        vcs[holder].push(VC(msg.sender, vcHash, block.timestamp));
    }

    function getVCs(address holder) public view returns (VC[] memory) {
        return vcs[holder];
    }
}

3. Credential-Based Access Control

Smart contracts can enforce access policies based on the presence and validity of specific VCs. This allows dApps to implement features like gated access or credential-weighted voting.

Example: Access Control

A dApp requires users to prove membership in a DAO before accessing certain features. The VC is verified against its associated DID.

Access Control Solidity Code:

pragma solidity ^0.8.0;

contract AccessControl {
    VCRegistry vcRegistry;

    constructor(address _vcRegistryAddress) {
        vcRegistry = VCRegistry(_vcRegistryAddress);
    }

    function isAuthorized(address user, string memory requiredVC) public view returns (bool) {
        VCRegistry.VC[] memory userVCs = vcRegistry.getVCs(user);
        for (uint i = 0; i < userVCs.length; i++) {
            if (keccak256(abi.encodePacked(userVCs[i].vcHash)) == keccak256(abi.encodePacked(requiredVC))) {
                return true;
            }
        }
        return false;
    }
}

By integrating decentralized identity into Ethereum, Web5 turns static identity concepts into actionable, programmable frameworks. This unlocks endless possibilities for developers and users, paving the way for the next phase of the decentralized internet.

Last updated