General
Testing with Surfpool

Testing with Surfpool

This content is being translated and will be available here when ready.

Surfpool 101

Testing with Surfpool

Testing Solana programs that rely on Cross-Program Invocations (CPIs) traditionally requires developers to dump accounts and programs from mainnet, then upload them to a local validator.

This process works for a few accounts, but becomes completely unfeasible when testing CPIs into complex programs like Jupiter, which can depend on 40+ accounts and 8+ programs.

Surfpool solves this by enabling developers to simulate programs locally using mainnet accounts fetched on-demand, plus additional capabilities:

  • Customize system variables: Time travel (test your program at any historical slot or timestamp), pause the clock, or halt block production
  • Modify account data: Set SOL supply (total, circulating, and non-circulating), transfer account data between programs, or update account core data and token account information
  • Analyze chain data: Profile transactions for compute units, account changes, and execution details, then retrieve detailed profiles by signature, UUID, or tag

What is Surfpool

Surfpool is the comprehensive SDK and tooling suite, while Surfnet is the local Solana network it creates. Think of Surfpool as your development environment and Surfnet as the blockchain network running inside it.

Surfnet serves as a drop-in replacement for solana-test-validator, purpose-built to deliver the best development experience for Solana builders.

Developed by the TxTx team, Surfpool seamlessly integrates Infrastructure as Code into Anchor-based projects, enabling reproducible, auditable, and secure deployments to any Solana network—private or public.

First Steps

Everything you need to run Surfnet is included in the Surfpool SDK. Since installation varies by operating system, follow the official Installation Page for your specific setup.

After installing the Surfpool SDK, start Surfnet with:

bash
surfpool start

This starts Surfnet on the standard local validator port (http://127.0.0.1:8899) with a terminal UI displaying:

  • Slots and Epoch: Currently executing slots process automatically every 400ms. Use Tab to manually advance to the next slot, or Spacebar to pause/resume automatic block production
  • Transaction logs: Timestamped activity stream showing everything your transactions execute

For a browser-based experience, connect to Surfpool Studio at this link.

Surfpool Studio includes all terminal UI features plus additional capabilities like time travel and adding tokens to any account for any mint.

Deploying Programs

After setting up Surfnet, deploy your program and start building.

Anchor programs: Use anchor deploy with your Anchor.toml configured for [programs.localnet].

Pinocchio programs: Deploy via Solana CLI with your config set to localnet: solana program deploy ./target/deploy/your_program.so --program-id ./target/deploy/your_program-keypair.json

Running surfpool start into an Anchor Workspace prompts you to use Infrastructure as Code for seamless automatically deployment of your program on Surfnet.

Testing Programs

After deploying to localnet, connect to Surfnet by targeting the local validator:

ts
import { Connection } from "@solana/web3.js";
 
const connection = new Connection("http://localhost:8899", "confirmed");
Daftar Isi
Lihat Sumber
Blueshift © 2025Commit: 0ec4e4d