> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://ensforge.com/api/mcp` to find what you need.

# Register a name

Register an available ENS V2 name through Rhinestone, from HCA deployment to the final registration.
The example keeps workflow progress in SQLite so you can continue after a process restart.

## Prepare the wallet and name

Complete [Rhinestone getting started](/hca/rhinestone/getting-started) first. Use a Node runtime with
`node:sqlite` support and a TypeScript runner for these server-side files.

Set the client and provider environment variables from that guide, plus:

* `ENSFORGE_SEPOLIA_V2_NAME`: the available name to register, including `.eth`.
* `ENSFORGE_HCA_REGISTRATION_RESOLVER`: a Permissioned Resolver administered by the HCA.
* `ENSFORGE_HCA_SESSION_VALID_UNTIL`: a fixed future Unix timestamp in seconds, long enough for the
  commitment wait and registration. Keep this value unchanged when resuming.

Use the same protected session key throughout the workflow. On the first run, the script enables
that session and prints `ENSFORGE_HCA_SESSION_ENABLE_HASH`. Save that hash in your environment
before running the script again; subsequent runs reuse the enabled session.

The owner needs Sepolia ETH for explicit HCA deployment and session enablement. Sponsorship covers
execution gas, not the name price. Send the registrar's payment token to the predicted HCA address.
`registration.ts` sets a maximum price of 10 USDC for one year; adjust that limit for your name.

## Create the registration resolver

Registration requires a Permissioned Resolver with the HCA as its administrator. An arbitrary
shared resolver is not sufficient. Run this setup once using the owner wallet; it costs Sepolia ETH.
Choose an unused resolver salt if this wallet has already deployed a resolver with `1n`.

:::code-group
```ts [registration-resolver.ts]
// [!include ~/snippets/hca/guides/registration-resolver.ts]
```

```ts [deploy.ts]
// [!include ~/snippets/hca/guides/deploy.ts]
```

```ts [account.ts]
// [!include ~/snippets/hca/guides/account.ts]
```

```ts [client.ts]
// [!include ~/snippets/hca/guides/client.ts]
```
:::

Save the printed resolver address as `ENSFORGE_HCA_REGISTRATION_RESOLVER`. Reuse that address when
resuming registration; do not deploy a new resolver on every run.

## Run the registration

Copy the files into one directory. Run `rhinestone-register-name.ts` with your TypeScript runner.
The script deploys or reuses the HCA, starts the registration, tracks submission, waits for the
commitment to mature, and advances to the registration transaction.

:::code-group
```ts [rhinestone-register-name.ts]
// [!include ~/snippets/hca/guides/rhinestone-register-name.ts]
```

```ts [registration.ts]
// [!include ~/snippets/hca/guides/registration.ts]
```

```ts [advance-registration.ts]
// [!include ~/snippets/hca/guides/advance-registration.ts]
```

```ts [workflow-client.ts]
// [!include ~/snippets/hca/guides/workflow-client.ts]
```

```ts [sqlite-storage.ts]
// [!include ~/snippets/hca/guides/sqlite-storage.ts]
```

```ts [deploy.ts]
// [!include ~/snippets/hca/guides/deploy.ts]
```

```ts [rhinestone.ts]
// [!include ~/snippets/hca/guides/rhinestone.ts]
```

```ts [account.ts]
// [!include ~/snippets/hca/guides/account.ts]
```

```ts [client.ts]
// [!include ~/snippets/hca/guides/client.ts]
```
:::

## Continue when input is needed

The script prints the operation ID and progress. `registered` is the final success state. Other
states require the following handling:

| Progress                    | What to do                                                                             |
| --------------------------- | -------------------------------------------------------------------------------------- |
| `submitted` or `submitting` | Keep the stored operation and check it again; inclusion is still pending.              |
| `waiting`                   | Wait until `readyAt`. The runner waits automatically within its 15-minute time budget. |
| `needs-funding`             | Transfer the reported payment token amount to the HCA, then rerun.                     |
| `needs-review`              | Inspect the changed quote or limits before explicitly accepting new terms.             |

Rerun with the same inputs and `.ensforge-workflows` directory to continue saved work. Do not delete
the database or change the name, salt or registration parameters to retry a pending transaction.
The SDK derives the workflow identity from the inputs; you do not need to invent a new ID.

Keep the session key, fixed expiry and enable hash unchanged too. If the session expires while the
workflow is pending, explicitly authorize a replacement through
[registration recovery](/hca/guides/registration); do not silently create a different session.

## After registration

Only show registration success when progress is `registered`. To edit the new name's profile,
continue with [Update a text record](/hca/rhinestone/update-description). That flow checks the
resolver permission for the specific record before writing.
