# Prerequisites for Canton as Source Tutorials
Source: https://docs.chain.link/ccip/canton/tutorials/source/prerequisites
Last Updated: 2026-07-06

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

> **CAUTION**
>
> Addresses shown may change due to upgrades since Canton contracts are immutable. Confirm party IDs and contract addresses with [Chainlink CCIP](https://chain.link/ccip-contact).

Before starting the **Canton as Source** (`canton2any`) tutorials, ensure you have the following. New to Canton? Read [Key Concepts](/ccip/canton/concepts/key-concepts) first (parties, fees, tooling).

> **NOTE: Tooling**
>
> These tutorials use [`ccip-starter-kit-canton`](https://github.com/smartcontractkit/ccip-starter-kit-canton) — tutorial scripts on top of [`@chainlink/ccip-sdk`](https://www.npmjs.com/package/@chainlink/ccip-sdk) (same send/execute model as [`ccip-cli`](https://github.com/smartcontractkit/ccip-tools-ts)). For production integrations, use the SDK or CLI directly.

> **NOTE: Testnet only**
>
> These tutorials use **Canton testnet** and **Ethereum Sepolia** only. The starter kit's `helperConfig.ts` and `canton-config.example.json` are pre-configured for the Canton CCIP testnet lane.

## Development Environment

- **Node.js v22 or higher**: You can use the [nvm package](http://nvm.sh/) to install and switch between Node.js versions. Once installed, verify the node version with:

  ```bash filename="Terminal"
  node -v
  ```

  Example output:

  ```text
  $ node -v
  v22.15.0
  ```

- **npm**: For installing and managing dependencies.

- **Git**: For cloning the repository.

## Starter Kit Repository

1. Clone the [CCIP Canton Starter Kit](https://github.com/smartcontractkit/ccip-starter-kit-canton):

   ```bash filename="Terminal"
   git clone https://github.com/smartcontractkit/ccip-starter-kit-canton.git
   ```

2. Navigate to the directory:

   ```bash filename="Terminal"
   cd ccip-starter-kit-canton
   ```

3. Install dependencies:

   ```bash filename="Terminal"
   npm install
   ```

The starter kit uses [`@chainlink/ccip-sdk`](https://www.npmjs.com/package/@chainlink/ccip-sdk) v1.18+ for Canton and Ethereum Sepolia interactions.

## Understanding Canton Configuration (`canton-config.json`)

Canton deployment fields live in `config/canton-config.json`. Copy the example file and replace the **`party`** placeholder:

```bash filename="Terminal"
cp config/canton-config.example.json config/canton-config.json
```

Replace **`party`** with your Canton testnet party ID (it must match your validator user). Chainlink provides shared CCIP endpoints (`ccipParty`, `indexerUrl`, `ccvs`, etc.) in the starter kit; you supply your own participant Ledger API access and validator configuration.

All other fields (`ccipParty`, `indexerUrl`, `ccvs`, `chainId`, `auth`) are pre-configured for the Canton CCIP testnet lane in `canton-config.example.json`.

**Example `canton-config.json`:**

```json filename="config/canton-config.json"
{
  "party": "YOUR_LEDGER_PARTY::1220…",
  "ccipParty": "ccipOwner::1220e382f4e57b0815e6be737006e381e6b7de448e06bd033ece6df498017879f551",
  "auth": {
    "type": "authorizationCode",
    "authUrl": "https://auth.example.com"
  },
  "indexerUrl": "https://indexer-1.testnet.ccip.chain.link",
  "chainId": "canton:TestNet",
  "ccvs": ["committeeverifier-pttst@ccvOwner::1220e382f4e57b0815e6be737006e381e6b7de448e06bd033ece6df498017879f551"]
}
```

Key fields:

- **`party`**: Your ledger party — the sender for `canton2any` scripts and the default Canton receiver for `any2canton` scripts.
- **`auth`**: Selects the OIDC scheme and carries the non-secret parameters; credentials come from `.env` (see [Canton Ledger Access](#canton-ledger-access)).
- **`ccvs`**: CommitteeVerifier contract addresses in raw `instanceId@party` form, required for message validation.
- **`indexerUrl`**: Global CCIP indexer endpoint for proofs and disclosures.

EDS endpoints are resolved from the SDK's per-network defaults; override per owner with `externalEdsUrlsByOwner` in `canton-config.json` if you host your own EDS.

Network selectors, router addresses, token instruments, and the default **`--gasLimit`** (`200000` for destination `ccipReceive`) are defined in [`helperConfig.ts`](https://github.com/smartcontractkit/ccip-starter-kit-canton/blob/main/helperConfig.ts).

## Optional script flags

`canton2any:*` send scripts accept these flags:

| Flag            | Default      | Description                                                                                                          |
| :-------------- | :----------- | :------------------------------------------------------------------------------------------------------------------- |
| `--gasLimit`    | `200000`     | Gas limit for `ccipReceive` on Sepolia (the destination chain)                                                       |
| `--feeToken`    | `native`     | CCIP fee token on Canton (`native`: Amulet; or `link`)                                                               |
| `--evmReceiver` | See config   | Override the default Sepolia receiver contract                                                                       |
| `--no-exec`     | auto-exec on | Skip automatic execution on Sepolia; run `canton2any:manual-exec` after Committee Verifier proofs are on the indexer |

> **NOTE: Finality flag**
>
> `--finality` is an `any2canton`-only flag (Canton as destination). It is supported for data-only sends; for token or data-and-token sends, only if your token pool supports it — the starter kit's TEST ↔ LINK pool does not. See the [Canton as Destination prerequisites](/ccip/canton/tutorials/destination/prerequisites#optional-script-flags) for details. It is not accepted by `canton2any:*` send scripts.

## Canton Ledger Access

Canton sends and executes use **OIDC bearer-token authentication** and direct ledger submit (same as `ccip-cli` without `--wallet`). No local signing key is required for participant-hosted parties.

Canton uses standard [OpenID Connect (OIDC)](https://openid.net/connect/). You can authenticate with any compatible identity provider (Okta, Keycloak, Microsoft Azure, Auth0, and others) or a local user on development nodes — see the [Canton validator documentation](https://docs.canton.network/) for setup. Local or development nodes do not require an external identity provider.

The starter kit resolves a bearer token before each run:

1. `auth` block in `canton-config.json` — `authorizationCode` (interactive browser login, the default), `clientCredentials` (machine-to-machine), or `static`
2. `CANTON_JWT` in `.env` (pre-fetched token, when no `auth` block is set)
3. `CANTON_AUTH_URL` + `CANTON_CLIENT_ID` (+ `CANTON_CLIENT_SECRET` for client credentials) in `.env` (when no `auth` block is set)

With the default `authorizationCode` scheme, the first ledger-connected script run opens your browser for login, waits for the callback on `http://localhost:8400/callback`, and exchanges the authorization code (with PKCE) for a bearer token.

> **TIP: What Chainlink provides**
>
> Chainlink provides shared CCIP infrastructure for Canton lanes — **EDS**, **indexer**, and on-ledger contract references. These are pre-filled in `canton-config.example.json`. Contact Chainlink ops for contract references (owner party, TAR, RMNRemote, FeeQuoter). You supply your own participant Ledger API access and validator user.

## Wallets and Accounts

- **Canton party**: Your on-ledger party ID in `canton-config.json`. Scripts submit commands on behalf of this party via `submit-and-wait-for-transaction`.

- **Ethereum Sepolia account** (optional for source sends): Required only if you run `canton2any:manual-exec` on Sepolia or want to verify token delivery on the destination chain. Set `EVM_PRIVATE_KEY` and `ETHEREUM_SEPOLIA_RPC_URL` in `.env`. For data-only sends with default auto-execution, you only need the **receiver contract address** on Sepolia (the starter kit provides a default).

## Environment Configuration (`.env` file)

Create `.env` from the example and replace every placeholder:

```bash filename="Terminal"
cp .env.example .env
```

| Variable                   | Description                                                                                                  |
| :------------------------- | :----------------------------------------------------------------------------------------------------------- |
| `EVM_PRIVATE_KEY`          | Sepolia signer private key (hex, with or without `0x`)                                                       |
| `ETHEREUM_SEPOLIA_RPC_URL` | Your Sepolia JSON-RPC URL                                                                                    |
| `CANTON_LEDGER_URL`        | Canton participant **JSON Ledger API** URL (not EDS or the validator)                                        |
| `CANTON_CONFIG_PATH`       | Path to `canton-config.json` (default: `./config/canton-config.json`)                                        |
| `CANTON_CLIENT_ID`         | OIDC client ID for your validator user (required unless `CANTON_JWT` is set)                                 |
| `CANTON_CLIENT_SECRET`     | OIDC client secret — set for the client-credentials flow; omit for the browser-based authorization-code flow |
| `CANTON_JWT`               | Optional pre-fetched bearer token (skips the OIDC flow)                                                      |

**Example `.env` file:**

```bash filename=".env"
EVM_PRIVATE_KEY=0xYourSepoliaPrivateKey
ETHEREUM_SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY
CANTON_LEDGER_URL=https://your-canton-ledger-api.example.com
CANTON_CONFIG_PATH=./config/canton-config.json
CANTON_CLIENT_ID=your_client_id
```

> **CAUTION: Keep your secrets safe**
>
> Never commit `.env`, OIDC secrets, or private keys to version control.

## Testnet Tokens

### Amulet (default CCIP fee token on Canton)

`canton2any` scripts pay CCIP fees in **Amulet** by default. Fund your Canton party with Amulet holdings before sending.

Check balances:

```bash filename="Terminal"
npm run check-balance
```

Or check Amulet only:

```bash filename="Terminal"
npm run check-balance -- --chain canton --token amulet
```

### LINK on Canton (token transfer tutorials)

Token transfer and programmable token transfer tutorials send **LINK** from Canton to Sepolia. Your party needs LINK (`link-token`) holdings on Canton.

```bash filename="Terminal"
npm run check-balance -- --chain canton --token link
```

Pass `--feeToken link` on send scripts to pay CCIP fees in LINK instead of Amulet.

### Sepolia ETH (optional)

If you run `canton2any:manual-exec` yourself, your Sepolia account needs test ETH for gas. Use the [Chainlink Faucet](https://faucet.chain.link) to obtain test ETH.

## Verify Setup

From the starter kit root, confirm Canton connectivity and balances:

```bash filename="Terminal"
npm run check-balance
```

You should see LINK and Amulet balances for your Canton party. If you configured `EVM_PRIVATE_KEY`, Sepolia LINK and TEST balances are shown as well.

When setup is complete, continue to the [Canton as Source tutorials](/ccip/canton/tutorials/source).

> **CAUTION: Educational Example Disclaimer**
>
> Please note, this page contains community examples only — these are not Chainlink products or services and are not
> supported or maintained by Chainlink. This code represents an example of using a Chainlink product or service, and is
> intended for demonstration and educational purposes only. It is provided "AS IS" and "AS AVAILABLE" without warranties
> of any kind, may not have been audited, and may omit checks or error handling. Each party intending to use this
> example code does so entirely at their own risk and must perform its own audits, security and code review, key
> management, and testing before any production deployment and ensure the operation and performance of such code matches
> expectations. Neither Chainlink Labs nor the Chainlink Foundation deploys, operates, monitors, maintains or endorses
> any deployment of this code. Note that this is not a Chainlink product, feature or service, and there are no
> commitments made with respect to the code, including compatibility with future Chainlink releases. You should not rely
> on this code without first conducting your own technical, engineering, and security review. This code is also outside
> the scope of any Chainlink bug bounty programs. Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node
> operators are responsible for outcomes due to errors in this example or how it is deployed or operated, or liable for
> any resulting claims or damages. Use of the Chainlink Network is subject to the Chainlink Foundation [Terms of
> Service](https://chain.link/terms), which provides important information and disclosures. By using this code, you
> acknowledge and agree to these terms.