Create one more peer node using hyperledger-composer - hyperledger-fabric

I implemented hyperledger composer tutorial and create a simple business network definition and deploy it on through composer and implement it's rest API's through composer-rest-server. Now I want to add one more peer to it on a different local machine which can access blockchain I created previously, so my question is How can I achieve that a different peer node (another local machine) connected to blockchain I created in the composer tutorial?

you can check the S/Overflow link provided by Ahmed Nasser relating to adding your peer to an existing Fabric network.
Once you have your Fabric network up and running, and all of your network configuration / resolution / docker configuration tested and working, you can come to Composer to define the connection info, such as adding additional peers (and therefore create the requisite business network cards that contain that info).
This single organisation tutorial can give you an idea of what's involved - it builds upon a Fabric network that was already created (a simple, one-peer Fabric blockchain Dev environment) ..see here -> https://hyperledger.github.io/composer/tutorials/deploy-to-fabric-single-org.html
It obviously refers to 'localhost' in this scenario - obviously, you are creating something on an IP network, so you will need IP addresses/ host resolution as appropriate.

Related

Hyperledger Fabric: Unable to Invoke using Node SDK

I am having an issue in the Hyperledger fabric Node SDK.
Network Details:
The network consists of 4 organisations each deployed on different Kubernetes cluster.
Each organisation has 2 peers which joined a single channel say mychannel.
Each organisation has 1 CA running.
Ordering service is Raft.
CouchDB is used as statedb.
The invokes from the CLI are also working fine and the data is being synced between all the 8 peers.
Hypelredger explorer is up and running with the one organisation details and is able to list all the other 6 peers in the dashboard.
Now back to issue, I tried to deploy the Node.js SDK for Org1.
I created a connection profile having the details of the Org1 Peers, Orderer and CA.
The users are enrolled (Admin and user1).
Now when I try to invoke transaction there are two cases:
Service discovery enabled: In this case, the SDK tries to communicate with the other peers in the network and creator org peers but all returns the context deadline exceed error.
Service discovery disabled: Invokes successful.
I have no idea why the invoke transactions are failed when the service discovery is enabled.
The above issue is resolved when I added the host aliases into my /etc/hosts file.
I need to add the host names and IP for each peer in the /etc/hosts files.
After adding the host names, the SDK started working.
Thanks
Could be your anchor peers are configured incorrectly, since discovery reports those, and some clients will use them.

Multi Org Setup using HyperLedger Composer in multiple machines

I am working on setting up a Business Network for Multiple Organizations (two physical machines).
I did the setup of a business network using Hyperledger Composer Playground and achieved querying, rest-server implementation etc.
I have configured a multi-org (multiple organizations) setup for a single business network in a single cloud server (Reference link used: https://hyperledger.github.io/composer/latest/tutorials/deploy-to-fabric-multi-org). But, as in real scenario, I want to configure a multi-org functionality with two separate cloud servers.
I met with an error like below.
Error: Unable to Communicate with Peers. Peers not found.
Version of Composer : latest
Version of Fabric : V1.0
Thanks in Advance.
If you are using Composer latest (v0.19) then you have to use Fabric v1.1.
If you are Running on 2 servers with 2 IP addresses you need to solve the communications (IP Addressing and Routing) between you client and the servers, and between the containers on each server.
For the client to server you need to manage the addresses in the connection.json files for composer.
For the connectivity between the Peers and other containers the correct solution is to use Kubernetes or Docker Swarm to manage the addressing/routing. It is possible to use the extra_hosts feature of docker-compose for a simple demo but you might be restricted to one peer per org because of port conflicts.

Deploying a Hyperledger Composer blockchain business network to Hyperledger Fabric (multiple organizations)

I implemented hyperledger composer tutorial and created a simple business network definition. Then I deployed it through composer and implemented it's rest APIs through composer-rest-server. Now I want to add one more peer to it on a different machine (PC) which can access the Blockchain I previously created. I followed this Deploying a Hyperledger Composer blockchain business network to Hyperledger Fabric (multiple organizations), but in this tutorial, the network is configured using docker containers, with both organizations' fabric networks, on the same machine.
My Question:
1. What are the differences between multiple organizations using docker containers (on the same machine) and using multiple machines (PC)?
2. How to implement this with multiple machines (PC) using Hyplerledger Composer?
Thank you in advance!
As answered on Hyperledger Rocket Chat:
The tutorial you refer to (Multi Organisation on one PC) is used to illustrate the Composer Aspects of a Multi Organisation - Multi Peer configuration. It is not necessary to use Docker Containers to build a Fabric, but it is easier and the majority choose to do it that way.
It is easy for Composer to work with a Multi Machine setup - you just create a different connection.json file to 'point' to the various addresses! The real question is how to implement a Multi-Org Hyperledger Fabric.
Docker Compose is the tool used for a Development Fabric and for the tutorials and it provides networking between the component containers, but Docker Compose is only really intended for a single machine. To work with multiple machines Kubernetes or Docker Swarm are better choices (or cloud hosting) and certainly something other than Docker Compose is required for production.
There are however a couple of tutorials that can be used for learning or PoC - I haven't tried them, but others in the community have:
https://www.skcript.com/svr/setting-up-a-blockchain-business-network-with-hyperledger-fabric-and-composer-running-in-multiple-physical-machine/
https://medium.com/#wahabjawed/hyperledger-fabric-on-multiple-hosts-a33b08ef24f

Using more than one peer in Hyperledger Composer

I have recently deployed and started a business-network with Hyperledger Composer, I have only one peer (?) in which I have created the network and now I am using the rest-server for adding participant and doing transaction from an Android app to my personal blockchain and everything goes well.
So...Need I to configure one or more peers on my network? What's the utility of doing that?
I know that other blockchains needs a lot of peers for co-validating transactions and for maintaining a big scalability / distributed data; doesn't Hyperledger do it for me without adding more peers in my network?
If you have started with Hyperledger Composer you are probably using the 'standard' development Fabric with a Single Peer. This is a 'minimal' Fabric provided to get developers a fast start without the need to configure and deploy a Fabric. But you are correct Hyperleder Fabric can be configured for Multi Peer Multi Organisation distributed ledgers.
There are tutorials in the Fabric documentation for setting up a Fabric from scratch, and also this document covers a tool for extending the Fabric.

Hyperledger Fabric add new peers in different machine

I have completed this tutorial and successfully deployed a business network over what it seems to be a generic hyperledger fabric blockchain.
What i want to do now is to create a new peer in diffenrent machine but connected to the same blockchain. Can't find any information. Any help?
Thank you community!
To deploy hyperledger on a different machine you need to take advantage of docker swarm and overlay network. You can find the guide at
Deploying Hyperledger on Multiple Hosts
for the next question about extending your existing network by adding peers, follow Extending your network
I suggest you start looking at the hyperledger fabric documentation
http://hyperledger-fabric.readthedocs.io/en/latest/
You will need to understand about a hyperledger fabric network topology. There are many things you need to understand in order to understand how to configure a peer correctly and join it to a channel. The build your first network section will take you through creating a fabric network from scratch.

Resources