Skip to main content

Documentation Index

Fetch the complete documentation index at: https://kamino.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

This walkthrough takes you from zero to a working market with one reserve on Kamino’s staging environment. Staging runs the klend program on Solana mainnet under a separate program ID, so prices, oracles, and conditions match production while the market itself stays isolated from prod.
Want a fully isolated sandbox instead? Replace every --staging flag below with --devnet to run against Solana devnet. Devnet is good for learning the CLI without any mainnet exposure; staging is the right target if you intend to graduate the same configuration to mainnet.

Prerequisites

RequirementWhy
Node.js + YarnThe CLI is a TypeScript app shipped with klend-sdk
Solana CLI (solana-keygen)To create and inspect the admin keypair
A funded Solana walletTo pay transaction fees and seed the first deposit
A Solana RPC endpointPublic RPC works for staging; private RPC strongly recommended
If you’re missing any of these, follow the CLI installation & setup page first.

1. Clone and configure

git clone git@github.com:Kamino-Finance/klend-sdk.git
cd klend-sdk
yarn
Create a .env file in the project root:
ADMIN=./admin.json
RPC=https://api.mainnet-beta.solana.com
KLEND_PROGRAM_ID_MAINNET="KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
KLEND_PROGRAM_ID_STAGING="SLendK7ySfcEzyaFqy93gDnD3RtrpXJcnRwb6zFHJSh"
KVAULT_PROGRAM_ID_MAINNET="KvauGMspG5k6rtzrqqn7WNn3oZdyKqLKwK2XWQ8FLjd"
KVAULT_PROGRAM_ID_STAGING="stKvQfwRsQiKnLtMNVLHKS3exFJmZFsgfzBPWHECUYK"
KVAULT_PROGRAM_ID_DEVNET="devkRngFnfp4gBc5a3LsadgbQKdPo8MSZ4prFiNSVmY"
Generate or point to an admin keypair:
solana-keygen new -o admin.json
solana-keygen pubkey admin.json   # send a small amount of SOL to this address

2. Create the market

yarn kamino-manager create-market --staging --mode execute
The CLI returns a market address in its output. Save it; every subsequent command takes it as --lending-market or --market.
export MARKET=<paste_market_address_here>
Always start a new operation with --mode inspect (prints a simulator URL) or --mode simulate (runs the simulation and prints the result). Switch to --mode execute once the dry run looks correct.

3. Add a reserve

The repo includes configs/reserve_config_example.json as a starting point. For staging, USDC is a sensible first reserve.
yarn kamino-manager add-asset-to-market \
  --market $MARKET \
  --mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
  --mint-program-id TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA \
  --reserve-config-path ./configs/reserve_config_example.json \
  --staging \
  --mode execute
The example reserve config is a starting template. Before mainnet, replace it with a config tuned for the asset, oracle, and risk profile you actually want. See Risk parameters and Reserve config reference.
Repeat the command with a different --mint for each additional reserve.

4. Verify the market state

Download the full market and reserve config to confirm everything is wired up:
yarn kamino-manager download-lending-market-config-and-all-reserves-configs \
  --lending-market $MARKET \
  --staging
The CLI writes the configs to ./configs/{MARKET_ADDRESS}/. Open them and check:
  • Market lending_market_owner is your admin pubkey
  • Each reserve has status: 0 (Active)
  • Each reserve has a populated tokenInfo.scopeConfiguration.priceFeed (or Pyth / Switchboard equivalent)
  • depositLimit and borrowLimit are non-zero where you want activity

5. Test a deposit

Open the staging webapp scoped to your market:
https://app.kamino.finance/?STAGING_PROGRAM&market=<MARKET_ADDRESS>
Connect a wallet that holds the asset, deposit, and confirm the position appears. If you don’t see the market, double-check the staging program flag and that the reserve status is 0.

What you have now

A working market with one reserve, owned by your hot wallet, running against staging. The on-chain accounts are real; the program is real; the oracles are real. The only thing missing for production is multisig ownership.

Next steps for going to production

1

Tune risk parameters

Replace the example config with values appropriate for the asset and your risk thesis. → Risk parameters
2

Configure oracles

Pick the right oracle source, set TWAP guards, configure staleness. → Configure oracles
3

Enable any optional features

Withdrawal queue, fixed rate reserves, borrow orders, eMode, permissioning — opt in per feature. → Withdrawal queue
4

Set up a Squads multisig

Production markets must be owned by a multisig. → Transfer to multisig
5

Re-run on mainnet

Drop the --staging flag and re-run the create + add-reserve flow. The mainnet program ID KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD is the default.

Common errors at this stage

ErrorCause
RPC rate limit / transaction failedUse a private RPC (Helius, Triton, etc.). Public mainnet RPC is rate-limited.
InvalidOracleConfigThe reserve’s tokenInfo doesn’t match a real oracle account. Run get-oracle-mappings to find the correct addresses.
Reserve init failed: account already existsRe-running add-asset-to-market with the same mint. Each mint can have only one reserve per market.
Insufficient funds for transaction feeThe admin wallet is empty. Send a small amount of SOL.
For a wider catalog of errors, see Troubleshooting.