Review of Ethereum Networking Options

Note

If you are new to the blockchain technology, taking our Introduction to Blockchain Technology self-paced course is highly recommended. Also, for a comprehensive coverage of blockchain development in Ethereum or mastering Solidity programming, taking our below self paced courses is highly recommended:

 

Recap

In our previous article (Review of Ethereum API and Console Options), we discussed Ethereum API and its console options.

In this article, we learn about Ethereum Networking Options.

 

Networking options

Networking options provide us with the flexibility to define the network’s details, such as the listening port, the maximum number of peers, the maximum number of attempts for pending a connection, the discovery mechanism in the network, and so on. The following list specifies the various options that are available:

 

One-to-One Live Blockchain Classes

Coding Bootcamps school offers One-to-One Live Blockchain Classes for Beginners.

 

  • –bootnodes, –port, –nodekey, and –nodekeyhex are the networking option flags we have come across. Generally, –bootnodesv4 is set for light server and full nodes. –bootnodesv5 is set for light servers and light nodes.
  • If you have already connected a few nodes, for example, with 2 nodes, and you don’t want any other nodes to be added to the local private network accidentally, set –maxpeers to 2. The default value for maxpeers is 25.
  • –nodiscover is used for adding peers manually without the discovery protocol. This flag is used for testing a single node or network with a limited number of nodes.
  • Other members of the networking options family are –maxpendpeers, –nat, –

-v5disc, and –netrestrict. In a local private blockchain, –maxpeers and –
-nodiscover are frequently used.

  • Starting from geth v1.5.4, –netrestrict is added to the toolbox. The flag takes an IP address, and geth will only communicate with the peers from this address.

In the following command, we specify maxpeers to be 2, disabling the peering discovery mechanism and restricting the network communication to 127.0.0.1:
$ geth –datadir < local data dir> –networkid <network id> –maxpeers 2 — nodiscover –netrestrict 127.0.0.1

We have introduced every member of the networking options family. Feel free to use them and get familiar with them.

 

Next Article

In our next article (Review of Ethereum Transaction Pool Options), we discuss what Ethereum Transaction Pool Options are and how they work.

This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.

 

Resources

coming soon