Deploying Contracts
Thexyz program deploy command uploads your contract to the chain and creates an instance in a single step.
Usage
Basic Deployment
Output
Output
Options
Examples
With Instantiate Message
From Message File
With Initial Funds
Immutable Contract (No Admin)
Custom Admin
Dry Run
Simulate deployment without broadcasting:Deployment Flow
xyz program deploy combines two operations:
Step 1: Store Code
Uploads the Wasm bytecode to the chain:- Creates a unique Code ID
- Bytecode stored in chain state
- Same code can be instantiated multiple times
Step 2: Instantiate
Creates a contract instance:- New contract address generated
- Initial state set via
InstantiateMsg - Admin assigned (for migrations)
Separate Upload and Instantiate
For advanced use cases, separate the steps:Multiple Instances
Create multiple instances of the same code:Error Handling
Common errors and solutions:User-Friendly Errors
The CLI translates chain errors:Verify Deployment
After deployment:Troubleshooting
Contract validation failed
Contract validation failed
The Wasm file may be invalid:
Insufficient funds
Insufficient funds
Check balance:For localnet, use test accounts with pre-funded balances.
Invalid instantiate message
Invalid instantiate message
Check your JSON:Ensure it matches
InstantiateMsg in your contract.Transaction timeout
Transaction timeout
Node may be slow: