# Initialize the Contract

{% hint style="danger" %}
We don't specify it here, but in almost all cases you should provide an `--admin` address when instantiating a contract. If you do not, you will not be able to migrate the contract later.
{% endhint %}

CosmWasm Smart Contracts take their arguments as serialized JSON. This can be created a number of ways, but as we showed in the previous examples, it may well be easiest to use the `node` command line, if that is available to you.

{% hint style="info" %}
There is a Typescript helpers file for most contracts, and extensions for CosmJS, but at the time of writing, they are broken. This will no doubt be fixed soon, providing an alternative way of interacting with contracts other than the CLI.
{% endhint %}

To use the node REPL, type `node` in the terminal.

```javascript
const initobj = {
  admins: ["<your-validator-self-delegate-key>"],
  mutable: false
};

< undefined

JSON.stringify(initobj);

< '{"admins":["<your-validator-self-delegate-key>"],"mutable":false}'
```

With these encoded arguments, you can now instantiate the contract, using the `code_id` from the previous step.

```bash
sourced tx wasm instantiate <code-id> '{"admins":["<your-validator-self-delegate-key>"],"mutable":false}' --amount 50000usource --label "CW1 example contract" --from <your-key> --chain-id <chain-id> \
  --gas-prices 0.1usource --gas auto --gas-adjustment 1.3 -b block -y
```

Once the contract is instantiated, you can find out its contract address:

```bash
sourced query wasm list-contract-by-code <code-id>
```

You will need this to interact with the contract.


---

# 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/initialize-the-contract.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.
