Upgrade an existing program that has already been deployed to the Aleo network. This command creates upgrade transactions for programs with constructors, allowing you to modify program logic while maintaining state.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/provablehq/leo/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Options
Fee Options
Priority fee in microcredits. Higher fees may result in faster confirmation.
Record to use for paying the priority fee
Transaction Actions
Broadcast the upgrade transaction to the network
Save the upgrade transaction to the specified directory
Print the upgrade transaction in JSON format
Environment Options
Network to deploy to (mainnet, testnet, canary)
Custom API endpoint URL
Private key for signing (can also use PRIVATE_KEY environment variable)
Build Options
Skip upgrade of programs containing these substrings
Skip deployment certificate generation (advanced usage)
Skip confirmation prompts
Examples
Basic upgrade
Upgrade with priority fee
Save upgrade transaction without broadcasting
Skip specific programs
Upgrade to mainnet
Upgrade Requirements
Valid Upgrade Rules
- Constructor Must Exist: New version must have a constructor
- Mappings Cannot Change: Mapping definitions must remain identical
- Records Can Be Added: New record types can be added
- Function Signatures: Can modify logic but some constraints apply
- Edition Increments: Edition number automatically increments
Example Valid Constructor
Upgrade Process
Validate upgrade compatibility
Checks that the upgrade follows all rules:
- Constructor requirements
- Mapping compatibility
- Naming structure
- Consensus version compatibility
Upgrade Validation
Before upgrading, the command validates:Program Existence
Upgrade Compatibility
Warnings
Edition System
Each upgrade increments the program’s edition number:- Key generation
- Transaction validation
- State migration
Cost Estimation
The command displays estimated costs before broadcasting:JSON Output
Enable--json-output for machine-readable results:
Consensus Versions
Different consensus versions have different upgrade rules:- V7+: Program naming structure validation
- V8+: One-time upgrades for programs without constructors
- V9+: Constructor required for all upgrades
Common Issues
Program not found on network
Invalid upgrade: mapping changed
Mapping definitions cannot be modified:Constructor missing
Add a constructor to your program:Related Commands
Best Practices
State preservation: Upgrades preserve all on-chain state including mapping values and program balance.