Hyperledger Composer model not persisted - hyperledger-fabric

I'm using Hyperledger Composer on Fabric v1.0. When stopping Fabric with fabric-tools/stopFabric.sh and then starting with startFabric.sh, the deployed model (.bna file) is no longer there.
How do I set the system up so that data will stay there after a system reboot?

This is an operational consideration for how to set up a fabric environment and as you correctly observe, because our fabric dev server just start up fabric containers, if those containers are destroyed for any reason then their internal filesystem are lost.
In the hyperledger fabric documentation they describe a simple way to make the fabric containers persist their data outside of their isolated file systems.
see
http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html
and the section called "A Note on Data Persistence" which provide detail on this. In this case you would need to apply the concepts described there to the docker-compose.yml file in the hlfv1/composer directory in our fabric dev server.

If you were deploying using the composer playground, you can save your bna using the export button on the lower left of the playground define interface.
If you want to persist your deployment itself, you can modify the docker-compose files to persist the data in the /var/hyperledger/production on the peer and orderer containers using a data volume. This will persist the ledger and credentials the next time you bring up the network.

Related

How to setup multicloud architecture in hyperledger fabric?

I have a peer in google cloud platform. I have to join that peer to the channel in azure network.
What I tried:
Generated crypto-materials for new peer using azure network webclient and used that crypto-config materials in all the peers, orderer and webclient in azure and also in the new peer I have in google cloud. But after that new peer can join the channel of azure but could not install instantiate the chaincodes.
There are two recommended approaches to setting up Hyperledger Fabric Network on Azure. You can use the Hyperledger Fabric template available in the Azure Marketplace to launch your environment on Azure or you can take the hard way and manually commission VM Instances. Using the template is obviously a faster solution. It is also a better solution. If you were to manually set up your environment, you would have to consider 2 cases — using multiple VM instances (usually in a production environment) or a single VM (for a development environment).
In the second case, you would have to set up the communication rules between VM instances if you are using multiple ones. You would have to download and install the Fabric SDKs and configure the channels and peers and every other facet of a typical Hyperledger Fabric network. While that is easy to do for single, Dev mode VM instance, things get really complicated when you have to consider multiple running instances. Hence, it is better to use the Hyperledger Fabric Template to set up your Fabric environment on Azure.
In either approach, Fabric Network generates a channel configuration. This step generates a new channel configuration block that includes the new member belonging to the peer node in GCP. A configuration block is similar to the genesis block, defining the members and policies for a channel. In fact, you can consider a configuration block to be the genesis block plus the delta of configuration changes that have occurred since the channel was created.
Azure VM Fabric Network can shares the genesis block for the channel with Peer Node in GCP. Before the peer node in GCP joins the channel, it must be able to connect to the ordering service. It obtains the ordering service endpoint from the channel genesis block.
If you are facing issues in the GCP peer node, please confirm that the peer node is receiving blocks on the channel, you install chain code. You then run a query against the local ledger on the peer. After installing the chain code, the peer node in GCP can run queries against its own world state database.

Implement the distributed-decentralised ledger for a hyperleder network

Did a small example using the hyperledger composer and then used the composer-rest-server to integrate it with GUI. So in the case of identity, only admin is there. There is also documentation to create and issue other identities to login into the business networks.
But still, the problem is it's only in a single peer, meaning my local machine. To my understanding, for the hyperledger to function as decentralized and distributed ledger system, additional peers have to be added to the channel and then states gets synced in those peers. Hence if one node is down, details can be obtained from other nodes.
I checked some links such as this and this. But all of these point to the things that :
Existing network should be stopped and teared down.
The IP address of the second machine should be manually added to the docker.yml file and then have to be restarted.
My doubts are :
But on doing this, won't the existing ledger stated be cleared? All the data are gone.
So before even creating a dApp using hyperledger, we have to include all the IP address of the machine in the yml and start the network?
How to actually implement the distributed-decentralised ledger system for a hyperleder network?
UPDATE :
I have checked the links mentioned by Paul O'Mahony. The links explains about the peer addition steps. Overall what happens there is :
downloaded the fabric sample as the fabric extension is only possible through the cryptogen version appropriate to the Fabric version.
Currently contains order, org1 & org2 (with 2 peers each).
To add a new peer along with its couchdb, changed the template count in the crypto-config.yaml and created crypto material for the new peer using the extend command.
Then using the docker composer file to spawn a new peer and its couchdb. This will create new containers.
Finally the created peers should be joined to the existing channel for the couch db to get sync. The adding to existing channel is via logging into the docker container and typing some cli commands and adding the peer to channel via channel join command.
Is this recommend way to add peers to the channel ? Suppose i am creating a network and wanted to add peers to the channel based on a condition. Like a user/users can add themselves to the network through a login via composer playground and act as a peer. So i have to follow the same steps to do it ? Is this the recommended way ?
Supporting link : https://chat.hyperledger.org/channel/fabric?msg=KgxFegcZyKEPdo4v2

Admin tool to manage hyperledger fabric blockchain network?

