# Heco 网络公开归档节点

&#x20;        在Heco 官方的大力支持之下，HyperGraph 架设了两个公开使用的归档节点，以供大家使用。此节点支持 RPC 与 WS 方式使用，但是鉴于是公共免费资源，请不要过度使用，或者用于长期和大规模的数据服务。

具体配置与测试方式如下：

节点1：

http 方式：

URL：

[`https://pub001.hg.network/rpc`](https://pub001.hg.network/rpc)

WS 方式:

URL:&#x20;

`wss://pub001.hg.network/ws`

在MetaMask 中连接配置如下图：

![](/files/-Mevr4Nu2lu9fJiKZpMT)

可以使用 RPC 方式对1号节点进行测试，分别获取chain ID 和最新区块号，结果如下：

`# curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' -H "Content-Type: application/json" https://pub001.hg.network/rpc`

`{"jsonrpc":"2.0","id":1,"result":"0x80"}`

`# curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' -H "Content-Type: application/json" https://pub001.hg.network/rpc`

`{"jsonrpc":"2.0","id":1,"result":"0x6479e9"}`

你可以编写如下代码，测试Websocket 协议的连通情况：

`var Web3 = require('web3');`

`var web3 = new Web3('wss://pub001.hg.network/ws');`

`subscription = web3.eth.subscribe('pendingTransactions', function (error, result) {})`

&#x20;   `.on("data", function (transactionHash) {`

&#x20;       `web3.eth.getTransaction(transactionHash)`

&#x20;       `.then(function (transaction) {`

&#x20;         `console.log(transaction)`

&#x20;       `});`

`})`

如果正确，将输出如下图

![](/files/-Mevr4Nv4iJDGrOO17EI)

节点2：

http 方式：

URL：

`https://pub002.hg.network/rpc`

WS 方式:

URL:&#x20;

`wss://pub002.hg.network/ws`

在MetaMask 中连接配置如下图：

![](/files/-Mevr4NwPQ60leRtqd0H)

可以使用 RPC 方式对2号节点进行测试，分别获取chain ID 和最新区块号，结果如下：

`# curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' -H "Content-Type: application/json" https://pub002.hg.network/rpc`

`{"jsonrpc":"2.0","id":1,"result":"0x80"}`

`# curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' -H "Content-Type: application/json" https://pub002.hg.network/rpc`

`{"jsonrpc":"2.0","id":1,"result":"0x6479ea"}`

你可以编写如下代码，测试Websocket 协议的连通情况：

`var Web3 = require('web3');`

`var web3 = new Web3('wss://pub002.hg.network/ws');`

`subscription = web3.eth.subscribe('pendingTransactions', function (error, result) {})`

&#x20;   `.on("data", function (transactionHash) {`

&#x20;       `web3.eth.getTransaction(transactionHash)`

&#x20;       `.then(function (transaction) {`

&#x20;         `console.log(transaction)`

&#x20;       `});`

`})`

如果正确，将输出如下图

![](/files/-Mevr4Nxv7apm82HFVFh)


---

# 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.hg.network/network-jie-dian-wang-luo/heco-wang-luo-gong-kai-gui-dang-jie-dian.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.
