- Overview
- Prerequisites
- ✔ Rust & Cargo
- ✔ Solana CLI
- ✔ Node.js + Yarn or PNPM
- ✔ Alchemy Solana RPC URL
- Step 1: Create a new Solana program
- Step 2: Add Solana dependencies
- Step 3: Write the Hello World program
- Step 4: Build the program
- Step 5: Create a Solana keypair
- Step 6: Set your network to devnet
- Step 7: Airdrop SOL
- Step 8: Deploy your program
- Step 9: Invoke program via Alchemy RPC
- 🎉 Success
Build & Deploy a “Hello World” Solana Program
Create, deploy, and call your first on-chain Solana program using Rust and Alchemy RPC
This guide walks you through building, deploying, and calling a minimal
Solana on-chain program using Rust and Alchemy’s Solana RPC.
If you’re new to Solana development, this is the perfect first step to
validate your toolchain and RPC setup.
Overview
In this tutorial, you will:
- Install Solana + Rust tooling
- Scaffold a new Rust program
- Write a modern, minimal Solana program
- Build it to BPF
- Deploy to devnet
- Invoke it with a TypeScript client using Alchemy RPC
- View logs proving the program ran correctly
Prerequisites
✔ Rust & Cargo
✔ Solana CLI
✔ Node.js + Yarn or PNPM
✔ Alchemy Solana RPC URL
From Alchemy dashboard → Create App → Solana → devnet.
Step 1: Create a new Solana program
Step 2: Add Solana dependencies
Open Cargo.toml and replace the contents with:
Step 3: Write the Hello World program
Put this into src/lib.rs:
Step 4: Build the program
To test this command was successful, run ls target/deploy - this should output something similar to:
Step 5: Create a Solana keypair
You’ll get:
This wallet will pay for your deployments!
Step 6: Set your network to devnet
Use Alchemy:
Your terminal will output a confirmation message. ✅
Step 7: Airdrop SOL
Note: You may get a rate-limit error. If you do and need more devnet funds, try the official Solana faucet.
Step 8: Deploy your program
Your terminal will output something like:
Step 9: Invoke program via Alchemy RPC
🎉 Success
You now have a working Solana program deployed on Solana devnet!
Check out the next guide on how to:
- set up a frontend for this program
- invoke it using Alchemy 🚀