Skip to main content
Learn how to create a Kamino vault with custom fee structures, deposit limits, and allocation strategies. The SDK manages vault initialization, metadata setup, and lookup table creation to optimize future transactions.

Creating a Vault

Initialize a new vault with custom configuration and prepare it for user deposits.
1

Import Dependencies

Import the required packages for Solana RPC communication, Kamino SDK operations, and Kit transaction building.
2

Load Admin Keypair and Initialize Manager

Load the admin keypair from file and initialize the Kamino manager with proper slot timing.
parseKeypairFile loads an existing keypair from a JSON file that will become the vault admin. The admin wallet needs SOL for rent and fees, plus a small amount of the vault token: creation takes an initial deposit of 1,000 lamports (0.001 USDC here) from it.
3

Configure Vault

Create a vault configuration with the core identity and fee structure.
The parameters from minDepositAmount down are optional. The values shown are the defaults, so omit them to keep the defaults. All parameters can be changed after creation. Unallocated weight and cap can only be set after creation, see the Configure Vault Parameters step below.
4

Generate Vault Creation Instructions

Pass the vault configuration to the Kamino manager to generate all required initialization instructions.
createVaultIxs returns a new vault keypair plus instruction bundles for initializing the vault, creating and filling its lookup table, creating its two farms (the Vault Farm for rewards and the First Loss Capital Farm), registering the farms on the vault, and setting the share token metadata. They are sent across four transactions in the steps below.
5

Create a Send Function

Vault creation sends several transactions, so define one function that builds, signs, and sends each of them.
signTransactionMessageWithSigners signs with every signer in the instructions, including the new vault keypair. The blockhash is fetched inside the function so each transaction gets a fresh one.
6

Initialize the Vault

Send the first transaction: it creates the vault, applies the configuration, and creates the vault’s lookup table.
The share token metadata instruction is sent later, in the last transaction. Adding it here takes this transaction over Solana’s 1,232-byte limit.
7

Create and Attach Farms

Create the Vault Farm and the First Loss Capital Farm, and register each one on the vault. Each farm is one transaction.
If you skip this step, you can create farms later with kaminoManager.createVaultFarmIxs and register them with kaminoManager.updateVaultFarmIxs (Vault Farm) or kaminoManager.updateVaultFirstLossCapitalFarmIxs (First Loss Capital Farm). See Configure farms for the full post-creation flow.
8

Fill the Lookup Table and Set Share Metadata

Add the vault’s accounts to its lookup table and set the share token metadata.
A new lookup table can only be extended from the slot after it was created, so this transaction goes last. The lookup table keeps deposit and withdraw transactions for this vault small.
9

Verify the Setup

Check that every part of the vault was set up.
If a transaction failed, kaminoManager.finishVaultSetup(vault, kaminoVaultConfig) returns only the missing instructions, so you can send them without starting over.
10

Configure Vault Parameters (Post-Creation)

Set the parameters that are only available after creation (unallocated weight and cap), or update any parameter set during creation.
Every creation parameter has an update method with the same arguments, for example kaminoManager.updateVaultMinDepositAmountIxs(vault, 1000, vaultReservesMap, adminSigner). Each returns { updateVaultConfigIx }. The new vault holds no allocations yet: add reserves with kaminoManager.updateVaultReserveAllocationIxs before it can earn.

Full Code Example