Skip to main content
This command is deprecated since version 0.32.0. Use anchor program upgrade instead for more control and features.

Overview

The anchor upgrade command upgrades a single program on the Solana cluster. The configured wallet must be the upgrade authority.

Command Syntax

Migration

Instead of:
Use:
See the Program Commands documentation for the full feature set.

Arguments

pubkey
required
The program ID to upgrade
string
required
Filepath to the new program binary (e.g., target/deploy/my_program.so)

Options

number
default:"0"
Maximum number of times to retry on failure
string
Arguments to pass to the underlying solana program deploy command

Examples

Basic Upgrade

Output:

Upgrade with Retries

Upgrade Verifiable Build

Pass Solana CLI Arguments

Upgrade Process

  1. Validates the upgrade authority has permission
  2. Uploads the new program binary to a buffer account
  3. Calls the upgrade instruction on the BPF Upgradeable Loader
  4. Replaces the existing program with the new binary
  5. Closes the buffer account and reclaims rent

Authority Requirements

The wallet specified in Anchor.toml or via the Solana CLI config must be the upgrade authority for the program. You can verify this with:
Output will show:

Cluster Configuration

The upgrade cluster is determined by:
Override with:

Failure Handling

If the upgrade fails:
  1. Check your upgrade authority is correct
  2. Ensure you have enough SOL for rent and fees
  3. Verify the program binary is valid
  4. Use --max-retries for network issues

Comparison with New Command

Notes

Always test upgrades on devnet before upgrading on mainnet-beta. Program upgrades are immediate and irreversible.
The deprecation warning will be shown each time you run anchor upgrade. Migrate to anchor program upgrade for continued support.
The program’s data account is preserved during an upgrade, so program state is maintained.
Build with --verifiable before upgrading to allow others to verify your upgrade matches the on-chain bytecode.

See Also