Prerequisites
Before deploying a program, ensure you:- Have a compiled program (see Creating Programs)
- Have sufficient credits for deployment fees
- Have access to unspent records or public balance
Basic Deployment
Deploy a program using the VM:Deployment with Private Fee
Use a credits record to pay the deployment fee:Deployment Cost Calculation
Calculate deployment costs before deploying:Deployment costs vary based on program complexity. Larger programs with more functions and verifying keys cost more to deploy.
Using the Ledger Helper
TheLedger provides a convenient method for creating deployments:
Deployment Verification
Verify the deployment before broadcasting:Program Ownership
Starting with consensus version V9, programs have owners:Program Ownership Rules
- Programs deployed after V9 activation have owners
- Only the owner can upgrade programs (future functionality)
- Owner is set to the deployment transaction signer
- Programs deployed before V9 have no owner
Program Editions
Deploy program updates using editions:Handling Deployment Failures
Advanced: Multi-Step Deployment
For more control, separate key generation from transaction creation:Deploying with Imports
Ensure imported programs are deployed first:Checking Deployment Status
Check if a program is already deployed:Deployment Best Practices
Test Locally First
Test your program thoroughly before deploying:Optimize Program Size
Minimize deployment costs by:- Removing unnecessary functions
- Simplifying complex logic
- Using efficient data structures
- Avoiding redundant computations
Version Control
Maintain program versions:Monitor Deployment Costs
Track costs over time:Error Recovery
Handle deployment transaction failures:Next Steps
- Learn about executing transactions with your deployed programs
- Explore creating programs to write more complex logic
- Understand managing records created by your programs