> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parallaxprotocol.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting to peers

The default behaviour for the Parallax client is to connect to Parallax mainnet. However, the Parallax client can also connect to public testnets, [private networks](./private-networks) and [local testnets](../developers/dapp/developer-mode). For convenience, the the public testnet with long term support have their own command line flag. The Parallax client can connect to the testnet simply by passing:

* `--testnet`

**Note:** Network selection is not persisted from a config file. To connect to a pre-defined network you must always enable it explicitly, even when using the `--config` flag to load other configuration values. For example:

```sh theme={null}
# Generate desired config file. You must specify testnet here.
prlx --testnet --syncmode "full" ... dumpconfig > testnet.toml

# Start Parallax client with given config file. Here too the testnet must be specified.
prlx --testnet --config testnet.toml
```

## Finding peers

The Parallax client continuously attempts to connect to other nodes on the network until it has enough peers. If UPnP (Universal Plug and Play) is enabled at the router or Parallax is run on an Internet-facing server, it will also accept connections from other nodes. The Parallax client finds peers using the [discovery protocol](../../parallax-protocol/advanced/networking/overview). In the discovery protocol, nodes exchange connectivity details and then establish sessions ([RLPx](https://github.com/ethereum/devp2p/blob/master/rlpx.md)). If the nodes support compatible sub-protocols they can start exchanging Parallax data [on the wire](../../parallax-protocol/advanced/networking/overview).

A new node entering the network for the first time gets introduced to a set of peers by a bootstrap node ("bootnode") whose sole purpose is to connect new nodes to peers. The endpoints for these bootnodes are hardcoded into the Parallax client but they can also be specified by providing the `--bootnode` flag along with comma-separated bootnode addresses in the form of [enodes](../../parallax-protocol/advanced/networking/addresses) on startup. For example:

```sh theme={null}
prlx --bootnodes enode://pubkey1@ip1:port1,enode://pubkey2@ip2:port2,enode://pubkey3@ip3:port3
```

There are scenarios where disabling the discovery process is useful, for example for running a local test node or an experimental test network with known, fixed nodes. This can be achieved by passing the `--nodiscover` flag to the Parallax client at startup.

## Connectivity problems

There are occasions when the Parallax client simply fails to connect to peers. The common reasons for this are:

* Local time might be incorrect. An accurate clock is required to participate in the Parallax network. The local clock can be resynchronized using commands such as `sudo ntpdate -s time.nist.gov` (this will vary depending on operating system).
* Some firewall configurations can prohibit UDP traffic. The static nodes feature or `admin.addPeer()` on the console can be used to configure connections manually.
* Running the Parallax client in [light mode](./light-client) often leads to connectivity issues because there are few nodes running light servers. There is no easy fix for this except to switch the Parallax client out of light mode.
* The public test network the Parallax client is connecting to might be deprecated or have a low number of active nodes that are hard to find. In this case, the best action is to switch to an alternative test network.

## Checking Connectivity

The `net` module has two attributes that enable checking node connectivity from the [interactive Javascript console](../interacting-with-parallax/js-console). These are `net.listening` which reports whether the Parallax client node is listening for inbound requests, and `peerCount` which returns the number of active peers the node is connected to.

```javascript theme={null}
> net.listening
true

> net.peerCount
4
```

Functions in the `admin` module provide more information about the connected peers, including their IP address, port number, supported protocols etc. Calling `admin.peers` returns this information for all connected peers.

```javascript theme={null}
> admin.peers
[{
    caps: ["parallax/66", "snap/1"],
    enode: "enode://c8d58742fef51a70267a916949cefd0d7ba5bdb75393bbfcbcbc959b3eebf16353ac15d1f7493d749f7f452ff2bec894b8a8c469306e247d265f4f305c5740f7@69.62.94.166:32110",
    id: "2048d5ae22f7206bc8ad6476a2918bd7558776b0438e0cde4eb579d5d85d8886",
    name: "Prlx/v0.1.1-stable-78d2f22b/linux-amd64/go1.25.1",
    network: {
      inbound: false,
      localAddress: "192.168.3.2:37772",
      remoteAddress: "69.62.94.166:32110",
      static: false,
      trusted: false
    },
    protocols: {
      parallax: {
        difficulty: 286554849280,
        head: "0x39a519def2f7eb13b4bc6affa22d34acb6a70c4b52782b8173f9119d9a5e20a8",
        version: 66
      },
      snap: {
        version: 1
      }
    }
}, {
    caps: ["parallax/66", "snap/1"],
    enode: "enode://d3440cdb8f942e1f01dac2292b7a8f886831800e301c41cf943a4ba4c68e37513920cd94c421fa5e073ed7329d9c3194e3911c857b9ded1677a5234441d9950d@54.94.191.104:32110",
    id: "4dd1f03a46b51083b7fa10bda14a92ddd0c1e80ec1ef3320c229a098e5f81865",
    name: "Prlx/v0.1.1-stable-78d2f22b/linux-arm64/go1.25.1",
    network: {
      inbound: false,
      localAddress: "192.168.3.2:55992",
      remoteAddress: "54.94.191.104:32110",
      static: false,
      trusted: false
    },
    protocols: {
      parallax: {
        difficulty: 286554849280,
        head: "0x39a519def2f7eb13b4bc6affa22d34acb6a70c4b52782b8173f9119d9a5e20a8",
        version: 66
      },
      snap: {
        version: 1
      }
    }
}]
```

The `admin` module also includes functions for gathering information about the local node rather than its peers. For example, `admin.nodeInfo` returns the name and connectivity details for the local node.

```javascript theme={null}
> admin.nodeInfo
{
  enode: "enode://df18e0e4fea492eef74787a67368ada6200f6ed8ab01a9b105904fac442d720591aa9ab87d33c42ad1abcf24cc3eed373c3eb8dbc0df29b206615cc80a949c94@127.0.0.1:32110",
  enr: "enr:-KO4QL1FbkA2y9yCx_bXLIXApQKUgPLiCrhszQfXQH6IoCqaJYKHXCBJHm6A0G7NpvJF-MLyr1cS8imBYdgcEigzUm6GAZmWB3qcg2V0aMfGhN4LIImAgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQLfGODk_qSS7vdHh6ZzaK2mIA9u2KsBqbEFkE-sRC1yBYRzbmFwwIN0Y3CCfW6DdWRwgn1u",
  id: "6c0a4611b88067d29f43e764475ec3ce70de6139c7316b960deadd29203fa358",
  ip: "127.0.0.1",
  listenAddr: "[::]:32110",
  name: "Prlx/v0.1.1-stable-d9425677/linux-amd64/go1.25.1 X:nodwarf5",
  ports: {
    discovery: 32110,
    listener: 32110
  },
  protocols: {
    parallax: {
      config: {
        berlinBlock: 0,
        byzantiumBlock: 0,
        chainId: 2111,
        constantinopleBlock: 0,
        eip150Block: 0,
        eip150Hash: "0x0000000000000000000000000000000000000000000000000000000000000000",
        eip155Block: 0,
        eip158Block: 0,
        xhash: {...},
        homesteadBlock: 0,
        istanbulBlock: 0,
        minDifficulty: 33554432,
        petersburgBlock: 0
      },
      difficulty: 286554849280,
      genesis: "0x2b0467e57fabfc5d8082765e7bbc1f6aad8f13ddd937142f51c85e3f7051be5f",
      head: "0x39a519def2f7eb13b4bc6affa22d34acb6a70c4b52782b8173f9119d9a5e20a8",
      network: 2111
    },
    snap: {}
  }
}
```

## Custom Networks

It is often useful for developers to connect to private test networks rather than public testnets or Parallax mainnet. These sandbox environments allow block creation without competing against other miners, easy minting of test ether and give freedom to break things without real-world consequences. A private network is started by providing a value to `--networkid` that is not used by any other existing public network ([Chainlist](https://chainlist.org/)) and creating a custom `genesis.json` file. Detailed instructions for this are available on the [Private Networks page](./private-networks).

## Static nodes

The Parallax client also supports static nodes. Static nodes are specific peers that are always connected to. The Parallax client reconnects to these peers automatically when it is restarted. Specific nodes are defined to be static nodes by adding their enode addresses to a config file. The easiest way to create this config file is to run:

```sh theme={null}
prlx --datadir <datadir> dumpconfig > config.toml
```

This will create `config.toml` in the current directory. The enode addresses for static nodes can then be added as a list to the `StaticNodes` field of the `Node.P2P` section in `config.toml`. When the Parallax client is started, pass `--config config.toml`. The relevant line in `config.toml` looks as follows:

```toml theme={null}
StaticNodes = ["enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:32110"]
```

Ensure the other lines in `config.toml` are also set correctly before starting the Parallax client, as passing `--config` instructs the client to get its configuration values from this file. An example of a complete `config.toml` file can be found [here](https://gist.github.com/jmcook1186/16db2f0feddb4bd0581ebb9ba867a47a).

Static nodes can also be added at runtime in the Javascript console by passing an enode address to `admin.addPeer()`:

```javascript theme={null}
admin.addPeer(
  'enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:32110'
);
```

## Peer limit

It is sometimes desirable to cap the number of peers the Parallax client will connect to in order to limit on the computational and bandwidth cost associated with running a node. By default, the limit is 50 peers, however, this can be updated by passing a value to `--maxpeers`:

```sh theme={null}
prlx <otherflags> --maxpeers 15
```

## Trusted nodes

Trusted nodes can be added to `config.toml` in the same way as for static nodes. Add the trusted node's enode address to the `TrustedNodes` field in `config.toml` before starting the Parallax client with `--config config.toml`.

Nodes can be added using the `admin.addTrustedPeer()` call in the Javascript console and removed using `admin.removeTrustedPeer()` call.

```javascript theme={null}
admin.addTrustedPeer(
  'enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:32110'
);
```

## Summary

The Parallax client connects to Parallax mainnet by default. However, this behaviour can be changed using combinations of command line flags and files. This page has described the various options available for connecting a Parallax node to the Parallax blockchain, public testnet and private networks.
