# Download, Compile, Store

First, we need to download the code from [cosmwasm-plus](https://github.com/CosmWasm/cosmwasm-plus).

### Download

Run the following to download the correct tag and extract it. `ls` should show you the folder is present once it's unpacked. You can also use `git` instead of `wget` if you prefer.

```bash
git clone https://github.com/CosmWasm/cw-plus.git

git fetch --tags

git checkout v0.13.4

cd contracts/cw1-subkeys
```

### Compile

Unlike before, where we compiled just the one contract, we'll compile all of them, since we may want to experiment with others. Run this at the root of the `cosmwasm-plus` folder:

```bash
sudo docker run --rm -v "$(pwd)":/code \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  cosmwasm/workspace-optimizer:0.12.6
```

### Store

When compiling is complete (it will take a while) `cd` into the `artifacts` directory. `ls` should show you binaries for each of the contracts have been created. The one we care about is `cw1_subkeys.wasm`.

To store this on-chain, we use a similar command to last time:

```bash
sourced tx wasm store cw1_subkeys.wasm  --from <your-key> --chain-id <chain-id> \
  --gas-prices 0.1usource --gas auto --gas-adjustment 1.3 -b block -y
```

Also like last time, look in the JSON output for the `code_id` value. If you would prefer to capture this as a shell variable, for the previous step you can instead do:

```bash
cd artifacts
TX=$(sourced tx wasm store cw1_subkeys.wasm  --from <your-key> --chain-id=<chain-id> --gas auto --output json -y | jq -r '.txhash')
CODE_ID=$(sourced query tx $TX --output json | jq -r '.logs[0].events[-1].attributes[0].value')
```


---

# 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.sourceprotocol.io/smart-contracts-and-sourced-development/cw1-tutorial/download-compile-store.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.
