Quickstart with Anchor
Create, deploy and invoke your first program with Anchor.
Prerequisites#
- Install Rust from the official guide(opens in a new tab), the Solana CLI from the Agave releases(opens in a new tab) (the network runs Agave v3.0.14 (unmodified)), and Anchor from the Anchor docs(opens in a new tab).
- Create a keypair used only for testing and fund its address from the faucet(opens in a new tab).
solana airdropdoes not work on Kyvro —requestAirdropis disabled.
solana-keygen new --outfile ~/.config/solana/kyvro-test.json # test keypair, never reused elsewhere
solana address --keypair ~/.config/solana/kyvro-test.json # paste this address into the faucetCreate a project#
anchor init my-kyvro-app
cd my-kyvro-appThis creates a sample program in programs/my-kyvro-app/src/lib.rs with an initialize instruction.
Configure for Kyvro#
Point the provider at the Kyvro RPC and at your test wallet. Anchor reads the program ID from declare_id!() in the program and mirrors it in Anchor.toml — keep the two in sync with anchor keys sync.
[provider]
cluster = "https://rpc-testnet.kyvro.si"
wallet = "~/.config/solana/kyvro-test.json"anchor keys sync
anchor buildDeploy#
anchor deploy --provider.cluster https://rpc-testnet.kyvro.si --provider.wallet ~/.config/solana/kyvro-test.jsonThe output includes the Program Id. Paste it into the explorer(opens in a new tab) search: the address page shows the program, its program-data account and its upgrade authority.
Interact#
Invoke the program from a script. The keypair path comes from the environment — it is never committed or pasted into code.
import { readFileSync } from "node:fs";
import { AnchorProvider, Program, Wallet } from "@coral-xyz/anchor";
import { Connection, Keypair } from "@solana/web3.js";
import idl from "../target/idl/my_kyvro_app.json";
const keypairPath = process.env.KYVRO_KEYPAIR;
if (!keypairPath) throw new Error("KYVRO_KEYPAIR is not set");
const payer = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(readFileSync(keypairPath, "utf8"))));
const connection = new Connection("https://rpc-testnet.kyvro.si", "confirmed");
const provider = new AnchorProvider(connection, new Wallet(payer), { commitment: "confirmed" });
const program = new Program(idl, provider);
const tx = await program.methods.initialize().rpc();
console.log("signature", tx);Look the signature up on the explorer(opens in a new tab) to see the instructions, logs and balance changes.
Repeatable deploys#
Because the Testnet can be reset, keep deploys in a script so you can redeploy everything with one command, and read program IDs from a manifest your scripts write — not from constants in app code.
KYVRO_KEYPAIR=~/.config/solana/kyvro-test.json anchor deploy \
--provider.cluster https://rpc-testnet.kyvro.si \
--provider.wallet "$KYVRO_KEYPAIR"Something wrong or missing on this page? Send developer feedback.