Start the Blockchain

Start a private blockchain network and interact with it.

Now that we have all the elements to set up a blockchain node and the genesis block of the network, let’s put things together and start our blockchain private network.

Node’s address

In Ethereum, a node in the network is univocally identified by its enodeAn enode is a way to identify an Ethereum node using a URL address format. address. It’s used to establish peer-to-peer connections between nodes and to share information about the state of the blockchain.

In Geth, an enode address is represented as a string of the form:

enode://<node ID>@<IP address>:<port>

The <node ID> is a 512 bit hash that uniquely identifies the node, and the <IP address> and <port> specify the network address where the node can be reached.

For example, an enode address for a Geth node running on a machine with the IP address 192.168.0.10 and listening on port 30303 might look like this:

enode://b93d06780c08e32499a6bb92e867e0643f3ef226f1ab7b1638c94b3d3cf84698db1b74e1b26c2d2e297dcf75e458059ca9b34c17e39d95e271ccfe2eecc4c4af@192.168.0.10:30303

Starting a bootnode

The first thing we need to do is to start a bootnode. We’re going to use the test bootnode that's available in the Geth developer tools. After creating the bootnode private key (as we did in the “Set Up The Nodes” lesson), the command to start a bootnode is:

bootnode -nodekey boot.key -addr 127.0.0.1:30305

The following parameters must be passed:

  • -nodekey: To pass the private key file path of the boot node.

  • -addr: To pass the external IP address and port that the bootnode will use for its communication with other nodes in the network.

Note: Running a bootnode with developer tools is primarily useful for testing and development purposes. In a production environment, you may want to use a more secure setup.

Exercise: Start a bootnode

The following playground allows you to interact with a terminal of a machine where the bootnode developer tool is installed. Try initializing and starting a test bootnode.

  • Create the bootnode private key with the command:

bootnode -genkey boot.key
  • Then, start the bootnode with the following parameters:

    • The previously generated private key file

    • The address 127.0.0.1

    • The port 30305 

Terminal 1
Terminal
Loading...
...