> For the complete documentation index, see [llms.txt](https://archive-vn.docs.klaytn.foundation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://archive-vn.docs.klaytn.foundation/content/dapp/json-rpc/api-references/network.md).

# net

Không gian tên `net` cung cấp các hàm liên quan đến mạng lưới Klaytn.

## net\_networkID <a href="#net_networkid" id="net_networkid"></a>

Trả về mã định danh mạng (ID mạng).

**Tham số**

Không có

**Giá trị trả về**

| Loại    | Mô tả                                                                                                                                                 |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| SỐ LƯỢNG | <p>Số nguyên của số định danh mạng.<br>- <code>"1001"</code>: Mạng thử nghiệm Klaytn Baobab.<br>- <code>"8217"</code>: Mạng chính Klaytn Cypress.</p> |

**Ví dụ**

```shell
// Request
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_networkID","params":[],"id":67}' https://public-en-baobab.klaytn.net

// Result
{
    "jsonrpc":"2.0",
    "id":67,
    "result":"1001"
}
```

## net\_listening <a href="#net_listening" id="net_listening"></a>

Trả về `true` nếu máy khách đang chủ động lắng nghe các kết nối mạng.

**Tham số**

Không có

**Giá trị trả về**

| type    | Mô tả                                                    |
| ------- | -------------------------------------------------------- |
| Boolean | `true` khi máy khách đang nghe, ngược lại sẽ là `false`. |

**Ví dụ**

```shell
// Request
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}' https://public-en-baobab.klaytn.net

// Result
{
    "id":67,
    "jsonrpc":"2.0",
    "result":true
}
```

## net\_peerCount <a href="#net_peercount" id="net_peercount"></a>

Trả về số lượng máy ngang hàng hiện đang kết nối với máy khách.

**Tham số**

Không có

**Giá trị trả về**

| Loại    | Mô tả                                               |
| -------- | --------------------------------------------------- |
| SỐ LƯỢNG | Số nguyên của số lượng máy ngang hàng được kết nối. |

**Ví dụ**

```shell
// Request
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}' https://public-en-baobab.klaytn.net

// Result
{
    "id":74,
    "jsonrpc": "2.0",
    "result": "0x3" // 2
}
```

## net\_peerCountByType <a href="#net_peercountbytype" id="net_peercountbytype"></a>

Trả về số nút được kết nối theo loại và tổng số nút được kết nối với các cặp khóa/giá trị.

**Tham số**

Không có

**Giá trị trả về**

| Loại      | Mô tả                                                                                        |
| ---------- | -------------------------------------------------------------------------------------------- |
| Chuỗi JSON | Số lượng máy ngang hàng được kết nối theo loại cũng như tổng số máy ngang hàng được kết nối. |

**Ví dụ**

```shell
// Request
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_peerCountByType","params":[],"id":74}' https://public-en-baobab.klaytn.net

// Result
{
    "id":74,
    "jsonrpc": "2.0",
    "result": {"en":3,"pn":2,"total":5}
}
```

## net\_version <a href="#net_version" id="net_version"></a>

Trả về phiên bản giao thức klaytn hiện tại.

**Tham số**

Không có

**Giá trị trả về**

| Loại    | Mô tả                                                                                                                                                          |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SỐ LƯỢNG | <p>Số nguyên của phiên bản giao thức klaytn.<br>- <code>"1001"</code>: Mạng thử nghiệm Klaytn Baobab.<br>- <code>"8217"</code>: Mạng chính Klaytn Cypress.</p> |

**Ví dụ**

```shell
// Request
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}' https://public-en-baobab.klaytn.net
// Result
{
    "jsonrpc":"2.0",
    "id":67,
    "result":"1001"
}
```


---

# 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 dynamically by asking a question.

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

```
GET https://archive-vn.docs.klaytn.foundation/content/dapp/json-rpc/api-references/network.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
