# 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.

{% hint style="info" %}
You can only get access to the configurations when the RPCHub is running.
{% endhint %}

Before proceeding, we suggest that you check the reference to better understand the parameter settings of RPChub,

[reference](https://docs.rpchub.io/user-guide/reference "mention")

## Configure With Web Explorer

We provide a user-friendly interface with web explorer.

Go to <https://ag-cfg.rpchub.io/>

Fill with the aggregator management endpoint <mark style="color:blue;"><http://localhost:8012></mark> and password <mark style="color:blue;">123456</mark>

<figure><img src="https://4247336168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvYNvjpaqhMdZxXFmaiXv%2Fuploads%2F2fdlFjCllQC6OSlTAtoF%2Fimage.png?alt=media&#x26;token=b8a7d9ef-5a81-4bfc-a4c0-151b38ca7d48" alt=""><figcaption></figcaption></figure>

After login, there is the configuration console. On this page, you can perform the following settings.

<figure><img src="https://4247336168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvYNvjpaqhMdZxXFmaiXv%2Fuploads%2FNMlE9me0aK4d2PT5Ypqi%2F1678334217851.png?alt=media&#x26;token=88e71e1d-e562-4524-8351-a85fc51ebf4d" alt=""><figcaption></figcaption></figure>

#### 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](https://docs.rpchub.io/user-guide/installation-and-run "mention") and configure from default.

#### Add or edit RPC&#x20;

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.&#x20;

On each RPC card, you can delete the RPC, or switch the "Read Only" and "Disable"

<figure><img src="https://4247336168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvYNvjpaqhMdZxXFmaiXv%2Fuploads%2FsJFe2f88kQTqHN1WT3OZ%2F1678334377500.png?alt=media&#x26;token=fe6ce2e1-9af7-483a-bede-5f58a20e162b" alt=""><figcaption></figcaption></figure>

#### 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.

<figure><img src="https://4247336168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvYNvjpaqhMdZxXFmaiXv%2Fuploads%2F4DMjfioSC8iRS9m8dyUf%2F1678427756069.png?alt=media&#x26;token=ec87937e-dcac-4e58-a469-44d608138809" alt=""><figcaption></figcaption></figure>

## 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&#x20;

Parameters are explained in the "Configure With Web Explorer" part. Edit them as your wish.&#x20;

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.&#x20;

Configurations will be reset including the password.
