# Networks

Typically, we speak of `mainnet` and `testnet` as the networks of Stacks. Most wallets are configured to `mainnet` by default—this is the production environment, the actual network that holds real STX tokens.

As the name suggests, `testnet` is a public network for testing. It's a separate network state that holds test tokens, which have no value.

For completeness we also mention `devnet`. This isn't "one" network, but how developers refer to ephemeral local networks used for testing via Clarinet. It is the same as `testnet`, but for local development.

## Setting the network

Most Stacks.js functions accept a `network` parameter as a `string` or an optional last argument.

The `network` type is a string, and can be one of:

* `'mainnet'` (default)
* `'testnet'`
* `'devnet'`
* `'mocknet'` (alias of `devnet`)

### Examples

Network in transaction signing:

{% code title="transaction.ts" %}

```ts
const tx = makeSTXTokenTransfer({
  // ...
  network: 'testnet',
});
```

{% endcode %}

Network in address derivation:

{% code title="address.ts" %}

```ts
const address = privateKeyToAddress(privateKey, 'devnet');
// ST3NBRSFKX28FQ2ZJ1MAKX58HKHSDGNV5N7R21XCP
```

{% endcode %}

{% hint style="info" %}
For more advanced workflows, pass a custom network configuration object. See the `@stacks/network` package for details.
{% endhint %}


---

# 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.stacks.co/stacks.js/networks.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.
