Deploy Smart Contract on Solayer Devnet
A complete step-by-step guide to deploy your first “Hello, Solayer!” contract on Solayer Devnet using the latest stable toolchain.
Prerequisites
-
System: macOS, Linux, or Windows with WSL
-
Basic terminal knowledge: Running commands in terminal
Step 1: Install Rust (if not already installed)
If you don’t have Rust installed:
Verify Rust installation:
Step 2: Install Latest Solana CLI
Install the latest Solana CLI 3.0.0 from Anza:
Add Solana CLI to your PATH:
Verify installation:
You should see: solana-cli 3.0.0 (src:21f770aa; feat:2900245688, client:Agave)
Step 3: Create Hello Solayer Project
Create a new Rust library project:
Add the latest Solana program dependency:
Update Edition: Modern cargo defaults to edition “2024”. For Solana programs, we need to enable the edition2024
feature.
Update your Cargo.toml
:
Note: This uses the latest edition 2024 with the required feature flag for Solana compatibility.
Step 4: Write the Hello Solayer Program
Replace the contents of src/lib.rs
with:
Step 5: Generate Keypairs
Navigate back to your project root:
Generate a keypair for your program:
Generate a keypair for your wallet:
Important: Save the displayed seed phrases securely. You’ll need them to recover your keypairs.
Get your program ID (you’ll need this later):
Step 6: Configure Solayer Devnet
Set Solana CLI to use Solayer devnet:
Set your wallet as the default keypair:
Verify your configuration:
You should see:
- RPC URL:
https://devnet-rpc.solayer.org
- Keypair Path:
./wallet-keypair.json
Step 7: Fund Your Wallet
Check your current balance:
Request test SOL from the Solayer devnet faucet:
Wait a few seconds, then check if you need more funding:
If you have less than 0.2 SOL, request more:
Note: Solayer devnet has a limit of 1 SOL per airdrop request.
Step 8: Build Your Program
Navigate to your hello directory and build the program:
Clean any existing build files:
Build the Solana program:
Navigate back to project root:
Verify the build output:
You should see hello.so
in the dist directory.
Step 9: Deploy to Solayer Devnet
Deploy your program to Solayer devnet:
Success! You should see output like:
Step 10: Verify Deployment
Check your program is deployed:
Check your remaining balance:
The deployment should have cost approximately 0.13 SOL.
Congratulations! 🎉
You have successfully deployed your first Hello Solayer contract to Solayer Devnet!