---
title: CreateInstance
description: Creates the Instance PDA that anchors the Private Channels escrow
---

Creates the `Instance` PDA that anchors the escrow. Must be called before any
other operation.

## PDA Seeds

```
instance        -> ["instance", instance_seed: Pubkey]
allowed_mint    -> ["allowed_mint", instance_pda: Pubkey, mint: Pubkey]
operator        -> ["operator", instance_pda: Pubkey, operator: Pubkey]
event_authority -> ["event_authority"]
```

## Accounts

| Account                          | Writable | Signer | Description                                                                 |
| -------------------------------- | -------- | ------ | --------------------------------------------------------------------------- |
| `payer`                          | ✓        | ✓      | Fee payer and rent payer                                                    |
| `admin`                          |          | ✓      | Initial admin of the instance                                               |
| `instance_seed`                  |          | ✓      | Throwaway keypair used only for PDA derivation; its pubkey becomes the seed |
| `instance`                       | ✓        |        | Instance PDA (derived from `["instance", instance_seed.pubkey]`)            |
| `system_program`                 |          |        | System Program                                                              |
| `event_authority`                |          |        | Event authority PDA                                                         |
| `private_channel_escrow_program` |          |        | Escrow Program                                                              |

## Parameters

| Parameter | Type | Description                                                                             |
| --------- | ---- | --------------------------------------------------------------------------------------- |
| `bump`    | `u8` | Bump seed for the instance PDA. Optional: the `Async` client auto-derives it if omitted |

> The IDL contains a `discriminator: u8` argument (value `0`) that is auto-set
> by the generated client and should not be passed manually.

## Important Notes

- `instance_seed` is a throwaway keypair, used only to derive the `Instance`
  PDA. Its pubkey becomes the seed; the keypair itself is not stored or reused.
- Use `getCreateInstanceInstructionAsync`; it auto-derives `bump` and `instance`
  from `instance_seed` when they are not provided. Pass your own `bump` only if
  you already computed it via
  `Pubkey::find_program_address(&[b"instance", instance_seed_pubkey.as_ref()], &PROGRAM_ID)`
- Emits an event via `EmitEvent` CPI
