# Installation

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

Install @ensforge/hca next to the SDK, then add the HCA actions to your client so that ens.hca and the hca() route are available.

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

<Callout type="info" title="Experimental">
`@ensforge/hca` is experimental for 1.0. Its API can change in a minor release, and the bundler
and Rhinestone paths have no production proof yet. Pin the version you test.
</Callout>

`@ensforge/hca` adds hosted contract accounts ([HCA](/docs/reference/glossary#hca)) to the ensforge client. An HCA is a smart account that ENS hosts for a wallet. See [How it works](/docs/hca/how-it-works).

## Requirements [#requirements]

- Node.js 20.19 or later.
- `@ensforge/sdk`, `effect` (version 4.1.4 or later) and `viem` (version 2.57 or later). The package lists `effect` and `viem` as peer dependencies.
- A chain with an HCA deployment: Ethereum mainnet or Sepolia. Other chains fail with [`HCA_UNAVAILABLE`](/docs/reference/errors/HCA_UNAVAILABLE) unless you [define a deployment](/docs/contracts/custom-deployments) that has an `hca` group.

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

```package-install
@ensforge/hca @ensforge/sdk effect viem
```

## 2. Add the actions to the client [#2-add-the-actions-to-the-client]

`hcaActions()` adds the `ens.hca` actions. `hcaAdminActions()` adds `ens.hcaAdmin`, which only governance accounts need. See [Upgrades and governance](/docs/hca/upgrades-and-governance).

**Example** (A Client With HCA Actions)

```ts title="client.ts"
import { hcaActions, hcaAdminActions } from "@ensforge/hca";
import { Ensforge, ensActions } from "@ensforge/sdk";
import { createPublicClient, createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { sepolia } from "viem/chains";

const account = privateKeyToAccount(
  "0x0123456789012345678901234567890123456789012345678901234567890123",
);

const ens = Ensforge.create({
  publicClient: createPublicClient({ chain: sepolia, transport: http() }),
  walletClient: createWalletClient({ account, chain: sepolia, transport: http() }),
})
  .extend(ensActions())
  .extend(hcaActions())
  .extend(hcaAdminActions());
```

- Replace the placeholder key with your signer. Never commit a real key.
- Writes through an HCA need a wallet client, because the HCA's owner signs or sends them.

## Use the Effect API [#use-the-effect-api]

The same actions run in Effect programs: import `Actions` from `@ensforge/hca/effect`. See [The Effect API](/docs/sdk/effect-api).

## Troubleshooting [#troubleshooting]

### `HCA_UNAVAILABLE` [#hca_unavailable]

The client's chain has no HCA deployment. Use mainnet or Sepolia, or pass a deployment that has an `hca` group. See [`HCA_UNAVAILABLE`](/docs/reference/errors/HCA_UNAVAILABLE).