> ## Documentation Index
> Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Toolchain

> Minimum working setup for reading Raydium on-chain state, building transactions, and developing against the programs. Solana CLI, Anchor, SDKs in TypeScript and Python, and devnet/localnet tips.

<Info>
  Everything in this documentation assumes a working Solana development toolchain. This page lists the tools, the minimum versions known to work with Raydium as of April 2026, and the specific setup gotchas. Start here before running any of the code examples in later chapters.
</Info>

## Core tools

### Solana CLI

The canonical command-line interface for interacting with Solana clusters — wallet management, RPC calls, program deployment.

Install:

```bash theme={null}
sh -c "$(curl -sSfL https://release.solana.com/v1.18.22/install)"
# Or latest stable:
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
```

Verify:

```bash theme={null}
solana --version   # → solana-cli 1.18.22 (or later)
```

Configure for mainnet:

```bash theme={null}
solana config set --url https://api.mainnet-beta.solana.com
solana config set --keypair ~/.config/solana/id.json
solana-keygen new                           # create a wallet if you don't have one
solana address                              # your public key
```

For Raydium testing, you'll almost always want a funded devnet wallet:

```bash theme={null}
solana config set --url https://api.devnet.solana.com
solana airdrop 2                            # 2 SOL for testing
```

### SPL Token CLI

The official CLI for SPL Token / Token-2022 operations — creating mints, minting tokens, transferring.

Install (included with Solana CLI):

```bash theme={null}
spl-token --version
```

Common ops:

```bash theme={null}
spl-token create-token                                  # create an SPL Token mint
spl-token create-token --program-id TOKEN_2022 ...      # create a Token-2022 mint
spl-token create-account <MINT>                         # create an ATA
spl-token mint <MINT> 1000                              # mint 1000 tokens to your ATA
spl-token transfer <MINT> 100 <RECIPIENT>               # transfer 100
spl-token display <ACCOUNT_OR_MINT>                     # inspect
```

### Anchor CLI

Needed for fetching Raydium IDLs, building clients, and verifying programs.

Install:

```bash theme={null}
cargo install --git https://github.com/coral-xyz/anchor avm --locked
avm install 0.30.1
avm use 0.30.1
anchor --version
```

Common ops:

```bash theme={null}
anchor idl fetch <PROGRAM_ID> -o program.idl.json       # fetch the on-chain IDL
anchor idl init -f idl.json <PROGRAM_ID>                # upload an IDL
anchor build                                             # build a program from source
```

## TypeScript setup

The primary integration path for Raydium.

### Packages

```bash theme={null}
npm install \
  @solana/web3.js \
  @solana/spl-token \
  @coral-xyz/anchor \
  @raydium-io/raydium-sdk-v2 \
  bn.js \
  decimal.js
```

Versions known to work together as of April 2026:

| Package                      | Version       |
| ---------------------------- | ------------- |
| `@solana/web3.js`            | ≥1.95         |
| `@solana/spl-token`          | ≥0.4          |
| `@coral-xyz/anchor`          | ≥0.30         |
| `@raydium-io/raydium-sdk-v2` | ≥0.2.42-alpha |

### Minimal script

```ts theme={null}
import { Connection, Keypair } from "@solana/web3.js";
import { Raydium } from "@raydium-io/raydium-sdk-v2";

const connection = new Connection("https://api.mainnet-beta.solana.com", "confirmed");
const owner      = Keypair.fromSecretKey(/* your key */);

const raydium = await Raydium.load({
  connection,
  owner,
  cluster:      "mainnet",
  disableFeatureCheck: true,
});

const poolInfo = await raydium.api.fetchPoolById({ id: "..." });
console.log(poolInfo);
```

See [`sdk-api/typescript-sdk`](/sdk-api/typescript-sdk) for the full SDK reference.

## Rust setup

For CPI integration and on-chain programs.

### Toolchain

```bash theme={null}
rustup install 1.76.0           # or whatever Anchor current requires
rustup component add rustfmt clippy
solana-install init 1.18.22     # BPF toolchain included
```

### Program Cargo.toml for a Raydium CPI integration

```toml theme={null}
[dependencies]
anchor-lang        = "0.30.1"
anchor-spl         = "0.30.1"
raydium-cp-swap    = { version = "0.2", features = ["cpi"] }
raydium-clmm       = { version = "0.1", features = ["cpi"] }
```

The `"cpi"` feature imports the `cpi` module with CPI helpers (so you can `raydium_cp_swap::cpi::swap_base_input(...)`). See [`sdk-api/rust-cpi`](/sdk-api/rust-cpi).

## Python setup

Secondary integration path — common for bot developers.

### Packages

```bash theme={null}
pip install solders solana-py anchorpy
pip install raydium-py    # community Raydium SDK (not official)
```

Versions:

| Package      | Version |
| ------------ | ------- |
| `solders`    | ≥0.21   |
| `solana-py`  | ≥0.34   |
| `anchorpy`   | ≥0.21   |
| `raydium-py` | ≥0.2.1  |

### Minimal script

```python theme={null}
from solana.rpc.async_api import AsyncClient
from solders.keypair import Keypair
from anchorpy import Provider, Wallet, Program

async def main():
    conn = AsyncClient("https://api.mainnet-beta.solana.com")
    owner = Keypair()
    wallet = Wallet(owner)
    provider = Provider(conn, wallet)

    # Load IDL and program
    with open("cpmm.idl.json") as f:
        idl = json.load(f)
    program = Program(idl, CPMM_PROGRAM_ID, provider)

    pool = await program.account["PoolState"].fetch(pool_id)
    print(pool)
```

See [`sdk-api/python-integration`](/sdk-api/python-integration).

## RPC endpoints

