# 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":{}}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.axiomeinfo.org/developer-documentation/deploy-a-smart-contract-on-devnet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
