Hyperledger is a Block-chain project hosted by Linux Foundation. It is a permissioned blockchain platform for distributed ledger solutions and enterprises. The objective of the project is to improve the cross-industry collaboration by developing blockchains and distributed ledgers, with a particular focus on improving the performance and reliability of these systems. The aim is to make these systems capable of supporting global business transactions by major technological, financial and supply chain companies. For now we will take a simple sample network and try to rename peer already created in the network. To add a new peer you can refer to the article here.
Before we begin you need to check that you have completely set up the Hyperledger fabric development environment. Clone the fabric-samples repository from GitHub. It includes different samples of fabric deployments but we will be using the basic-network sample.
Lets open that sub directory.
You can clone fabric-samples by executing this command in your terminal:
after pulling the repository you need to pull fabric images. These images can be pulled by running the bootstraps commands from the fabric samples repo. Run the following commands to pull fabric images.
$ curl -sS https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh -o ./scripts/bootstrap.sh
$ chmod +x ./scripts/bootstrap.sh
This will automatically pull the most latest version of fabric images for you.
Once you are done with the prerequisites you will open the basic network directory. The basic network is a single organization network with only one peer.
Starting the network:
To start the network open the terminal in the basic network sub directory and you will see a bunch of scripts present.
To start the network execute
It will start the network, then you will be able to see that it has only one peer whose name is peer0.org0.example.com.
Now stop the network by executing
Rename Peer :
For renaming the peer you will have to alter some files that start the network and also change the name of the peer where it is located.
peer0.org0.example.com is located at the following address in basic network sub directory.
You will rename the peer there to whatever you want, i have changed it to abc.org01.example.com.
Once you are done go back to the basic-network directory to alter the files.
Open the docker-compose.yaml file and in the services go to the peer section you will see it will have everything needed to run the peer0. change all the instances of peer0 to whatever you named your peer before.
As you can see, I have changed it to abc.org01.example.com.
Now open the Connection.yaml file, this file is for the peers connection with the channel it will or has joined. So to avoid further errors rename your peer in this file as well.
Same goes for Connection.json because it is used whenever Node Sdk will query the network rename the peer in this file.
Finally your script file by the name start.sh will be calling a service in the docker-compose.yaml file by old peers name open the file and change where it’s calling the service with the old name of the peer with the new.
Once you have done that, save all the files and open terminal in the basic-network sub directory.
In the terminal write the command to start the network :
You will see that your peer is renamed as shown below.
If you still have some queries or want us to rename your hyperledger fabric peer then contact our Blockchain development company.