> For the complete documentation index, see [llms.txt](https://docs.dothype.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dothype.io/architecture/how-it-all-works/dothype-smart-contracts/registry-contract.md).

# Registry Contract

The dotHYPERegistry is the foundational contract that tracks ownership of .hype names, manages expirations, and defines how names behave onchain.

Every `.hype` name is an NFT—minted and stored using this registry. It’s compliant with ERC-721, but also includes extensions to manage lifecycle events like renewal, expiration, and status tracking in a way that fits naming infrastructure.

This page explains how the registry works and what matters for developers or curious users.

### 📘 What It Does

The Registry contract is responsible for:

* Minting `.hype` names as NFTs
* Assigning expiration timestamps
* Enforcing availability logic (e.g. what counts as expired)
* Preventing transfers of expired names
* Handling metadata for display

All minting and renewing must come through the **Controller contract**, which acts as a gatekeeper. That ensures pricing and access logic can be upgraded independently.

> You can think of the Registry as the final source of truth for who owns what and for how long.

### ⏳ Expiration & Renewal Rules

Each name is registered for a fixed period, starting from the time of mint. Once that period ends, the name enters a **30-day grace period**. During this window:

* The owner can still renew the name
* But it can’t be transferred or sold

After the grace period ends:

* The name becomes available to others
* It can be re-registered by anyone

To ensure meaningful durations, **all registrations must last at least 28 days**.

### 🔐 Availability Logic

A name is considered **available** if:

* It has never been registered
* OR its expiration + grace period has passed

This logic ensures names can’t be accidentally or maliciously re-claimed too early. Builders can use the `available()` function to check status.

```solidity
function available(string calldata name) external view returns (bool);
```

### 🔁 Minting & Renewal Process (Simplified)

Names are minted and renewed through the Controller. The Registry handles the actual recording.

When a name is registered:

1. A token ID is created using the **namehash** algorithm
2. An expiration time is assigned
3. An NFT is minted to the user

When renewed:

* The expiration is extended based on the original expiry (not the current time)
* If the name is expired but within the grace period, it can still be renewed

```solidity
function register(string calldata name, address owner, uint256 duration) external onlyController returns (uint256 expiresAt);
function renew(string calldata name, uint256 duration) external onlyController returns (uint256 expiresAt);
```

### 🧠 Token ID Generation

Each `.hype` name is converted into a token ID using a standard **namehash** algorithm—similar to ENS. This ensures uniqueness and predictability.

```solidity
function nameToTokenId(string calldata name) public pure returns (uint256);
```

The algorithm:

* Hashes the domain label using keccak256
* Combines it with a root `.hype` identifier
* Outputs a 256-bit integer as the token ID

This process ensures all names are deterministically derived and collision-resistant.

### 🖼 Metadata & Status Queries

Each name has a metadata URI, which can be customized using an external metadata provider. This lets you:

* Display profile cards, avatars, or status in apps
* Serve dynamic visuals for first 1K mints or milestone names

The Registry also exposes read-only status functions:

```solidity
function expiresAt(uint256 tokenId) external view returns (uint256);
function expiry(string calldata name) external view returns (uint256);
function isExpired(uint256 tokenId) external view returns (bool);
```

### 🚫 Transfer Restrictions

Expired names (outside the grace period) **cannot be transferred**. This is enforced at the contract level no UI trickery.

The Registry overrides the `_update()` function to block transfers of expired tokens unless they are first renewed.

This protects users and prevents accidental loss of names post-expiration.

### 🛠 Admin Controls

Some functions are reserved for the protocol owner or multisig governance:

```solidity
function setController(address _controller) external onlyOwner;
function setMetadataProvider(address _metadataProvider) external onlyOwner;
```

These allow future upgrades or metadata format changes **without touching the core Registry logic**.

### 🔎 For Developers

If you’re building an integration and want to:

* Check if a name is expired
* Query expiration time
* Display metadata or avatars

...the Registry is your go-to source.

It’s not where minting logic lives—that happens in the Controller. But it’s where final ownership, expiration, and display logic is confirmed.

> See the [Controller Contract →](/architecture/how-it-all-works/dothype-smart-contracts/controller-contract.md) to understand how minting works upstream.

Still have questions? Reach out in our [dev community →](/official-links.md)
