Deploy a Smart Contract on Devnet

This guide walks you through uploading, instantiating, and interacting with a CosmWasm smart contract on the Axiome Devnet. You can find the full CosmWasm documentation here

Requirements

Before you begin, make sure you have:

  • A running Devnet node (or access to one via RPC)

  • The CosmWasm contract compiled to .wasm (e.g., via cargo run-script optimize)

  • The CLI binary (axmd) installed

  • A key with testnet tokens (use a faucet if needed)


Step 1: Create or Recover a Wallet

axmd keys add mykey
# or recover
axmd keys add mykey --recover

Step 2: Request Test Tokens

Find you address:

axmd keys show mykey -a

And go to our faucet to get tesnet AXM tokens (only 5000 per day per address)


Step 3: Upload the Contract

axmd tx wasm store path/to/contract.wasm \
  --from mykey \
  --gas auto --gas-adjustment 1.3 \
  --fees 5000uaxm \
  -y

This transaction returns a code ID — you'll need it for the next step.

To check the list of uploaded contracts:

axmd query wasm list-code

🏗️ Step 4: Instantiate the Contract

axmd tx wasm instantiate <code_id> '{"field":"value"}' \
  --from mykey \
  --label "my contract" \
  --admin $(axmd keys show mykey -a) \
  --gas auto --gas-adjustment 1.3 \
  --fees 5000uaxm \
  -y

📌 Replace {"field":"value"} with your contract's init message.

To get the contract address:

axmd query wasm list-contract-by-code <code_id>

⚙️ Step 5: Interact with the Contract

Example execution:

axmd tx wasm execute <contract_address> '{"action":"value"}' \
  --from mykey \
  --gas auto --gas-adjustment 1.3 \
  --fees 5000uaxm \
  -y

Example query:

axmd query wasm contract-state smart <contract_address> '{"query":{}}'

Last updated