> For the complete documentation index, see [llms.txt](https://docs.zama.org/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/protocol/sdk/changelog/v3/v3-8.md).

# 3.8.x

Experimental Go and Rust clients through the SDK daemon, a new vault client API that replaces the 3.7 vault classes, typed errors for FHE compute limits, batched reads with multicall, and the removal

This page covers the `3.8.x` line.

## 3.8.0

*Released 2026-11-16.*

### Daemon

**Experimental Go and Rust clients.** Go and Rust services can use the SDK through native clients that talk to a local SDK daemon over a private Unix socket. The clients encrypt inputs, decrypt values (including public and delegated decryption), manage permits, prepare unsigned transactions for external signing, and grant or revoke on-chain decryption delegation through your wallet. Token workflows are not available in the clients yet.

* **Artifacts:** the `ghcr.io/zama-ai/sdk-daemon` Docker image, the Go module `github.com/zama-ai/sdk/clients/go/v3`, and the Rust crate `zama_sdk`. Run the image and the client at exactly the same version; see [client and daemon compatibility](https://docs.zama.org/protocol/sdk/api-references/client-and-daemon-compatibility.md).
* **Guides:** Go and Rust tabs in [Configuration](https://docs.zama.org/protocol/sdk/guides/configuration.md), [Encrypt & decrypt](https://docs.zama.org/protocol/sdk/guides/encrypt-decrypt.md), [Delegated decryption](https://docs.zama.org/protocol/sdk/guides/delegated-decryption.md), [Offline signing](https://docs.zama.org/protocol/sdk/guides/offline.md), [Handle errors](https://docs.zama.org/protocol/sdk/guides/handle-errors.md), [Local development](https://docs.zama.org/protocol/sdk/guides/local-development.md), [Authentication](https://docs.zama.org/protocol/sdk/guides/authentication.md), and [Decrypt values from event logs](https://docs.zama.org/protocol/sdk/guides/decrypt-from-event-logs.md).
* **Deployment:** [Deploy in production](https://docs.zama.org/protocol/sdk/go-and-rust-guide/operations/run-in-production.md), [Monitor and troubleshoot](https://docs.zama.org/protocol/sdk/go-and-rust-guide/operations/monitor-and-troubleshoot.md), and [Upgrade the daemon](https://docs.zama.org/protocol/sdk/go-and-rust-guide/operations/upgrade-and-recover.md).
* **Signed, scanned image:** the daemon image is built on Docker Hardened Images, every release digest is scanned with Trivy before it is tagged, and the image carries signed build provenance and an SBOM. Verify a release with `gh attestation verify` or cosign and pin it by digest with `ZAMA_SDK_DAEMON_DIGEST`; see [Verify and pin the image](https://docs.zama.org/protocol/sdk/go-and-rust-guide/operations/run-in-production.md#verify-and-pin-the-image). Published images are re-scanned daily.

**HCU limit errors for native clients.** A write whose gas estimation hits one of the protocol's FHE compute (HCU) limits now fails with `HCU_BLOCK_LIMIT_EXCEEDED` (retryable) or `HCU_TRANSACTION_LIMIT_EXCEEDED` instead of `TRANSACTION_REVERTED`. A write whose broadcast outcome is uncertain still fails with `TRANSACTION_OUTCOME_UNKNOWN`.

Start with the [Go quick start](https://docs.zama.org/protocol/sdk/getting-started/go-quick-start.md) or the [Rust quick start](https://docs.zama.org/protocol/sdk/getting-started/rust-quick-start.md).

### New vaults API: `defineVaultGroup` and `createVaultClient`

{% hint style="warning" %}
**Breaking change in a minor release.** The vaults API that shipped in stable 3.7.0 is removed and replaced. Code that imports from `@zama-fhe/sdk/vaults` or `@zama-fhe/react-sdk/vaults` must move to the new client; the tables below map each removed API to its replacement.
{% endhint %}

You now describe each vault once with `defineVault`, group vaults with `defineVaultGroup`, and create one client per SDK with `createVaultClient(sdk)` (`useVaultClient()` in React). The client holds no config: every method takes the vault, the group or the batch it acts on, so one client serves every chain and group. Vaults that take deposits in the same confidential asset form a group.

* **Vaults and groups.** `defineVault({ id, chainId, batchers: { deposit, redeem } })` describes one vault. `defineVaultGroup({ id, vaults })` takes vaults from `defineVault` as an array in leg order; they must be on one chain. The client reads the confidential asset and each vault's confidential share from the batchers, so a vault names no token. `deposit`, `redeem` and their `prepare*` methods take a group with a `vaultId`, or a vault on its own, which joins its batcher directly and shows the choice. A group holds at most `MAX_GROUP_VAULTS` vaults: what one transaction's FHE compute fits.
* **Every join covers the whole group.** `deposit` and `redeem` send a leg to every vault of the group: the chosen vault gets the amount, the others an encrypted zero. This is what hides the chosen vault. They return `JoinOutcome`, with the batch each leg landed in as a `BatchRef` (`{ chainId, batcher, batchId }`).
* **Batch actions act on one batch.** `claim`, `quit`, `dispatch` and `finalize` take one batch each. A keeper normally dispatches, finalizes and claims for every depositor. To keep the choice private when taking a deposit back from a pending batch, quit every leg of the join.
* **Batch reads.** `readBatch(batchRef, account?)` returns the batch's `state` (`pending`, `dispatched`, `finalized` or `canceled`), its timings, the account's encrypted deposit, the `actions` you can send now (`claim`, `quit`, `dispatch`, `finalize`), and `nextChangeAt`. `readOpenBatches(group, direction)` reads each vault's open batch for a form, with the batcher a join reaches on each vault.
* **Two ways to send.** The send methods (`deposit`, `redeem`, `claim`, `quit`, `dispatch`, `finalize`) sign with the SDK's signer. The `prepare*` methods return plain calls (`{ to, data, value }`) for a host with its own transaction pipeline. `prepareDeposit` and `prepareRedeem` return a `PreparedJoin` whose `calls` are in send order: the operator approvals the account lacks, then the joins, each tagged with its `kind`. `route: "direct"` prepares one transfer per vault instead of one router call, for a wallet that lands calls atomically. Every join checks the balance by default, on the `prepare*` methods too; `skipBalanceCheck: true` skips it. The check decrypts as the signer, so a join prepared for another account, or with no signer, throws `BalanceCheckUnavailableError` until it is skipped.
* **Wallet prompts.** A first redemption from a group of N vaults sent one call at a time can take up to N + 1 wallet prompts: one operator approval of the router per share token the account has not approved it on yet, then the join. An operator approval lasts a year.
* **Batcher upgrades.** A vault's batcher can be a `BatcherHistory`, so joins move to a new batcher once the last configured batch of the old one is dispatched. Batches on the old batcher can still be read, claimed and quit.
* **React hooks:** `useVaultClient`, `useBatch`, `useOpenBatches`, `useDeposit`, `useRedeem`, `useClaim`, `useQuit`, `useDispatch` and `useFinalize`. `useBatch` refetches when `nextChangeAt` passes and polls while the batch waits for a dispatch or a settlement.
* **TanStack Query:** `vaultQueryKeys` (`all`, `batch`, `openBatches`), `batchQueryOptions`, `openBatchesQueryOptions`, `depositMutationOptions`, `redeemMutationOptions`, `claimMutationOptions`, `quitMutationOptions`, `dispatchMutationOptions`, `finalizeMutationOptions`, and `invalidateAfterVaultAction(queryClient)` for a host that sends prepared calls itself.
* **Errors:** `VaultBatcherPausedError` when a batcher of the group is paused, `UnlistedConfidentialTokenError` when the router's registry does not list a multi-vault deposit's asset, `VaultBatchNotDispatchedError` (whose `state` is now the string state) when a batch to finalize is not dispatched, and `VaultJoinUnconfirmedError` when a mined join's receipt does not confirm every leg.
* **Reads on another chain.** Reads go to the group's or batch's `chainId` whatever chain the wallet is on, which needs a provider that can read another chain, such as `WagmiProvider`. A send while the wallet is on another chain throws `ChainMismatchError`, whose new `targetChainId` is the group's or batch's chain. `ReadContractConfig` and `GenericProvider.getBlockTimestamp` gain an optional `chainId`: a custom `GenericProvider` must read that chain or throw.
* **Router presets.** Chain presets gain `vaultRouterAddress`, the router a multi-vault join goes through. A group names no router; set `vaultRouterAddress` on a custom chain.

**Removed** from `@zama-fhe/sdk/vaults`, with what replaces them:

| Removed                                                                                                                                                                                    | Use instead                                                                                                                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Vault`, `createVault`, `VaultBatcher`, `createVaultBatcher`, the `VaultGroup` class, `createVaultGroup`, `VaultAddresses`, `VaultMemberConfig`                                            | `defineVaultGroup` (which returns the new `VaultGroup` data type), `createVaultClient`, the `VaultClient` type                                                                    |
| `Vault.deposit`, `Vault.redeem`, `VaultBatcher.join`, `VaultGroup.deposit`, `VaultGroup.redeem` and their `prepare*` methods                                                               | `client.deposit`, `client.redeem`, `client.prepareDeposit`, `client.prepareRedeem`, each taking the group                                                                         |
| `VaultBatcher.claim`, `quit`, `recover`                                                                                                                                                    | `client.claim`, `client.quit` and their `prepare*` methods, each taking one batch. `quit` also takes a deposit back from a canceled batch.                                        |
| `VaultBatcher.dispatchBatch`, `finalize`, `prepareFinalize`                                                                                                                                | `client.dispatch`, `client.finalize` and their `prepare*` methods, each taking one batch                                                                                          |
| `batchState`, `batchStatus`, `currentBatchId`, `paused`, `timeUntilDispatchable`, `timeUntilCallbackDeadline`, `depositOf`, the numeric `BatchState` enum, `BatchStatus`                   | `client.readBatch`, `client.readOpenBatches`, the string union `BatchState`                                                                                                       |
| `decodeJoined`, `findJoined`, `openBatchIds`, `VaultTopics`, `JoinedEvent`, `decodeVaultGroupJoins`                                                                                        | No replacement. `deposit` and `redeem` return the batch each leg landed in. A host that sends its own calls gets batch ids from its own indexer.                                  |
| The `*Contract` call builders (`joinContract`, `claimContract`, `routerJoinContract`, `encodeAllocationData`, …)                                                                           | No replacement. Use the `prepare*` methods, which return the calls.                                                                                                               |
| The per-batcher query options, `invalidateBatchQueries` and the `invalidateAfter*` helpers                                                                                                 | `batchQueryOptions`, `openBatchesQueryOptions`, the new mutation options, `invalidateAfterVaultAction`                                                                            |
| `VaultGroupJoinUnconfirmedError`                                                                                                                                                           | `VaultJoinUnconfirmedError`                                                                                                                                                       |
| From earlier beta builds: `defineVaults`, `VaultsConfig`, `JoinRecord`, `readPosition`, `exit`, `prepareExit`, `positionQueryOptions`, `exitMutationOptions`, `VaultActionNotAllowedError` | `defineVaultGroup`, `JoinOutcome.batches`, `readBatch`, `claim` and `quit`, `batchQueryOptions`, `claimMutationOptions` and `quitMutationOptions`, `VaultBatchNotDispatchedError` |

**Removed** from `@zama-fhe/react-sdk/vaults`: `useVault`, `useVaultBatcher`, `useVaultGroup`, `useJoin`, `useRecover`, `useDispatchBatch`, `useGroupDeposit`, `useGroupRedeem`, `useBatchState`, `useBatchStatus`, `useCurrentBatchId`, `usePaused`, `useBatcherTokens`, `useTimeUntilDispatchable` and `useTimeUntilCallbackDeadline`, and, from earlier beta builds, `usePosition` and `useExit`. `useDeposit`, `useRedeem`, `useClaim` and `useQuit` keep their 3.7.0 names but take new variables: the group with the join for `useDeposit` and `useRedeem`, and a `BatchRef` for `useClaim` and `useQuit`. `useDispatch` and `useFinalize` are new and also take a `BatchRef`. Use `useBatch` and `useOpenBatches` for reads.

The root entry now exports `confidentialTransferAndCallContract`, `confidentialTransferFromAndCallContract` and `unwrapAmountContract`.

See [Vaults overview](https://docs.zama.org/protocol/sdk/vaults/vaults.md) and [`VaultClient`](https://docs.zama.org/protocol/sdk/api-references/sdk/vaultclient.md).

### Typed errors for the protocol's FHE compute limits

The protocol caps the FHE compute, measured in HCU, that a transaction and a block can use. A write whose gas estimation hits one of them now throws a typed error instead of a bare `TransactionRevertedError`, from `submitTransaction`-backed methods and from `sdk.offline.prepare` alike: `HcuBlockLimitExceededError` (`HCU_BLOCK_LIMIT_EXCEEDED`) when the block has too little left, which is retryable in the next block, and `HcuTransactionLimitExceededError` (`HCU_TRANSACTION_LIMIT_EXCEEDED`) when the transaction needs more HCU, in total or in one sequential chain, than one transaction may use, which a retry cannot fix.

**Behavior change: mined reverts now throw.** A transaction that is mined and then reverts now throws `TransactionRevertedError` instead of returning a result, so code that inspected the returned result to detect a revert now gets an exception instead. `TransactionReceipt` gained an optional `status` (`"success"` or `"reverted"`); the viem, ethers and wagmi providers fill it.

See [Errors](https://docs.zama.org/protocol/sdk/api-references/sdk/errors.md#hcublocklimitexceedederror).

### Batched reads with `GenericProvider.multicall`

`GenericProvider` gains an optional `multicall({ calls, chainId? })` that runs many reads in one Multicall3 call and returns the results in call order; one reverted read rejects the whole call. `ViemProvider`, `EthersProvider` and `WagmiProvider` implement it, including on chains with no deployed Multicall3. A custom provider can leave it out, and the SDK then reads one call at a time. The result type is exported as `MulticallReturnType`. See [GenericProvider](https://docs.zama.org/protocol/sdk/api-references/sdk/genericprovider.md#multicall).

### Safe and EIP-5792 transactions resolve in `WagmiProvider`

`WagmiProvider.waitForTransactionReceipt` now also asks the connected wallet for the receipt, through `eth_getTransactionReceipt` and then `wallet_getCallsStatus`. Smart-account wallets such as Safe over WalletConnect return a hash the chain doesn't know, so shield and approve flows used to wait forever. The wait is now bounded at 3 minutes and then throws `TransactionRevertedError` saying the outcome is unknown; a revert reported by either the chain or the wallet counts as a failure.

### Registry chain refetches when a wallet connects

`useWrappersRegistryAddress`, and the hooks built on it, now refetch when a wallet connects on a different chain, instead of showing the previous chain's registry for up to 30 seconds. The hook can briefly return `undefined` after a connect or a chain switch. `zamaQueryKeys.wrappersRegistry.chainId` takes an optional `walletChainId`, so exact-match `getQueryData` or `setQueryData` calls on `chainId()` no longer match once a wallet is connected.

### Chain presets are frozen

The built-in chain presets and the `chains` map are now frozen with `Object.freeze`. Writing to a preset directly, such as `sepolia.registryAddress = …`, throws a `TypeError` in strict mode instead of silently changing the preset for the whole app. Spread a preset to customize it: `{ ...sepolia, registryAddress }`.

### Opt out of clearing credentials on wallet account changes

New `clearCredentialsOnWalletChange` option on `createConfig`. By default (`true`) the SDK keeps its existing behavior: switching wallet accounts, locking the wallet, or disconnecting wipes the previous account's transport key pair, permits, and decrypt cache. Set it to `false` to keep them. Storage is keyed per signer address and a permit is only accepted from the address that signed it, so one account can never use another's entries; keeping them lets a multi-wallet user switch A → B → A without signing a new permit or re-decrypting, and stops wallets that emit an empty account list on auto-lock (Rabby, Brave) from wiping credentials on every lock.

* **With `clearCredentialsOnWalletChange: false`:** permits still expire after `permitTTL` and transport key pairs after `transportKeyPairTTL`; cached decrypts stay until the app clears them. For an explicit sign-out, call `sdk.permits.clear()` or `useClearCredentials` before disconnecting the wallet. They need a connected wallet account to know which signer to clear.
* **Go and Rust clients:** unchanged. `UpdateAccount` / `update_account` still clear the previous account's credentials; the option is not exposed to native clients yet.

See [Wallet account changes](https://docs.zama.org/protocol/sdk/concepts/permit-model.md#wallet-account-changes) in the Permit Model.

### Permit signing with browser extensions that patch `BigInt`

`ViemSigner` and `WagmiSigner` now convert the typed-data domain `chainId` to a number and every `bigint` value in the message to a decimal string before calling viem. Browser extensions that patch how `bigint` is JSON-serialized made viem send the permit's `chainId` as `"1n"`, and the wallet rejected the signature with `chainId should be same as current chainId`; with no `bigint` left in the request, such a patch has nothing to act on. Signatures are unchanged, and `EthersSigner` was never affected.

### Telemetry as query parameters

`createConfig` now takes `telemetry: "header" | "query" | "off"`. The default, `"header"`, keeps sending the `x-zama-sdk-*` usage headers. `"query"` sends the same four fields as `zama_sdk_*` query parameters instead, for backend proxies and edges that rebuild or strip request headers. `"off"` sends nothing; `true` and `false` still work as `"header"` and `"off"`. On Node.js, `ZAMA_SDK_TELEMETRY` takes the same three values, case-insensitive, and switches the mode or turns telemetry off for the whole process; it cannot turn on what the config disabled. See [SDK usage telemetry](https://docs.zama.org/protocol/sdk/guides/telemetry.md).

### Amoy mock registry and tokens removed

The mock wrappers registry and mock confidential tokens on Polygon Amoy are no longer maintained, so the SDK no longer ships them. `polygonAmoy.registryAddress` is now `undefined`, Amoy is removed from the deprecated `DefaultRegistryAddresses` map, and the `example-polygon-amoy` app is removed. The `polygonAmoy` preset stays available for the base protocol: encrypting inputs and decrypting values on Amoy work as before. If you deploy your own registry on Amoy, pass its address via `registryAddresses` when creating a `WrappersRegistry`, or set `registryAddress` on the chain definition. The Polygon mainnet registry and wrappers are unchanged.

### `ApiKeyCookie` relayer auth removed

{% hint style="warning" %}
**Breaking change in a minor release.** `ApiKeyCookie` was part of the relayer auth options in stable 3.7.0. Code that uses it no longer compiles; see **Migrate** below.
{% endhint %}

`ApiKeyCookie` is removed from relayer authentication, so `FheChain.auth` is now `ApiKeyHeader | BearerToken`. The Zama-hosted relayer only accepts the `x-api-key` header, and in a browser the cookie never reached a server: it was written with `document.cookie` and marked `HttpOnly`, which browsers ignore when a script sets it. It was only ever sent, as a real `Cookie` header, from Node.js, which includes the daemon behind the Go and Rust clients. A setup that authenticated to its own proxy that way needs to change.

* **TypeScript:** remove `{ __type: "ApiKeyCookie" }` from `FheChain.auth`. It no longer type-checks, and a config that still carries it (from untyped code, say) throws `ConfigurationError` with `Unknown auth type: ApiKeyCookie` when the SDK builds the relayer, rather than going out without credentials.
* **Go and Rust clients:** `zama.APIKeyCookie` and `RelayerAuth::ApiKeyCookie` are removed, so code that uses them no longer compiles.
* **Daemon protocol:** `api_key_cookie` is removed from `ChainAuth` and its field number (3) is reserved. A client that still sends it is rejected with `FAILED_PRECONDITION`; run the client and the daemon at exactly the same version.
* **Migrate:** have your proxy read its credential from a header and use `ApiKeyHeader` with the optional `header` name (the default is `x-api-key`). See [Auth methods reference](https://docs.zama.org/protocol/sdk/guides/authentication.md#5-auth-methods-reference).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zama.org/protocol/sdk/changelog/v3/v3-8.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
