Node Setup
This section covers the detailed process for setting up the nodes in your private blockchain network, including system requirements, installation of Go, and the step-by-step guide for configuring and running both the Boot Node and Sub-Node(s). It also includes instructions for setting up the genesis file and automating the node startup scripts.
System Requirements
Before starting the node setup, ensure that your machines meet the following system requirements:
Operating System: Linux (Ubuntu 18.04 or higher is recommended)
CPU: Minimum 2 cores (4 cores or more recommended for production environments)
Memory: 8GB RAM (16GB or more for higher performance)
Disk Space: 100GB (SSD preferred)
Network: Reliable internet connection (static IP recommended for Boot Node)
Software:
Go (latest stable version)
Git
Build essentials (gcc, make, etc.)
Go Version and Installation
The blockchain runs on a Go-Quorum fork, so you need to install a specific version of Go to build and run the nodes. Hereβs how to install Go:
Download the Required Version:
For this setup, we recommend using Go version
1.21.13
or the latest stable version. You can download it using the following command:
Install Go:
Extract the Go archive and install it:
Set Up Go Environment:
Add Go binaries to your system's
PATH
by adding the following lines to your~/.profile
:Reload your profile to apply the changes:
Verify Go Installation:
To verify that Go is installed correctly, run:
You should see the installed version of Go (
go version go1.21.13 linux/amd64
).
Step-by-Step Guide to Fork and Run Nodes
1. Clone the Go-Quorum Fork
Once Go is installed, you can clone the repository for your customized Go-Quorum fork:
2. Build the Blockchain Nodes
Navigate to the root directory of the cloned repository and build the project using Go:
3. Configure the Genesis File
The
genesis.json
file defines the initial state of the blockchain. It specifies the chain ID, difficulty level, gas limits, pre-allocated accounts, and consensus settings. Below is a samplegenesis.json
file for your private blockchain:Save the
genesis.json
file in the main directory.
Boot Node Configuration
The Boot Node is responsible for handling node discovery and coordination among other nodes.
1. Initialize the Boot Node:
After setting up the genesis file, initialize the boot node with the following command:
2. Create the Static-Nodes File:
You need to create a
static-nodes.json
file to link the Boot Node and Sub-Node(s). This file should be placed inside thenode1
directory and contain the enode address of the Boot Node, formatted as follows:
3. Create the Boot Node Start Script:
Create a shell script (
startBootNode.sh
) with the following content to start the Boot Node:
4. Run the Boot Node:
Make the script executable and run it to start the Boot Node:
5. Verify the Boot Node:
To check if the boot node is running, you can list the IPC file:
Attach to the Geth console and check the node info:
Sub-Node Configuration
Sub-nodes are validator nodes that join the Raft consensus and participate in transaction validation and block creation.
1. Initialize the Sub-Node:
Repeat the node initialization steps for the sub-node:
2. Create the Sub-Node Start Script:
Create a script (
startSubNode.sh
) to start the sub-node, which includes the boot nodeβs enode address:
3. Run the Sub-Node:
Make the script executable and run it to start the Sub-Node:
4. Add the Sub-Node to the Raft Cluster:
Attach to the Boot Node console and add the Sub-Node to the Raft cluster:
With the nodes configured and scripts automated, the blockchain network is now ready to process transactions and participate in the Raft consensus. The next section will focus on interacting with the blockchain using APIs, RPC, and WebSocket.
Last updated