RPCHub
Search
K

Configuration

Configurations are only stored locally. RPCHub will route your requests based on the configurations.
Users can setup the configurations by either web explorer or posting raw configurations in CLI.
You can only get access to the configurations when the RPCHub is running.
Before proceeding, we suggest that you check the reference to better understand the parameter settings of RPChub,
Reference

Configure With Web Explorer

We provide a user-friendly interface with web explorer.
Fill with the aggregator management endpoint http://localhost:8012 and password 123456
After login, there is the configuration console. On this page, you can perform the following settings.

Set your password

It is recommended to set the password as soon as possible. Please note that your password is stored in your local profile. If you forget your password, you won't be able to get access to the configurations. To configure, you have to start over from Installation and run and configure from default.

Add or edit RPC

You can either add a new RPC or edit an existing RPC. In the popup tab, chose the chain, input endpoint name, endpoint url and weight.
On each RPC card, you can delete the RPC, or switch the "Read Only" and "Disable"

Basic setup

Here you can set the proxy address, request timeout, request max retries.

Phishing DB

The phishing database is a feature to prevent users from interacting with suspicious addresses. A user can add any phishing DB url on his own behalf. RPCHub will stop the request if the payload contains any address in the added database.

Find the localhost endpoint

To find the localhost endpoint for a specific chain, simply click the chain name and the endpoint will appear below the chains list.

Configure With CLI

CLI provides more flexible configurations, including password reset and adding arbitry chains.

Default configuration

To set the configuration of the aggregator, you must know the format of the file first. To show the current configurations after the first run,
curl -u rpchub:123456 'http://localhost:8012/config'
The response payload should be like,
{
"password": "123456",
"request_timeout": 30,
"max_retries": 3,
"nodes": {
"<chain1>": [
{
"name": "<name1>",
"endpoint": "<endpoint1>",
"weight": 100,
"read_only": false,
"disabled": false
},
{
"name": "<name2>",
"endpoint": "<endpoint2>",
"weight": 100,
"read_only": false,
"disabled": false
},
......
],
"<chain2>": [
......
],
......
},
"phishing_db": [
"https://cfg.rpchub.io/agg/scam-addresses.json"
],
"phishing_db_update_interval": 3600,
"mrt": 1
}

Set new configuration

Parameters are explained in the "Configure With Web Explorer" part. Edit them as your wish.
If you want to add or edit an RPC endpoint, just compose following this format,
{
"name":"<endpoint name>",
"endpoint":"<endpoint url>",
"weight":<number>,
"read_only":<true or false>,
"disabled":<true or false>
}
And insert into or replace one in the payload. Then use the following command to post the entire payload back to the configuration,
curl -u rpchub:<password> -X POST 'http://localhost:8012/config'
--header 'Content-Type: application/json'
--data-raw
'<payload>'
The new configurations should work after restart RPCHub.
Here is an example to set the configuration to use RPCHub for Arbitrum (2 endpoints) and BSC (1 endpoint),
curl -u rpchub:123456 -X POST 'http://localhost:8012/config' --header 'Content-Type: application/json' --data-raw
{
"password": "123456",
"request_timeout": 30,
"max_retries": 3,
"nodes": {
"arbitrum": [{
"name": "blockpi-public-arbitrum",
"endpoint": "https://arbitrum.blockpi.network/v1/rpc/public",
"weight": 90,
"read_only": false,
"disabled": false
}, {
"name": "arbitrum-official",
"endpoint": "https://arb1.arbitrum.io/rpc",
"weight": 10,
"read_only": false,
"disabled": false
}],
"bsc": [{
"name": "blockpi-official",
"endpoint": "https://bsc-dataseed.binance.org",
"weight": 100,
"read_only": false,
"disabled": false
}]
},
"phishing_db": ["https://cfg.rpchub.io/agg/scam-addresses.json"],
"phishing_db_update_interval": 3600
}

Reset configuration

Stop RPCHub.
Delete the configuration directory,
rm -rf $HOME/.rpchub/aggregator/
Start RPCHub again.
Configurations will be reset including the password.