Public mainnet RPC (`api.mainnet-beta.solana.com`) is heavily rate-limited and throttles under any load. For non-trivial usage, get a private endpoint:

| Provider          | Notes                                       |
| ----------------- | ------------------------------------------- |
| Helius            | Most popular; generous free tier.           |
| Triton            | Enterprise; premium pricing, stable.        |
| QuickNode         | Solid; sub-per-second latency.              |
| Your own RPC node | Costs \~\$500/mo in hardware; full control. |

Configure:

```ts theme={null}
const connection = new Connection("https://mainnet.helius-rpc.com/?api-key=...");
```

Some RPC operations need extended capabilities:

* `getProgramAccounts` — unrestricted scans are expensive; some providers gate or charge per scan.
* `getPriorityFeeEstimate` — Helius-specific endpoint; others have equivalents.
* `geyser` / WebSocket streaming — needed for low-latency bots; not all providers expose it.

## Devnet and localnet

### Devnet

Solana's public test cluster. Raydium has a partial devnet deployment:

* Some CPMM pools exist for testing.
* AMM v4 has historical devnet pools.
* CLMM has a few demo pools.
* Farm v6 is deployed.

```bash theme={null}
solana config set --url https://api.devnet.solana.com
solana airdrop 2
```

The SDK supports devnet via `cluster: "devnet"`:

```ts theme={null}
const raydium = await Raydium.load({ connection, owner, cluster: "devnet" });
```

**Caveat**: devnet pools have thin liquidity and may have stale state. Don't rely on devnet for price discovery; use it for building-and-testing-instruction flows only.

### Localnet with a forked mainnet state

For realistic testing, fork mainnet state into a local validator:

```bash theme={null}
solana-test-validator \
  --url https://api.mainnet-beta.solana.com \
  --clone CPMMoo8L3F4NbTegBCKVNunggL7H1Zpdmwpwh8KMoZ0F \
  --clone CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK \
  --clone <SOME_POOL_ID> \
  --clone <SOME_MINT_ID>
```

This clones specific program/account state to localhost, where you can transact freely. Ideal for:

* Unit-testing your CPI integration against a real Raydium program.
* Replaying a transaction with a modified parameter to debug.
* Stress-testing with large synthetic volumes.

Raydium's team uses forked localnet extensively for regression testing prior to mainnet deployment.

## Project templates

### TypeScript integration starter

```
my-raydium-app/
├── package.json
├── tsconfig.json
├── src/
│   ├── swap.ts           # swap example
│   ├── add-liquidity.ts
│   └── read-pool.ts
└── .env                  # RPC URL, wallet path
```

Minimal `package.json`:

```json theme={null}
{
  "name": "my-raydium-app",
  "type": "module",
  "scripts": { "swap": "tsx src/swap.ts" },
  "dependencies": {
    "@raydium-io/raydium-sdk-v2": "^0.2.42-alpha",
    "@solana/web3.js": "^1.95",
    "@solana/spl-token": "^0.4"
  },
  "devDependencies": {
    "@types/node": "^20",
    "tsx": "^4",
    "typescript": "^5"
  }
}
```

### Anchor CPI program starter

```
my-raydium-cpi/
├── Anchor.toml
├── Cargo.toml
├── programs/
│   └── my-cpi/
│       ├── Cargo.toml
│       └── src/lib.rs
└── tests/
    └── my-cpi.ts
```

With Anchor 0.30:

```bash theme={null}
anchor init my-raydium-cpi
cd my-raydium-cpi
# add raydium-cp-swap to Cargo.toml with features = ["cpi"]
anchor build
anchor test
```

## Useful CLI utilities

### `solana-keygen`

```bash theme={null}
solana-keygen new --outfile ./wallet.json          # generate a key
solana-keygen pubkey ./wallet.json                 # show public key
```

### Reading any account

```bash theme={null}
solana account <ADDRESS> --output json-compact
```

Useful for eyeballing pool state without a decoder.

### Program logs

```bash theme={null}
solana logs | grep CPMMoo8                         # tail CPMM-related tx logs
```

### Transaction inspection

```bash theme={null}
solana confirm <TX_SIGNATURE> -v                   # pretty-prints logs
```

Or via [explorer](https://explorer.solana.com) — paste the signature and look at the "Program Logs" tab.

## Environment hygiene

### Separate wallets per purpose

* **Development wallet**: holds testnet SOL, used for building.
* **Production wallet**: holds real SOL, used only for deploys / multisig submissions.
* **Hot wallet for bots**: small balance, narrow permissions.

Keys should never be hardcoded. Use environment variables or secret managers.

### `.env` pattern

```
# .env (not committed)
SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=...
WALLET_PATH=/Users/you/.config/solana/id.json
```

```ts theme={null}
import { config } from "dotenv";
config();

const connection = new Connection(process.env.SOLANA_RPC_URL!);
```

### Version pinning

Lock all Solana-ecosystem dependencies. The ecosystem moves fast; a minor version bump of `@solana/web3.js` has previously introduced breaking changes. Use `package-lock.json` / `Cargo.lock` religiously.

## Pointers

* [`sdk-api/typescript-sdk`](/sdk-api/typescript-sdk) — TypeScript SDK reference.
* [`sdk-api/rust-cpi`](/sdk-api/rust-cpi) — Rust CPI usage.
* [`sdk-api/python-integration`](/sdk-api/python-integration) — Python setup.
* [`solana-fundamentals/programs-and-anchor`](/solana-fundamentals/programs-and-anchor) — Anchor background.

Sources:

* [Solana install docs](https://docs.solana.com/cli/install-solana-cli-tools).
* [Anchor book: getting started](https://book.anchor-lang.com/getting_started/installation.html).
* [Raydium SDK v2 repo](https://github.com/raydium-io/raydium-sdk-V2).
