I want to have two peers within an organization in which one peer act as a client that only send transactions without storing the ledger, and the other act as normal peer. I read about having lightweight node and full node. But how to make them both related to the same organization in Hyperledger?
All peer nodes are committers in Hyperledger Fabric. Thus, every peer node stores the ledger. If a node does not store the ledger, it may be a client or some kind of proxy, but not a peer node. Please, refer to the document where you have read about lightweight and full nodes, as it may be not referring to peers.
Anyway, every node is related to its organization through its MSP.
Related
I have two organizations with 2 peers running on each organization. I created a channel and joined all the 4 peers to it. The peers use couchdb as state database. Now if I accidentally modify/delete the data stored in one of the peer's couchdb database, how does this peer recover from the changed state and get synchronized with other peers?
If you modify data in the state database, it will not be propagated to other peers. See the detailed answer in the question: Hyperledger Fabric CouchDB updates through Fauxton treated as valid updates, but no record in blockchain
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
Can nodes interchange roles in hyperledger fabric?
Is it possible to make an endorsing or committing peer take the role of an orderer when required?
Every endorsing peer is also a committing peer.
An orderer and a peer are totally different binaries, and have completely different APIs, so - you can't have one fill the role of the other.
In hyperledger fabric, we can have multiple state databases corresponding to each channel the node has joined. Do we also have multiple blockchains corresponding to each channel for a node?
Note that in Fabric there is only one ledger per channel. Ledger in Fabric contains two components. One is called the world state which stores the latest value of the keys. Another one is called blockchain which stores all the transaction log that leads to the world state. So back to your question, there should be one state databases (world state) and blockchain per channel. Each peer in the channel hold a copy of the ledger and thus should have a consistent view on the world state within the channel.
For more information, you may refer to the following:
Docs on Ledger
https://hyperledger-fabric.readthedocs.io/en/latest/ledger/ledger.html
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.