> For the complete documentation index, see [llms.txt](https://docs.stacks.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stacks.co/reference/stacks.js/stacks-network/constants/peernetworkid.md).

# PeerNetworkId

Enum representing the peer network ID. Used for broadcasting to the P2P network and can be used to determine the parent of a subnet.

***

### Usage

```ts
import { PeerNetworkId } from '@stacks/network';

if (network.peerNetworkId === PeerNetworkId.Mainnet) {
  console.log('Connected to mainnet peer network');
}
```

#### Notes

* For mainnet/testnet, the `v2/info` response `.network_id` refers to the chain ID, not the peer network ID.
* For subnets, `.network_id` refers to the peer network ID.
* The `.parent_network_id` refers to the actual peer network ID of the parent in both cases.

[**Reference Link**](https://github.com/stx-labs/stacks.js/tree/main/packages/network/src/constants.ts#L15)

***

### Definition

```ts
enum PeerNetworkId {
  Mainnet = 0x17000000,
  Testnet = 0xff000000,
}
```

***

### Values

| Value     | Number       | Description             |
| --------- | ------------ | ----------------------- |
| `Mainnet` | `0x17000000` | Mainnet peer network ID |
| `Testnet` | `0xff000000` | Testnet peer network ID |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stacks.co/reference/stacks.js/stacks-network/constants/peernetworkid.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
