Skip to content
Juvix imports

module arch.node.engines.naming;

import prelude open;
import arch.node.types.engine open;
import arch.node.engines.naming_config open public;
import arch.node.engines.naming_messages open public;
import arch.node.engines.naming_environment open public;
import arch.node.engines.naming_behaviour open public;
import arch.node.types.anoma as Anoma open;

open naming_config_example;
open naming_environment_example;

Naming Engine

The Naming Engine serves as the identity resolution system within Anoma, managing human-readable names (IdentityName) and their associations with cryptographic identities (ExternalIdentity). It can be compared to a decentralized DNS system that maintains verifiable connections between user-friendly names and their corresponding cryptographic identities, while requiring evidence to support these connections. The engine maintains an internal evidence store that tracks all verified name-identity associations.

When users want to map names to identities, they interact with the engine in three main ways:

Name Resolution (MsgNamingResolveNameRequest)

Users provide a human-readable name and receive back any associated cryptographic identities (ExternalIdentity). This is like looking up who owns a domain name, but with cryptographic verification.

Evidence Submission (MsgNamingSubmitNameEvidenceRequest)

Users can submit evidence (IdentityNameEvidence) that proves the connection between a name and an identity. The engine verifies this evidence before storing it in its evidence store (evidenceStore). This is similar to domain name registration, but requiring cryptographic proof of the right to associate a name with an identity.

Evidence Querying (MsgNamingQueryNameEvidenceRequest)

Users can look up all the evidence associated with a particular cryptographic identity. This lets them verify the validity of name-to-identity mappings and understand the history of name claims.

Engine components

Type

NamingEngine : Type :=
Engine
NamingCfg
NamingLocalState
NamingMailboxState
NamingTimerHandle
NamingActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Example of a naming engine

exampleNamingEngine : NamingEngine :=
mkEngine@{
cfg := namingCfg;
env := namingEnv;
behaviour := namingBehaviour;
};

where namingCfg is defined as follows:

namingCfg : EngineCfg NamingCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "naming";
cfg := mkNamingCfg;
};

where namingEnv is defined as follows:

namingEnv : NamingEnv :=
mkEngineEnv@{
localState :=
mkNamingLocalState@{
evidenceStore := Set.empty;
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};

and namingBehaviour is defined as follows:

namingBehaviour : NamingBehaviour :=
mkEngineBehaviour@{
guards :=
First [resolveNameGuard; submitNameEvidenceGuard; queryNameEvidenceGuard];
};