# Installation

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

Install @ensforge/contracts, the ENS ABIs, addresses and constants for viem, and pick the entry point that fits what you need.

Source: https://ensforge.com/docs/contracts/installation

`@ensforge/contracts` holds the ENS contract ABIs, deployment addresses and protocol constants such as interface IDs and [role](/docs/reference/glossary#role) bitmaps. It has no runtime dependencies beyond the `viem` peer, and it does not depend on Effect or on `@ensforge/sdk`, so you can use it alone.

## Requirements [#requirements]

- Node.js 20.19 or later.
- `viem` version 2.57 or later.

## 1. Install the package [#1-install-the-package]

```package-install
@ensforge/contracts viem
```

## 2. Import what you need [#2-import-what-you-need]

The root entry point has four namespaces:

| Namespace      | What it holds                                                         |
| -------------- | --------------------------------------------------------------------- |
| `Abis`         | ABIs as `as const` arrays, in `Abis.v1`, `Abis.v2` and `Abis.shared`. |
| `Deployments`  | Addresses, behaviour flags and provenance for mainnet and Sepolia.    |
| `InterfaceIds` | ERC-165 interface IDs of registries, resolvers and resolver profiles. |
| `Roles`        | ENSv2 role bitmaps for registries and resolvers.                      |

**Example** (Importing the Namespaces)

```ts title="imports.ts"
import { Abis, Deployments, InterfaceIds, Roles } from "@ensforge/contracts";

const registryAbi = Abis.v2.permissionedRegistry;
const ethRegistry = Deployments.mainnet.v2.contracts.ethRegistry;
const permissionedResolverId = InterfaceIds.resolver.permissionedResolver;
const renewRole = Roles.registry.renew;
```

## Subpath entry points [#subpath-entry-points]

The same ABIs and constants are also available as flat named exports, which suit bundlers that tree-shake by file.

| Import                                    | What it holds                                                                                             |
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `@ensforge/contracts/v1`                  | ENSv1 ABIs and constants, such as `baseRegistrarV1Abi`.                                                   |
| `@ensforge/contracts/v2`                  | ENSv2 ABIs, interfaces, role and interface-ID constants and helpers, such as `permissionedRegistryV2Abi`. |
| `@ensforge/contracts/shared`              | ABIs both protocol versions share: token standards, ERC-165, resolver profiles, errors, events.           |
| `@ensforge/contracts/v2/experimental/hca` | The experimental [HCA](/docs/reference/glossary#hca) (Hosted Contract Account) ABIs and session helpers.  |

See the [entry points reference](/docs/reference/contracts/entry-points) for every export.

## Use it with the SDK [#use-it-with-the-sdk]

`@ensforge/sdk` depends on this package. Use `@ensforge/contracts` directly when you read or write contracts with viem yourself. See [Use ABIs with viem](/docs/contracts/use-abis-with-viem).