> ## Documentation Index
> Fetch the complete documentation index at: https://ixoworld-canonical.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Entity Domains

> Create and manage digital domains for entities on the IXO Stack

<Tip>
  Entity Domains provide a standardized way to register and manage digital twins of real-world entities on the IXO blockchain, with built-in support for decentralized identity, verifiable credentials, and relationship management.
</Tip>

## Overview

<AccordionGroup>
  <Accordion title="Decentralized Identity Management" icon="fingerprint">
    Create and manage decentralized identifiers (DIDs) for entities, enabling sovereign control and cryptographic verification of identity claims.
  </Accordion>

  <Accordion title="Verifiable Ownership and Control" icon="key">
    Establish and verify ownership rights through cryptographic proofs, with support for multiple controllers and delegated authority.
  </Accordion>

  <Accordion title="Service Endpoint Configuration" icon="server">
    Define and manage service endpoints that connect digital twins to external services, APIs, and data sources.
  </Accordion>

  <Accordion title="Resource and Claim Linking" icon="link">
    Associate verifiable claims, documents, and other resources with entity domains to build comprehensive digital representations.
  </Accordion>

  <Accordion title="Relationship Mapping" icon="diagram-project">
    Create and visualize connections between entities to model real-world relationships and dependencies.
  </Accordion>

  <Accordion title="Economic Account Management" icon="wallet">
    Manage financial accounts and transactions associated with entities, enabling economic interactions within the ecosystem.
  </Accordion>
</AccordionGroup>

## Domain Properties

<AccordionGroup>
  <Accordion title="Core Properties" icon="cube">
    ```typescript theme={null}
    interface DomainProperties {
      did: string;              // Decentralized identifier
      controller: string[];     // Domain controllers
      type: string;            // Entity type
      status: number;          // Domain status
      credentials: VerifiableCredential[]; // Domain credentials
    }
    ```
  </Accordion>

  <Accordion title="Service Configuration" icon="gears">
    ```typescript theme={null}
    interface Service {
      id: string;              // Service identifier
      type: string;           // Service type
      serviceEndpoint: string; // Endpoint URL
      description?: string;    // Optional description
    }
    ```
  </Accordion>

  <Accordion title="Linked Resources" icon="link">
    ```typescript theme={null}
    interface LinkedResource {
      id: string;             // Resource identifier
      type: string;          // Resource type
      path: string;          // Resource location
      proof?: string;        // Optional cryptographic proof
    }
    ```
  </Accordion>

  <Accordion title="Accorded Rights" icon="link">
    ```typescript theme={null}
    interface AccordedRight {
      type: string; // Right type
      description?: string; // Optional description
    }
    ```
  </Accordion>

  <Accordion title="Linked Claims" icon="link">
    ```typescript theme={null}
    interface LinkedClaim {
      id: string; // Claim identifier
      type: string; // Claim type
    }
    ```
  </Accordion>

  <Accordion title="Linked Entities" icon="link">
    ```typescript theme={null}
    interface LinkedEntity {
      id: string; // Entity identifier
    }
    ```
  </Accordion>

  <Accordion title="Domain Accounts" icon="link">
    ```typescript theme={null}
    interface DomainAccount {
      id: string; // Account identifier
    }
    ```
  </Accordion>
</AccordionGroup>

## Domain Registration

<Steps>
  1. **Create Domain Document**
     * Specify entity type and class
     * Define controllers
     * Configure services
     * Set up linked resources

  2. **Submit Registration**
     * Sign domain creation transaction
     * Broadcast to blockchain
     * Wait for confirmation
     * Verify registration

  3. **Configure Properties**
     * Add verification methods
     * Link resources
     * Set up services
     * Define relationships
</Steps>

## Implementation

<CodeGroup>
  ````typescript Create Domain theme={null}
  import { Entity } from '@ixo/client-sdk';

  async function createEntityDomain(
    creator: string,
    entityType: string
  ) {
    const msg = {
      typeUrl: "/ixo.entity.v1beta1.MsgCreateEntity",
      value: {
        creator,
        entityType,
        entityStatus: 1
      }
    };

    return await Entity.broadcast(msg);
  }

  ```python

  ```typescript Update Domain
  async function updateEntityDomain(
    id: string,
    updates: DomainProperties
  ) {
    const msg = {
      typeUrl: "/ixo.entity.v1beta1.MsgUpdateEntity",
      value: {
        id,
        ...updates
      }
    };

    return await Entity.broadcast(msg);
  }
  ````

  ```typescript Query Domain theme={null}
  async function queryEntityDomain(
    did: string
  ) {
    const query = `
      query GetEntity($did: String!) {
        entity(id: $did) {
          id
          type
          status
          controller
          services {
            id
            type
            endpoint
          }
          resources {
            id
            type
            path
          }
        }
      }
    `;

    return await client.query({
      query,
      variables: { did }
    });
  }
  ```
</CodeGroup>

## Domain Management

<AccordionGroup>
  <Accordion title="Add Service" icon="plus">
    ```typescript theme={null}
    async function addDomainService(
      entityId: string,
      service: Service
    ) {
      const msg = {
        typeUrl: "/ixo.entity.v1beta1.MsgAddEntityService",
        value: {
          entityId,
          service
        }
      };

      return await Entity.broadcast(msg);
    }
    ```
  </Accordion>

  <Accordion title="Link Resource" icon="link">
    ```typescript theme={null}
    async function addLinkedResource(
      entityId: string,
      resource: LinkedResource
    ) {
      const msg = {
        typeUrl: "/ixo.entity.v1beta1.MsgAddEntityResource",
        value: {
          entityId,
          resource
        }
      };

      return await Entity.broadcast(msg);
    }
    ```
  </Accordion>

  <Accordion title="Update Status" icon="pen">
    ```typescript theme={null}
    async function updateEntityStatus(
      entityId: string,
      status: number
    ) {
      const msg = {
        typeUrl: "/ixo.entity.v1beta1.MsgUpdateEntityStatus",
        value: {
          entityId,
          status
        }
      };

      return await Entity.broadcast(msg);
    }
    ```
  </Accordion>
</AccordionGroup>

## Best Practices

<CardGroup>
  <Card title="Identity Management" icon="fingerprint">
    * Use strong verification methods
    * Implement key rotation
    * Maintain controller list
    * Document access policies
  </Card>

  <Card title="Service Configuration" icon="gears">
    * Validate endpoints
    * Monitor availability
    * Update stale endpoints
    * Document service types
  </Card>

  <Card title="Resource Management" icon="link">
    * Verify resource integrity
    * Maintain proof chains
    * Update broken links
    * Document dependencies
  </Card>

  <Card title="Security" icon="shield">
    * Implement access control
    * Validate transactions
    * Monitor activities
    * Regular audits
  </Card>
</CardGroup>

## Developer Resources

<CardGroup>
  <Card title="API Reference" icon="book" href="/api-reference/grpc-gateway-api">
    Entity module API documentation
  </Card>

  <Card title="SDK and kit overview" icon="code" href="/sdk-reference/index">
    Canonical SDK guide and routing map
  </Card>

  <Card title="Examples" icon="lightbulb" href="/guides/dev/examples">
    Implementation examples
  </Card>

  <Card title="GitHub" icon="github" href="https://github.com/ixofoundation/ixo-blockchain/tree/main/x/entity">
    Entity module source code
  </Card>
</CardGroup>

<Tip>
  For technical support or questions about Entity Domains, join our [Developer Community](https://ixofoundation.slack.com/archives/C04UERAUHQT) or contact our [Developer Relations Team](mailto:assistant@ixo.world).
</Tip>
