> For the complete documentation index, see [llms.txt](https://docs.axiomeinfo.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.axiomeinfo.org/developer-documentation/deploy-a-smart-contract-on-devnet.md).

# 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](https://cosmwasm.cosmos.network/).

## **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**

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

***

#### **Step 2: Request Test Tokens**

Find you address:

```sh
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**

```sh
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:

```sh
axmd query wasm list-code
```

***

#### **🏗️ Step 4: Instantiate the Contract**

```sh
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:

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

***

#### **⚙️ Step 5: Interact with the Contract**

Example execution:

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

Example query:

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