leo deploy command deploys Leo programs and their dependencies to the Aleo network, making them publicly available for execution.
Syntax
Options
Network Options
Network type:
mainnet, testnet, or canary.Network endpoint URL:
- Mainnet:
https://api.explorer.provable.com/v1 - Testnet:
https://api.explorer.provable.com/v1 - Devnet:
http://localhost:3030
Private key to sign deployment transactions.
Whether the network is a devnet.
Custom consensus heights (comma-separated) for custom devnets.
Fee Options
Priority fees in microcredits for each deployment, delimited by
|.Example: 1000|2000|defaultRecords to pay fees privately, delimited by
|. Use default for public fees.Transaction Actions
Broadcast deployment transactions to the network.
Print deployment transactions as JSON to stdout.
Save deployment transactions to the specified directory.
Deployment Options
Skip deployment of programs containing these substrings (comma-separated).Example:
--skip test,oldUse placeholder certificate and verifying keys during deployment.
Additional Options
Skip confirmation prompts.
Consensus version to use (1-13). Auto-detected if not provided.
Seconds to wait for block confirmation.
Number of blocks to check for transaction confirmation.
Build Options
Don’t use the dependency cache. Always enabled for deploy.
Use network versions of dependencies.
Examples
Deploy to Testnet
Deploy with Priority Fee
Priority fees help ensure faster deployment by incentivizing validators.
Deploy and Save Transactions
Deploy and Print
Deploy Specific Program
my_lib.aleo and deploys only hello_world.aleo.
Deploy to Devnet
Deploy Without Confirmation
Deployment Flow
-
Build Phase:
- Compiles program and dependencies with
--no-cache - Generates bytecode and certificates
- Compiles program and dependencies with
-
Plan Generation:
- Determines deployment order (dependencies first)
- Checks which programs already exist on network
- Calculates deployment costs
-
Cost Estimation:
- Storage cost (proportional to program size)
- Finalize cost (computational cost)
- Priority fee (optional)
-
User Confirmation:
- Displays deployment plan
- Shows total estimated cost
- Prompts for confirmation (unless
--yes)
-
Deployment Execution:
- For each program in order:
- Generates deployment transaction
- Authorizes fee (public or private)
- Broadcasts transaction (if
--broadcast) - Waits for confirmation
- For each program in order:
-
Verification:
- Confirms program exists on network
- Verifies program matches local bytecode
Deployment Order
Programs are deployed in dependency order:my_lib → helper → app
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
Already Deployed (Matching)
Already Deployed (Different)
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)
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:Troubleshooting
Program Already Exists
- Use a different program name
- Deploy to a different network
- Wait for program update support (if applicable)
Insufficient Balance
Dependency Not Deployed
Network Unreachable
- Endpoint URL is correct
- Network is running
- Firewall allows connections
Best Practices
- Test Locally: Deploy to devnet before testnet/mainnet
- Verify Dependencies: Ensure all dependencies are deployed
- Review Costs: Check estimated costs before confirming
- Save Transactions: Use
--savefor record-keeping - Monitor Confirmation: Wait for confirmation before assuming success
- Use Priority Fees: For time-sensitive deployments
- Backup Keys: Secure your private keys
- Version Control: Tag deployments in version control