Heco archive node for public use
Last updated
Last updated
With the official support of heco, HyperGraph has set up two public archive nodes for public use. These node supports RPC and WS mode, but since they are public and free resources, please do not overuse them or use them for long-term and large-scale data services.
The specific configuration and test methods are as follows:
Node 1:
http Mode:
URL:
WS Mode:
URL:
wss://pub001.hg.network/ws
The connection configuration in metamask is shown in the figure below:
RPC can be used to test node No.1 to obtain the chain ID and the latest block number respectively. Examples and results are as follows:
# 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"}
You can also write the following code to test the connectivity of websocket protocol::
var Web3 = require('web3');
var web3 = new Web3('wss://pub001.hg.network/ws');
subscription = web3.eth.subscribe('pendingTransactions', function (error, result) {})
.on("data", function (transactionHash) {
web3.eth.getTransaction(transactionHash)
.then(function (transaction) {
console.log(transaction)
});
})
Output:
Node 2:
http Mode:
URL:
https://pub002.hg.network/rpc
WS Mode:
URL:
wss://pub002.hg.network/ws
The connection configuration in metamask is shown in the figure below:
RPC can be used to test node No.2 to obtain the chain ID and the latest block number respectively. Examples and results are as follows:
# 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"}
You can also write the following code to test the connectivity of websocket protocol:
var Web3 = require('web3');
var web3 = new Web3('wss://pub002.hg.network/ws');
subscription = web3.eth.subscribe('pendingTransactions', function (error, result) {})
.on("data", function (transactionHash) {
web3.eth.getTransaction(transactionHash)
.then(function (transaction) {
console.log(transaction)
});
})
Output: