MRC 59: MOR Subnet Namespace Smart Contract
1. Overview
The MOR Subnet Namespace is a decentralized system for registering and managing unique subnet names on the Ethereum blockchain. It enables subnets (e.g., decentralized networks, blockchain layers, or applications) to claim human-readable names (e.g., mysubnet.mor) and associate them with metadata, such as an Ethereum address, IPFS hash, or other relevant data. The MOR system is inspired by the Ethereum Name Service (ENS) but is tailored for subnet-specific use cases.
Goals
Provide a secure, decentralized, and transparent mechanism for registering unique subnet names.
Ensure names are globally unique and resolvable to associated metadata.
Support extensible metadata for subnet-specific needs.
Minimize gas costs for registration and management.
Enable transferability and expiration of name ownership.
Key Features
Unique Name Registration: Subnets can register a unique name under the
.mortop-level domain.Ownership and Transfer: Names are owned by Ethereum addresses, with support for transferring ownership.
Expiration and Renewal: Names are leased for a defined period and can be renewed.
Resolver System: Names can resolve to Ethereum addresses, content hashes, or custom metadata.
Subdomain Support: Owners can create subdomains (e.g.,
sub.mysubnet.mor).Gas Efficiency: Optimized for low-cost interactions on Ethereum.
2. Architecture
The MOR Subnet Namespace system consists of the following core components:
2.1. MOR Subnet Registry
The MOR Subnet Registry is the smart contract that maintains a mapping of names to their owners and associated metadata. It is the single source of truth for name ownership and resolver information.
Data Structure:
Maps a
keccak256hash of the name (e.g.,keccak256("mysubnet.mor")) to a record containing:owner: The Ethereum address that owns the name.resolver: The address of the resolver contract (if any).ttl: Time-to-live (expiration timestamp) for the name lease.createdAt: Timestamp of registration.metadata: Optional metadata (e.g., IPFS hash for subnet details).
Functions:
register(bytes32 node, address owner, uint256 duration): Registers a name for a specified duration.setOwner(bytes32 node, address newOwner): Transfers ownership of a name.setResolver(bytes32 node, address resolver): Sets the resolver contract for a name.renew(bytes32 node, uint256 duration): Extends the lease duration of a name.reclaim(bytes32 node): Allows the owner to reclaim an expired name.getRecord(bytes32 node): Retrieves the record for a name.
2.2. Resolver
The Resolver is a contract that resolves a name to specific resources (e.g., an Ethereum address, IPFS hash, or custom data). Each name can have its own resolver contract, or use a default public resolver provided by the MOR Subnet Namespace.
Standard Resolver Interface (inspired by ENS Resolver):
Subnets can deploy custom resolvers to support additional data types (e.g., URLs, subnet configurations, or other metadata).
2.3. Registrar
The Registrar is a contract responsible for handling the registration and renewal process for names under the .mor domain. It enforces rules such as name availability, pricing, and lease duration.
Key Features
Ensures names are unique and not already registered.
Implements a pricing model (e.g., based on name length or fixed fees).
Manages lease durations (e.g., 1 year minimum, renewable).
Supports auctions or first-come-first-serve registration.
Functions
registerName(string memory name, address owner, uint256 duration): Registers a name under.mor.renewName(string memory name, uint256 duration): Renews a name’s lease.price(string memory name, uint256 duration): Returns the registration cost.available(string memory name): Checks if a name is available.
2.4. Subdomain Support
The mor system supports hierarchical names (subdomains). Owners of a name (e.g., mysubnet.mor) can create subdomains (e.g., node.mysubnet.mor) and assign ownership or resolvers to them.
Subdomain Registry
Extends the mor Registry with a function to create subdomains:
labelis the subdomain’s hash (e.g.,keccak256("node")).
3. Smart Contract Specification
Below is a simplified implementation of the core mor Registry contract, written in Solidity.
Last updated
Was this helpful?