<!-- tempo-docs-context -->
> Source: [/docs/zones/examples](https://tempo.com/developers/docs/zones/examples.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)

> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.

# Client Setup

Configure the Zone chain and authenticated Wagmi client that the Build examples import.

## Overview

`zone.config.ts` defines the Zone chain and an authenticated Wagmi config that the Build examples import. It needs the chain ID, Zone RPC URL, and authorization token from [Connect to a Zone](https://tempo.com/developers/docs/zones/connect).

These examples run on your backend. Have browser applications call your account-scoped backend. Don't give them shared operator credentials.

## Configure Wagmi for a Zone

Install `@wagmi/core` and `viem` with `pnpm add @wagmi/core viem`. Set `ZONE_CHAIN_ID`, `ZONE_PARENT_CHAIN_ID`, `ZONE_RPC_URL`, and `ZONE_AUTH_TOKEN` in your environment.

`ZONE_PARENT_CHAIN_ID` is the chain ID of the Tempo network that hosts the portal. It's `4217` for mainnet or `42431` for Moderato.

Save this file as `zone.config.ts` in an ESM project. It configures reads against the Zone, with no wallet connector or signing account.

```ts [zone.config.ts]
import { createConfig, http } from '@wagmi/core'
import { Zone } from 'viem/tempo'

const rpcUrl = process.env.ZONE_RPC_URL!
export const zoneChain = Zone.from({
  sourceId: Number(process.env.ZONE_PARENT_CHAIN_ID),
  id: Number(process.env.ZONE_CHAIN_ID),
  name: 'Tempo Zone',
  rpcUrls: { default: { http: [rpcUrl] } },
})

export const zoneConfig = createConfig({
  chains: [zoneChain],
  transports: {
    [zoneChain.id]: http(rpcUrl, {
      fetchOptions: {
        headers: { 'X-Authorization-Token': process.env.ZONE_AUTH_TOKEN! },
      },
    }),
  },
})
```

Import `zoneChain` or `zoneConfig` into each example. Set `account` to the authenticated address and `token` to the enabled token address. Set `decimals` to the token's configured precision. The Zone RPC scopes every read to the account that the authorization token represents.

## Use the Zone in React

For React applications, use your backend's authenticated, account-scoped RPC proxy as the browser transport. Configure its chain in your [Wagmi provider](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#wagmi-client). On every request, the server must authenticate the current user and select that user's Zone token. Don't use one shared account token for all customers.

## Related

[Deposit Into a Zone](https://tempo.com/developers/docs/zones/deposit): Use for funding a private account through the portal on Tempo.

[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc): Covers per-account scoping and authorization tokens.

[Connect to the Sandbox](https://tempo.com/developers/docs/guide/private-zones/connect-to-a-zone): Use for trying a Viem Zone client with test funds in the testnet sandbox.

[Balances and Activity](https://tempo.com/developers/docs/zones/balances): Use for reading balances and transfers with this config.
