We received an ecstatic news on 19th June, 2020 that asvin was selected for implementation stage in a pan-European project called Blockchers after the fierce online pitching competition. The Blockchers is a prestigious project which has received funding under European Unions’ Horizon 2020 initiative. It aims to open the door for European SMEs in revolutionizing world around us using Distributed Ledger Technology (DLT). Now, asvin is a proud  member of the Blockchers community. For the next stage in the program, asvin has partnered with tsenso to design and develop an IoT solution powered by 5G network and Alastria blockchain network. In this blog, I am going to illustrate how one can deploy a private node in the Alastria network B.

What is Alastria Network B?

First of all, Alastria is one of the core partners of BLOCKCHERS consortium which supports in advancing and bringing out innovation using the distributed ledger technology ecosystem. It is a non-profit association which have two operational networks called Network T (Red-T) and Network B (Red-B). The Network T is built on Quorum technology and on the other hand the Network B is powered by Hyperledger Besu. We are going to focus on the Network B. The Hyperledger Besu is an Ethereum client designed by keeping the characteristics of enterprise grade public and private permission networks on mind. The Red-B network is composed of following nodes

  1. Regular Node is a fully functional peer in a Ethereum network which can used to deploy smart contract, submit transactions and connect to other peers in the network.
  2. Regular Pro Node is an extension of the regular node which facilitates private transactions. This is achieved using the private transaction manager called Orion.
  3. Validator Node accepts the transactions sent by regular nodes, runs the consensus algorithm and validates the transactions.
  4. Boot Node facilitates access to the network and find other nodes running in the network. A regular node is started with the metadata information of boot nodes present on the network.

The Red-B is private permissioned blockchain network which means it is not open for public and one needs to get permission to be part of the network. It is difficult to cover the deployment of all type of nodes in this blog. Therefore, I am going to explain the deployment of a regular node. You can find the detailed information in Alastria Node Besu repository for other node types.

How to Deploy a Regular Node?

You would be surprised to know that it is easier to start a besu node than applying butter on a Brezel. Naturally, there is a catch here you need to have all the prerequisites (Docker and Docker Compose) installed on your machine. I have put the installation guidelines to help you out with this.  Once, you are done with installation, you are ready to get into the specifics.

  1. Clone the regular node repository.[code language=”bash”] git clone https://github.com/b-rohit/alastria-regular-node-besu.git[/code]
  2. Generate besu node key[code language=”bash”] cd alastria-regular-node-besu
    ./node.sh key[/code]This is one time operation. The aforementioned command will run a docker container with hyperledger/besu image and generate keys in key folder in the current directory. Keep your private key safe, do not reveal it.
  3. Launch Node[code language=”bash”] ./node.sh up[/code]The command will spin up 3 docker containers namely besu, prometheus, and explorer. The besu container is the most important of all as it is your regular besu node. The config.toml and genesis.json files are used to configure the besu node. You can make changes in the config.toml file to change the behavior of the node. You don’t need to touch the genesis.json file. It is been customized for Alastria Network B and unnecessary changes will lead to errors. The besu container will expose port 8545/tcp, 9545/tcp, 30303/tcp, and 30303/udp which are utilized for HTTP JSON RPC, web socket and P2P discovery respectively.  The Prometheus is used for monitoring the besu node and the ethereum block explorer facilitates block information. The output from the command looks similar to following  The node.sh script can also be utilized to remove, start and stop the containers. For instances, if you want to make changes in the config.toml file and restart the containers without deleting their data then you could use either pause/resume or restart modes of the script as shown below[code language=”bash”] ./node.sh pause
    ./node.sh resume[/code]

    or

    [code language=”bash”] ./node.sh restart[/code]

Registration

As mentioned earlier Reb-B is a closed network and you need to register your node to participate in the network. The steps are following.

  1. Get your enode[code language=”bash”] curl -X POST –data ‘{“jsonrpc”:”2.0″,”method”:”net_enode”,”params”:[],”id”:1}’ http://127.0.0.1:8545[/code]
  2. Fill in the electronic form and submit.

Usage

Once your request is accepted, you can deploy your smart contract written in solidity and interact with it using MetaMask and decentralized application (DApp). I will cover that in my next blog. In the meantime, you can make yourself familiar with Besu API methods, Prometheus dashboard and block explorer web interface. You can access the prometheus and block explorer dashboard on http://127.0.0.1:9090 and 127.0.0.1:8080 respectively.