Building Programs
Before deployment, build your program:target/deploy/ directory.
Upgradeable Program Deployment
Initial Deployment
Deploy a new upgradeable program:- Creates a program account
- Uploads program data
- Deploys the program
- Makes it executable
Deploy with Specific Program ID
Use a specific program keypair:Deploy with Custom Authority
Specify upgrade authority:Deploy as Final (Immutable)
Deploy without upgrade capability:Deploy with Buffer
Use an intermediate buffer for large programs:Deploy with Max Length
Reserve space for future upgrades:Deploy with Auto-Extend
Automatically extend program size if needed (default):Upgrading Programs
Write to Buffer
First, write the new program to a buffer:Upgrade from Buffer
Upgrade the program using the buffer:Upgrade with Custom Authority
Direct Upgrade
Upgrade without separate buffer step:Managing Buffers
Show Buffer Information
Display buffer details:List All Buffers
Show all buffers you own:Set Buffer Authority
Change buffer authority:Close Buffer
Close a buffer and reclaim SOL:Close All Buffers
Close all buffers you own:Managing Program Authority
Set Upgrade Authority
Change the upgrade authority:Set Authority with Verification
Verify new authority as a signer:Make Program Immutable
Remove upgrade authority permanently:Skip Authority Verification
Set authority without requiring signature:Program Information
Show Program Details
Display program information:- Program account address
- Owner (loader)
- Upgrade authority
- Last deploy slot
- Data length
- Balance
List All Programs
Show all programs you own:List by Authority
Filter by upgrade authority:List All Programs
Show programs for all authorities:Dumping Programs
Download Program Data
Save program executable to file:Dump Buffer Data
Extending Programs
Extend Program Size
Increase program data account size:Closing Programs
Close Program Account
Close a program and reclaim SOL:Close with Bypass
Skip the warning:Close with Custom Authority
Specify Recipient
Loader V4 Programs
New loader-v4 provides enhanced program management.Deploy with Loader V4
Redeploy Existing Program
Deploy with Buffer
Partial Upload
Upload specific byte ranges:Retract Program
Reverse deployment:Close Entirely
Close and retrieve funds:Transfer Authority
Transfer program authority:Finalize Program
Make program immutable:Finalize with Next Version
Link to next version:Deployment Options
Custom Fee Payer
Skip Fee Check
Max Sign Attempts
Set maximum signing retries:Use RPC Instead of TPU
Compute Unit Price
Set priority fees:Skip Feature Verification
Migration
Migrate to Loader V4
Migrate upgradeable program:Best Practices
Development Workflow
- Test on Devnet: Always test on devnet first
- Use Buffers: For large programs, use buffer accounts
- Verify Builds: Ensure reproducible builds
- Authority Management: Use separate upgrade authority
- Backup Keys: Securely store all authority keypairs
Security
- Separate Authorities: Don’t use wallet keypair as upgrade authority
- Multi-sig: Consider multi-signature upgrade authority
- Audit Code: Audit before deploying to mainnet
- Test Upgrades: Test upgrade process on devnet
- Final Carefully: Only finalize after thorough testing
Cost Optimization
- Right-size Programs: Don’t over-allocate with
--max-len - Reuse Buffers: Close buffers after use
- Batch Deployments: Deploy multiple programs in sequence
- Monitor Rent: Check account rent exemption
Troubleshooting
Deployment Failed
Program Too Large
Authority Errors
Next Steps
Wallet Management
Manage keypairs and wallets
Cluster Queries
Query cluster information