Skip to main content
The leo deploy command deploys Leo programs and their dependencies to the Aleo network, making them publicly available for execution.

Syntax

Options

Network Options

string
required
Network type: mainnet, testnet, or canary.
string
required
Network endpoint URL:
  • Mainnet: https://api.explorer.provable.com/v1
  • Testnet: https://api.explorer.provable.com/v1
  • Devnet: http://localhost:3030
string
required
Private key to sign deployment transactions.
Never deploy to mainnet with test private keys. Secure your private keys.
boolean
default:false
Whether the network is a devnet.
string
Custom consensus heights (comma-separated) for custom devnets.

Fee Options

string
Priority fees in microcredits for each deployment, delimited by |.Example: 1000|2000|default
string
Records to pay fees privately, delimited by |. Use default for public fees.

Transaction Actions

boolean
default:false
Broadcast deployment transactions to the network.
boolean
default:false
Print deployment transactions as JSON to stdout.
string
Save deployment transactions to the specified directory.

Deployment Options

string[]
Skip deployment of programs containing these substrings (comma-separated).Example: --skip test,old
boolean
default:false
Use placeholder certificate and verifying keys during deployment.
Only use for testing. Deployments with placeholder certificates are not secure.

Additional Options

boolean
default:false
Skip confirmation prompts.
number
Consensus version to use (1-13). Auto-detected if not provided.
number
default:8
Seconds to wait for block confirmation.
number
default:12
Number of blocks to check for transaction confirmation.

Build Options

boolean
default:true
Don’t use the dependency cache. Always enabled for deploy.
boolean
default:false
Use network versions of dependencies.

Examples

Deploy to Testnet

Output:

Deploy with Priority Fee

Priority fees help ensure faster deployment by incentivizing validators.

Deploy and Save Transactions

Saves deployment transactions to:

Deploy and Print

Prints deployment transactions as JSON without broadcasting.

Deploy Specific Program

Skips my_lib.aleo and deploys only hello_world.aleo.

Deploy to Devnet

Deploy Without Confirmation

Use --yes with caution. It skips all confirmation prompts including fee confirmations.

Deployment Flow

  1. Build Phase:
    • Compiles program and dependencies with --no-cache
    • Generates bytecode and certificates
  2. Plan Generation:
    • Determines deployment order (dependencies first)
    • Checks which programs already exist on network
    • Calculates deployment costs
  3. Cost Estimation:
    • Storage cost (proportional to program size)
    • Finalize cost (computational cost)
    • Priority fee (optional)
  4. User Confirmation:
    • Displays deployment plan
    • Shows total estimated cost
    • Prompts for confirmation (unless --yes)
  5. Deployment Execution:
    • For each program in order:
      • Generates deployment transaction
      • Authorizes fee (public or private)
      • Broadcasts transaction (if --broadcast)
      • Waits for confirmation
  6. Verification:
    • Confirms program exists on network
    • Verifies program matches local bytecode

Deployment Order

Programs are deployed in dependency order:
Example:
Deployment order: my_libhelperapp

Cost Calculation

Deployment costs consist of:

Storage Cost

Based on program size:

Finalize Cost

Based on deployment complexity:

Priority Fee

Optional user-specified fee:

Total Cost

Costs are displayed in microcredits (μcredits). 1 credit = 1,000,000 microcredits.

Deployment Status

For each program, Leo checks network status:

Not on Network

Program will be deployed.

Already Deployed (Matching)

Deployment skipped.

Already Deployed (Different)

Deployment will fail. Update your program version or use a different name.

Transaction Format

Deployment transactions are saved as JSON:

Program Editions

Each deployment has an edition number:
  • Edition 0: Initial deployment
  • Edition 1+: Updates (if supported by network)
Most networks do not support program updates. Deploy with caution.

Verifying Keys and Certificates

Deployments include:

Verifying Keys

Cryptographic keys to verify program execution proofs.

Certificate

Proof that verifying keys were generated correctly.
Use --skip-deploy-certificate only for testing. Placeholder certificates are not secure.

Deployment Strategies

Development

Staging

Production

Monitoring Deployments

Leo monitors deployment confirmation:
If deployment fails to confirm:

Troubleshooting

Program Already Exists

Options:
  1. Use a different program name
  2. Deploy to a different network
  3. Wait for program update support (if applicable)

Insufficient Balance

Ensure your account has enough credits:

Dependency Not Deployed

Deploy dependencies first or include them in the deployment.

Network Unreachable

Check:
  1. Endpoint URL is correct
  2. Network is running
  3. Firewall allows connections

Best Practices

  1. Test Locally: Deploy to devnet before testnet/mainnet
  2. Verify Dependencies: Ensure all dependencies are deployed
  3. Review Costs: Check estimated costs before confirming
  4. Save Transactions: Use --save for record-keeping
  5. Monitor Confirmation: Wait for confirmation before assuming success
  6. Use Priority Fees: For time-sensitive deployments
  7. Backup Keys: Secure your private keys
  8. Version Control: Tag deployments in version control

Next Steps