# Nom for Nor This document serves as an architecture specification for Nom Name Registry DNA and any related service implementation needed for Nor games. ## Cliff note - Proposal - Power Nor game(s) player identity with a Nom/Holo/Holochain federated, distributed ID - Game = https://welcometonor.com/; aim is 500 players using this ID system in November - Nom Name Registry DNA primarily needs to; - Allow Nor to register their namespace (values can be hard coded an committed during init() - Allow players of Nor to claim unique player handle - Determinism of registration is achieved through simple countersigning conscensus between 3 compile-time known agents (these 3 agents are called **witnesses** in nom terminology). For this phase, I suggest the easisest way to implement this must be pursued (i.e. pre-generate 3 agent keys and have 3 hosted agents with those keys act as witnesses) - Allow players to check whether a name is already registered - Nom will not have a dedicated UI for its DNA. Instead, all zome calls will be called directly from Nor Game interface - Note that Nor game is written in PHP, and holochain related clients are all in Javascript ## ERD, Entry Structures, Validations - **Solid borders:** DHT Entry - **Dashed borders:** Path ```mermaid graph TD subgraph Nom Name Registry DNA for NOR GAMES subgraph namespace norNamespace end subgraph nameRegistration norNamespace-->aliceNameRegistration aliceNameRegistration-.->norNamespace end subgraph agents alice-->|player_handle|aliceNameRegistration end end ``` ### ERD ### Entries ```rust #[hdk_entry] struct Namespace { name: string, valid_name_structure_regex: string, } // validation #[hdk_entry] struct NameRegistration { namespace: HoloHash<EntryHash>, name: Vec<u8>, } ``` ## Zome Calls #### `init()` for `create_namespace` ```mermaid sequenceDiagram participant NGI as NorGameInterface participant HKM as HoloChaperone participant NDNA as NomNameRegDNA participant NDHT as NomNameRegDHT NGI-->>HKM: Create Keys HKM-->>HKM: Generate Keys HKM-->>NDNA: generate source chain and call init() NDNA-->>NDNA: retrive Nor Namespace entry from DNA properties NDNA-->>NDHT: get Nor Nemspace entry NDNA-->>NDHT: commit Nor Namespace entry if get() is None ``` #### `create_unique_name` ```mermaid sequenceDiagram participant NGI as NorGameInterface participant HKM as HoloKeyManager participant NDNA as NomNameRegDNA participant NDHT as NomNameRegDHT NGI-->>HKM: Sign In / Sign Up HKM-->>HKM: Generate Keys from payload HKM-->>NDNA: Call get_my_name() NDNA-->>NDHT: get link on agent tag 'player_handle' alt if get is None NDNA-->>NGI: return None NGI-->>NGI: display name registration interface NGI-->>NDNA: create_unique_name NDNA-->>NDNA: initiate countersigning session of NameRegistration (3 compile-time known agents) alt countersigning success NDNA-->>NDHT: NameRegistration crate_entry() NDNA-->>NDHT: create_link agent->nameRegistration NDNA-->>NDHT: crate_link from Namespace entry NDNA-->>NGI: NameRegistrationDetail else countersigning error NDNA-->>NGI: error end end ``` #### `get_my_name` ```mermaid sequenceDiagram participant NGI as NorGameInterface participant HKM as HoloChaperone participant NDNA as NomNameRegDNA participant NDHT as NomNameRegDHT NGI-->>HKM: call get_my_name() HKM-->>NDNA: get_my_name() NDNA-->>NDHT: get link from AgentPubKey tag 'player_handle' alt Some() NDHT-->>NDNA: NameRegistration Record NDNA-->>NGI: NameRegistration Record else None NDNA-->>NGI: None end ``` #### `is_name_registered` - **Note:** This Zome Call checks whether a name exist or not from the entries on DHT. It should only be used to approximately check whether a name is available or not (say when the user types the name they want). When names are registered, witness agents will still check their own source chain to make sure the name is unique at validation time ```mermaid sequenceDiagram participant NGI as NorGameInterface participant HKM as HoloChaperone participant NDNA as NomNameRegDNA participant NDHT as NomNameRegDHT NGI-->>HKM: call is_name_registered() HKM-->>NDNA: is_name_registered() NDNA-->>NDNA: create Nor Namespace Entry from Dna Property and get its hash NDNA-->>NDHT: get links base: Namespace entry hash NDHT-->>NDNA: NameRegistration Links NDNA-->>NDNA: create NameRegistration Entry Hash from given name NDNA-->>NDNA: check if Entry Hash already exists in one of the links alt Entry Hash exist NDNA-->>NGI: true else Entry Hash doesnt exist NDNA-->>NGI: false end ``` #### `get_all_names` ```mermaid sequenceDiagram participant NGI as NorGameInterface participant HKM as HoloChaperone participant NDNA as NomNameRegDNA participant NDHT as NomNameRegDHT NGI-->>HKM: call get_all_names() HKM-->>NDNA: get_all_names() NDNA-->>NDNA: create empty NameRegistrations Vec NDNA-->>NDNA: create Nor Namespace Entry from Dna Property and get its hash NDNA-->>NDHT: get links base: Namespace entry hash NDHT-->>NDNA: NameRegistration Links loop link in links NDNA-->>NDHT: get() entry from link NDNA-->>NDNA: insert NameRegistrations entry to NameRegistrations end NDNA-->>NGI: NameRegistrations ``` ## Nom and Rival Reference: https://docs.google.com/spreadsheets/d/1-v_AJKzmHdCr1dH9OAJ5NhjCb9jOtHpzybO0sk3qWUU/edit?usp=sharing - Nom - Name and Namespace Registration - Global Name Regisration for Agent Name and Object Name (since this may be bulk of the revenue, this can be somehow stewarded jointly with Rival) - DHT Roles Management Services - Admin Group Role Mgt - Launch NFT Transfer Marketplace - Global Agent Name - Rival - Witnesses (Outsourced to Nom for Name and Namespace Registration?) - Hosting of Bootstrap Nodes - Hosting of Archive Nodes (& Export) - Consensus on Changes to a Generic Data Structure - Mutual Credit Currency Witnessing - Custom Witness App Installation (with modified witness pools) - Identity Services (to hApp ecosystem) - Identity Services (Public offering)