docs: add section about config file and network selection flags (#23146)

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Sina Mahmoodi 2021-07-02 10:14:45 +02:00 committed by GitHub
parent 81c328ed38
commit 7cc2a04447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,25 @@ title: Connecting To The Network
sort_key: B sort_key: B
--- ---
If you start geth without any flags, it will connect to the Ethereum mainnet. In addition to
the mainnet, geth recognizes a few testnets which you can connect to via the respective flags:
- `--ropsten`, Ropsten proof-of-work test network
- `--rinkeby`, Rinkeby proof-of-authority test network
- `--goerli`, Goerli proof-of-authority test network
**Note:** network selection is not persisted in the 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
# Generate desired config file. You must specify testnet here.
geth --goerli --syncmode "full" ... dumpconfig > goerli.toml
# Start geth with given config file. Here too the testnet must be specified.
geth --goerli --config goerli.toml
```
## How Peers Are Found ## How Peers Are Found
Geth continuously attempts to connect to other nodes on the network until it has peers. If Geth continuously attempts to connect to other nodes on the network until it has peers. If
@ -162,4 +181,4 @@ Nodes can be added using the `admin.addTrustedPeer()` RPC-call over the js conso
```js ```js
admin.addTrustedPeer("enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303") admin.addTrustedPeer("enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303")
``` ```