Lux Standard

Identity (DID)

W3C Decentralized Identifiers on Lux Network

Identity (DID)

On-chain W3C DID Core specification implementation for decentralized identity management.

Architecture Overview

┌─────────────────────────────────────────────────────────────────────────────────────────┐
│                            LUX IDENTITY ARCHITECTURE                                    │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│                                                                                         │
│  DID METHODS                                                                            │
│  ┌─────────────────────────────────────────────────────────────────────────────────┐   │
│  │  did:lux:<identifier>           - Lux Network DID                               │   │
│  │  did:lux:mainnet:<address>      - Mainnet-specific DID                          │   │
│  │  did:lux:testnet:<address>      - Testnet-specific DID                          │   │
│  │  did:ai:<username>           - AI username DID                            │   │
│  │  did:ai:eth:<address>        - AI Ethereum address DID                    │   │
│  └─────────────────────────────────────────────────────────────────────────────────┘   │
│                                        │                                                │
│  ┌─────────────────────────────────────┼───────────────────────────────────────────┐   │
│  │                                     ▼                                            │   │
│  │  ┌─────────────────┐    ┌─────────────────────┐    ┌─────────────────────┐      │   │
│  │  │   DIDRegistry   │    │     DIDDocument     │    │  VerificationMethod │      │   │
│  │  │                 │    │                     │    │                     │      │   │
│  │  │ Create/Update   │───▶│ Controller list     │───▶│ Ed25519/secp256k1   │      │   │
│  │  │ Resolve/Revoke  │    │ Also-known-as       │    │ X25519/BLS          │      │   │
│  │  └─────────────────┘    └─────────────────────┘    └─────────────────────┘      │   │
│  │                                     │                                            │   │
│  │                                     ▼                                            │   │
│  │  ┌─────────────────┐    ┌─────────────────────┐    ┌─────────────────────┐      │   │
│  │  │  DIDResolver    │    │      Services       │    │ PremiumDIDRegistry  │      │   │
│  │  │                 │    │                     │    │                     │      │   │
│  │  │ Cross-chain     │    │ LinkedDomains       │    │ Username auctions   │      │   │
│  │  │ resolution      │    │ CredentialRegistry  │    │ Premium names       │      │   │
│  │  └─────────────────┘    └─────────────────────┘    └─────────────────────┘      │   │
│  └──────────────────────────────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────────────────────────────┘

Core Contracts

ContractDescriptionImport
DIDRegistryMain DID management@luxfi/contracts/identity/DIDRegistry.sol
DIDResolverCross-chain DID resolution@luxfi/contracts/identity/DIDResolver.sol
PremiumDIDRegistryPremium username auctions@luxfi/contracts/identity/PremiumDIDRegistry.sol

Verification Method Types

TypeDescriptionUse Case
Ed25519VerificationKey2020Ed25519 signingGeneral authentication
EcdsaSecp256k1VerificationKey2019secp256k1 ECDSAEthereum compatibility
X25519KeyAgreementKey2020X25519 key exchangeEncrypted communication
Bls12381G2Key2020BLS signaturesThreshold signatures
JsonWebKey2020JWK formatWeb interoperability

Service Types

TypeDescription
LinkedDomainsDNS domain verification
CredentialRegistryVerifiable credentials
DIDCommMessagingDIDComm messaging endpoint
HubServiceIdentity hub

Creating a DID

import "@luxfi/contracts/identity/DIDRegistry.sol";

DIDRegistry registry = DIDRegistry(DID_REGISTRY_ADDRESS);

// Create DID for msg.sender
// DID format: did:lux:<address>
registry.createDID();

// Create DID with custom identifier
registry.createDIDWithId("my-custom-id");

// Add verification method
registry.addVerificationMethod(
    didHash,
    VerificationMethod({
        id: "did:lux:0x123...#key-1",
        methodType: VerificationMethodType.EcdsaSecp256k1VerificationKey2019,
        controller: "did:lux:0x123...",
        publicKeyMultibase: "zQ3shokFTS3brHcDQrn82RUDfQ23HnBE...",
        publicKeyJwk: ""
    })
);

// Add service endpoint
registry.addService(
    didHash,
    Service({
        id: "did:lux:0x123...#website",
        serviceType: ServiceType.LinkedDomains,
        serviceEndpoint: "https://example.com"
    })
);

Resolving a DID

import "@luxfi/contracts/identity/DIDResolver.sol";

DIDResolver resolver = DIDResolver(DID_RESOLVER_ADDRESS);

// Resolve DID document
(DIDDocument memory doc, bool found) = resolver.resolve("did:lux:0x123...");

if (found) {
    address controller = doc.controller;
    uint256 updated = doc.updated;
    bool active = doc.active;
}

// Get verification methods
VerificationMethod[] memory methods = resolver.getVerificationMethods(didHash);

// Get services
Service[] memory services = resolver.getServices(didHash);

Premium DIDs

import "@luxfi/contracts/identity/PremiumDIDRegistry.sol";

PremiumDIDRegistry premium = PremiumDIDRegistry(PREMIUM_REGISTRY_ADDRESS);

// Check availability
bool available = premium.isAvailable("alice");

// Start auction for premium name
premium.startAuction{value: minBid}("alice");

// Place bid
premium.placeBid{value: bidAmount}("alice");

// Claim after auction ends
premium.claimPremiumDID("alice");
// Creates: did:ai:alice

DID Document Structure

struct DIDDocument {
    string id;                    // did:lux:<identifier>
    address controller;           // Primary controller address
    address[] alsoController;     // Additional controllers
    uint256 created;              // Creation timestamp
    uint256 updated;              // Last update timestamp
    bool active;                  // Active/deactivated status
}

Access Control Roles

RolePermissions
DEFAULT_ADMIN_ROLEFull registry control
OPERATOR_ROLEAssist with DID management
REGISTRAR_ROLECreate DIDs on behalf of users

Constants

NameValueDescription
MAX_VERIFICATION_METHODS20Max keys per DID
MAX_SERVICES10Max services per DID
MAX_ALIASES5Max also-known-as

Events

event DIDCreated(bytes32 indexed didHash, string did, address indexed controller);
event DIDUpdated(bytes32 indexed didHash, address indexed updater);
event DIDDeactivated(bytes32 indexed didHash);
event VerificationMethodAdded(bytes32 indexed didHash, string methodId);
event ServiceAdded(bytes32 indexed didHash, string serviceId);
event ControllerChanged(bytes32 indexed didHash, address indexed newController);

W3C Compliance

This implementation follows the W3C DID Core specification:

  • DID Syntax conformant
  • DID Document structure
  • Verification methods
  • Service endpoints
  • Resolution metadata

On this page