When I install a hyperledger fabric network (as instructed on hyperledger.readthedocs.io), it gives me ability to communicate with the deployed blockchain instance. There are a few CLI commands that I can use to stop/restart the service.
I am looking for a UI based tool, that an admin user can leverage to view the activity, as well as control the different entities in the blockchain network.
Note: I have already seen Blockchain explorer but its apparently a read-only tool.
Many Thanks.
I think Hyperledger Composer is best way to access the Hyperledger Fabric Network.
It Provides UI to access full blockchain network.
You can find the tutorials here.
Also, if you want to view total blocks, transactions, peers data, then You can use Hyperledger Blockchain Explorer.
The link is here.
Hyperledger Cello is the tool which can help you to manage blockchain in an efficient way.
Using Cello, everyone can easily:
Build up a Blockchain as a Service (BaaS) platform quickly from scratch.
Provision customizable Blockchains instantly, e.g., a Hyperledger fabric network v1.0.
Maintain a pool of running blockchain networks on top of baremetals, Virtual Clouds (e.g., virtual machines, vsphere Clouds), Container clusters (e.g., Docker, Swarm, Kubernetes).
Check the system status, adjust the chain numbers, scale resources... through dashboards.
https://cello.readthedocs.io/en/latest/
enter link description here

Hyperledger communication between multiple machine

I have created a network composed by two nodes using this tutorial: Multiple Machine.
In the node with orderer and ca installed, I can use the composer-playground to interact with the blockchain. Instead, analysing the logs of the docker on the second node, I am able to see the communication between the nodes but I am not able to access the data.
How can I access data on the second machine?
It is a simple node connect to the first node (where is installed the orderer and the ca).
Thanks,
What do you mean by accessing the data?
In Hyperledger Fabric the ledger data is composed of two components i.e. World State and Transaction History Log (the blockchain).
Here World state refers to the most recent (current) state of the assets you have and Transaction History log refers to the transaction executed on these assets. Assets or Key Value set when using CouchDB as the World State allows you to have KeyValue with Value as JSON documents.
The World State by default is stored in levelDB or couchDB, if you have docker containerized network the World State levelDB is stored on the peer container while using couchDB sets up its own couchDB container associated with each peer. The couchdb for each peer can be accessed from host machine using http://couchdbIp:port
The Transaction log get's stored in the underlying file system as blockFiles somewhere under location /var/hyperledger/ledgerdata or something in the peer container.
When you mention Orderer, which is another component like peer, is a docker container assigned the role of making sure that transactions are properly ordered and verified that their endorsement are valid. This gets complicated as you go to having multiple ordering service nodes and requires Kafka implementation rather than the default SOLO implementation. You can read about each of these implementations in Hyperledger Fabric official documentation.
Also CA is associated with each organization responsible for establishing chain of trust is another component of Hyperledger Fabric that signs certificates of network components like organization peers, client and participants following PKI.
The Playground will connect to the Fabric based on the connection profile (connection.json) for the Business Network Cards you have. If you want to specifically connect to second node you could modify a card.
But remember that Playground is a development and test tool not a production tool so you shouldn't worry too much about hitting different containers with it - particularly as the data will be the same replicated across Peers.

What is the relation between `Fabric`, `Composer`, `Cello` and other Hyperledger applications?

When I was tasting the fabric, I found many other blockchain projects, like Composer, Cello, Explorer. They are all belong to Hyperledger. I'm very confused that there are so many projects. Should I learn all of them? It seems each project plays a role in the blockchain. BUT:
What's the relation between them?
I draw a picture to explain my question. The picture is not correct, I just want to make my question clear.
If I figure it out, when we want to use the blockchain in our project, I can just study few of them, and use them appropriately.
Fabric provides a framework to set up a blockchain network. It is data/application agnostic.
Composer provides a set of tools to define a business network on top of Fabric. This provides a higher level of abstraction than Fabric where the data are essentially just bits. With Composer you can define assets, transactions, etc.
Cello helps with provisioning of the network.
Explorer simply provides a web based interface to explore what's on a blockchain.
Fabric is a permissioned blockchain distributed ledger, it is at the end; an implementation of a permissioned blockchain.
Hyperledger project comprises a suite of tools for building blockchain business networks, what they name it "Hyperledger Composer".
it is used for developing,testing, deploying application on blockchain
also it is used for integrating your blockchain with external systems,
Cello, is a blockchain provision and operation system, which helps manage blockchain networks, and make the blockchain as service BaaS, it is not a blockchain, but it is used to manage the blockchain network.
Check this link for better understanding Cello
Hyperledger Cello
Explorer provide you KPI that show the blockchain
Cello is admin tool that help you to monitor the host and network with and container inside it, actually cello using fabric script if you take around in fabric you will find byfn (build your first network) script that setup container and example peer.
so cello uses this script to create container and show to you status of this and delete it or edit.
composer provide a tools to help you create your business card and your smart contract to write your smart contract you need to write acl(access control language which define rule),your logic , define participant and assets.
then composer will create bna archive file and install it on blockchain.
there is some module in composer like playground and restserver and also there is generator for frontend
fabric is the framework that setup the blockchain network, it's the base that cello and other module uses it
i hope i help you

Resources