Deployment of A IBAX Network
In this section, we will show you how to deploy your own blockchain network.
An deployment example
A blockchain network will be deployed with the following three nodes as an example.
Three network nodes:
Node 1 is the first node in the blockchain network, which can generate new blocks and send transactions from clients connected to it;
Node 2 is another honor node, which can generate new blocks and send transactions from clients connected to it;
Node 3 is a guardian node, which cannot generate new blocks, but can send transactions from clients connected to it.
Configurations of the three nodes to be deployed:
Each node uses its own PostgreSQL database system instance;
Each node uses its own Centrifugo service instance;
The server side github-backend is deployed on the same host as other backend components.
The sample addresses and ports used by the nodes are described in the following table:
1
PostgreSQL
127.0.0.1:5432
1
Centrifugo
192.168.1.1:8000
1
go-ibax (TCP service)
192.168.1.1:7078
1
go-ibax (API service)
192.168.1.1:7079
2
PostgreSQL
127.0.0.1:5432
2
Centrifugo
192.168.1.2:8000
2
go-ibax (TCP service)
192.168.1.2:7078
2
go-ibax (API service)
192.168.1.2:7079
3
PostgreSQL
127.0.0.1:5432
3
Centrifugo
192.168.1.3:8000
3
go-ibax (TCP service)
192.168.1.3:7078
3
go-ibax (API service)
192.168.1.3:7079
Deploy phase
Your own blockchain network must be deployed in several stages:
Server deployment
Deploy the first node
The first node is a special one because it is essential to launch the blockchain network. The first block of the blockchain is generated by the first node, and all other nodes would download the blockchain from it. The owner of the first node is the platform creator.
Dependencies and environment settings
sudo
All commands of Debian 9 must be run as a non-root user. However, some system commands require super user permissions to execute. By default, sudo is not installed on Debian 9, you must install it first.
Become a super user.
Upgrade your system.
Install sudo。
Add your user to the sudo group.
After restarting, the changes take effect.
Golang
Install Go according to the Official Documents.
Download the latest stable version of Go (> 1.10.x) from Golang official website or through the command line:
Use tar to extract the tarball to the
/usr/local
directory.
Add
/usr/local/go/bin
to PATH environment variables (located at/etc/profile
or$HOME/.profile
).
Execute the
source
file to make the changes take effect, for example:
Delete temporary files:
PostgreSQL
Install PostgreSQL (> v.10) and psql:
Centrifugo
Download Centrifugo V.1.8.0 from GitHub or through the command line:
Delete temporary files:
Directory structure
For the Debian 9 system, it is recommended to store all software used by the blockchain platform in a separate directory.
The /opt/backenddir
directory is used here, but you can use any directory. In this case, please change all commands and configuration files accordingly.
Create a directory for the blockchain platform:
Make your user the owner of the directory:
Create subdirectories for Centrifugo, go-ibax and node data. All node data is stored in a directory named
nodeX
, whereX
is the node number. According to the node to be deployed,node1
is Node 1,node2
is Node 2, and so forth.
Create a database
Change the user password postgres to the default password 123456. You can set your own password, but you must change it in the node configuration file config.toml.
Create a current state database for the node, for example chaindb:
Configure Centrifugo
Create the Centrifugo configuration file:
You can set your own secret, but you must also change it in the node configuration file config.toml.
Install go-ibax
Download github-backend from GitHub:
Copy the go-ibax binary file to the
/opt/backenddir/go-ibax
directory. If you are using default Go workspace, the binary files are located in the$HOME/go/bin
directory:
Configure the first node
Create the configuration file for Node 1:
Generate the keys of Node 1, including the public and private keys of the node and the account:
Generate the first block:
Note If you want to create your own blockchain network, you must use the --test=true option. Otherwise, you cannot create a new account.
Initialize the database:
Initiate the first node server
To start the first node server, you must start the following two services:
centrifugo
go-ibax
If you failed to create services with these files, you may execute binary files from directories in different consoles.
Run centrifugo:
Run go-ibax:
Deploy other nodes
Although the deployment of all other nodes (Node 2 and Node 3) is similar to the first, but there are three differences:
You do not need to generate the first block. But it must be copied from Node 1 to the current node data directory;
The node must download blocks from Node 1 by configuring the
--nodesAddr
option;The node must use its own addresses and ports.
Node 2
Follow operational instructions as shown below:
Dependencies and environment settings
Create database
Centrifugo
Install go-ibax
Create the configuration file for Node 2:
Copy the first block file to Node 2. For example, you can perform this operation on Node 2 throughscp:
Generate the keys of Node 2, including the public and private keys of the node and the account:
Initiate the database:
Run centrifugo:
Run go-ibax:
As a result, the node downloads the block from the first node. As this node is not a verification node, it cannot generate a new block. Node 2 will be added to the list of verification nodes later.
Node 3
Follow operational instructions as shown below:
Dependencies and environment settings
Create database
Centrifugo
Install go-ibax
Create the configuration file for Node 3:
Copy the first block file to Node 3. For example, you can perform this operation on Node 3 through scp:
7.Generate the key of Node 3, including the public and private keys of the node and the account:
8.Initiate the database:
9.Run centrifugo:
10.Run go-ibax:
As a result, the node downloads the block from the first node. As this node is not a verification node, it cannot generate a new block. The client may be connected to the node, and it may send transactions to the network.
Front-end deployment
Only after installing GNOME GUI on Debian 9 (Stretch) 64-bit Official Release, the Govis client can be built with the yarn package manager.
Software prerequisites
Download Node.js LTS version 8.11 from Node.js official website or through the command line:
Install Node.js:
Download Yarn version 1.7.0 from yarn's Github repository or through the command line:
Install Yarn:
Build a Weaver application
Download the latest version of Weaver from github-frontend via git:
Install Weaver dependencies via Yarn:
Add the configuration file for the blockchain network
Create a settings.json file that contains information about node connection:
Edit the settings.json file in any text editor and add the required settings in this format:
Examples of settings.json files for the three nodes:
Build Weaver Desktop Application
1.Use yarn to build the desktop version:
2.The desktop version will be packaged into AppImage suffix format:
After building, your application can be used, but its connection configuration cannot be changed. If these settings need to be changed, a new version of the application must be built.
Build Weaver Web Application
1.Build a web application:
After building, the redistributable files will be placed in the /build directory. You can use any web server of your choice for deployment, and the settings.json file must also be placed in this directory. Note that if the connection settings are changed, there is no need to build the application again. Instead, edit the settings.json file and restart the web server.
1.For development or testing purposes, you can build Yarn's web server:
After that, your Weaver web application will be available at the following location: http://localhost:5000.
Configure the blockchain network
Create the creator's account
Create an account for the first node owner. This account is the creator of the new blockchain platform and has the administrator access.
1.Run Weaver;
2.Import the existing account using the following data:
–Load the backup of the node owner's private key located in the /opt/backenddir/node1/PrivateKey file.
Note There are two private key files in this directory. The PrivateKey file is used create the node owner's account. The NodePrivateKey file is the private key of the node itself and must be kept secret.
3.After logging in to the account, since no role has been created at this time, please select the Without role option.
Import applications, roles and templates
At this time, the blockchain platform is in a blank state. You can configure it by adding roles, templates, and application frameworks that support basic ecosystem functions.
1.Clone the application repository;
2.Navigate to Developer> Import in Weaver;
3.Import applications as per the following order: A./opt/backenddir/dapps/system.json B./opt/backenddir/dapps/conditions.json C./opt/backenddir/dapps/basic.json D./opt/backenddir/dapps/lang_res.json
4.Navigate to Admin> Role, and click Install Default Role;
5.Exit the system through the configuration file menu in the upper right corner;
6.Log in to the system as Admin;
7.Navigate to Home> Vote> Template List, and click Install Default Template.
Add the first node to the node list
1.Navigate to Developer> Platform Parameters, and click the first_nodes parameter;
2.Specify the parameters of the first blockchain network node.
Add other honor nodes
Add members into the consensus role group
By default, only members in the consensus role (Consensus) group can participate in the voting required to add other master nodes. This means that before adding a new master node, members of the ecosystem must be assigned to the role. In this section, the creator's account is designated as the only member of the consensus role group. In a production environment, this role must be assigned to platform members that perform governance.
1.Navigate to Home> Role and click Consensus;
2.Click Assign to assign the creator's account to the role.
Create the owner's account for other nodes
Run Weaver;
Import the existing account using the following data: – Load the backup of the node owner's private key located in the /opt/backenddir/node2/PrivateKey file.
After logging in to the account, since no role has been created at this time, please select the Without role option.
Navigate to Home> Personal Information, and click the title of the personal information;
Add account details (personal information title, description, etc.).
Assign the node owner with the Validators role
Operations by the new node owner:
Navigate to Home> Verifier;
Click Create Request and fill in the application form of the verifier candidate;
Click send request.
Operations by the creator:
Log in with a consensus role (Consensus);
Navigate to Home> Verifier;
Click the "Play" icon to start voting according to the candidate's request;
Navigate to Home> Vote, and click Update voting status;
Click the voting name and vote for the node owner. As a result, the account of the owner of the new node is assigned with the Validator role, and the new node is added to the list of master nodes.
Last updated