Where does hyperledger fabric store the database for the blockchain? - blockchain

I have hyperledger fabric network setup on my local machine with a single validating node. I am developing a chaincode and would like to clear my blockchain. I have read that the hyperledger fabric stores the database under /var/hyperledger. However, I do not see this hyperledger directory under /var. Is there another location for this directory? My development platform is MAC and I am using docker-compose to start my hyperledger fabric network.

The Hyperledger Fabric stores the database in /var/hyperledger/production/db within the file system for the validating peer. You can navigate to the validating peer file system by using a command like docker exec -it substitute_container_name bash. I am not aware of another location of the database. If the instructions at https://hub.docker.com/r/ibmblockchain/fabric-peer/ for using Hyperledger Docker images are followed, then the database location should be /var/hyperledger/production/db.

To clear the blockchain, the easiest way is to stop and run docker container again, given that you only have 1 validator peer you should not be worried about data consistency. Also, try to use the latest version of fabric releases since they improved a lot these kind of problems. And regarding the issue,
no rows in result set
make sure that youe have specified the right organization name and department when requesting user validation agains CA. The parameters you send, must exist on CA database, otherwise, you will receive that error.

Related

can't see channel list in hyperledger fabric in docker command line shell

I've a bankchain network developed using hyper ledger fabric 1.4.4. The network runs successfully but when I enquire through :peer channel list
I get error. I really need to solve this this creating issue is chaincode instatiation.
If required I can share the complete code as a zip file.

How to add a new peer to an existing Hyperledger Fabric network?

When you create a hyperledger fabric network, you define organizations, orderers and peers in crypto-config.yaml and configtx.yaml.
But how do you add a new organization or a new peer to an existing organization in a network that is already setup? Run cryptogen and configtxgen pointing to config files that contain only the new organizations/peers? Re-generate everything?
The whole point of using cryptogen is to help user to settle the crypto material for peer and organizations defined in the crypto-config.yaml file. However one can simply leverage openssl to generate keys and certificates of organization root CA, next generate user certificates and arrange them into the folder similar to what cryptogen is producing and startup your network. Therefore adding a new peer will stand up to simply generating a new set of keys and certificate signed by the root CA. Finally you can simply start new peer and join it to the channel by providing genesis block, which could be fetched from ordering service.
Now, the configtxgen tool helps you to configure your Hyperledger Fabric network it terms of which organizations will form a consortium and will have rights to join the channel. Extending this configuration is a bit more involved process than simply adding a new peer, in order to complete you will have to leverage the configtxlator tool, more details and example of how to use it you can find in the following tutorial. In high level, you will have to read current channel configuration, parse it into the json format, update with new participants, compute the delta and generate configuration update transaction and the last step is to submit the update to the ordering service so it will take effect. Once you will accomplished config update you will be able to add new peers from new organization to the channel.
You can achieve this by generating the crypto material (using cryptogen extends) for the new peer, spawning the new peer and joining that peer to the existing channel on the network to sync-up.
You can find the complete guide at
Extending Hyperledger Fabric Network: Adding a new peer

How to create mutiple connection profiles and multiple nodes in Hyperledger Composer

I have a scenario where I have to create multiple nodes with same or various organisations.
As per my understanding changes required in below files while setting up the blockchain network Hyperledger Composer Version 1.0
- createComposerProfile.sh
- docker-compose.yml
Can you please tell me whether my understanding is correct or not. Also please guide me the changes required in those files.
Our development server is a simple setup of Hyperledger Fabric and is not really provided as an example of how to create a Hyperledger Fabric, it is there purely to provide a real Hyperledger Fabric for testing purposes for Hyperledger Composer applications. If you want to learn more about creating and building your own Hyperledger Fabric environment then documentation provided by the Hyperledger Fabric team is the place to go. You could try starting at
http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html
which provides information on how to build your first network

IBM Block Chain- Car Lease Demo state database location?

I was working on IBM block chain examples and I deployed car-lease-demo sample on a Linux system. I am not able to understand how the database is storing. I see that there is a location "/var/hyperledger/production" where the database is located but I did not find any location like that.
Can anyone explain me how the data is stored and how hyperledger fabric uses the database to store key-value pairs and where is the location of the db where all the data is stored?
Also I would like to know if we can use a different db configuration like NOSQL databases like Neo4j, MongoDB ??
The default implementation uses LevelDB as the backend store for data and is present on all peer nodes. You can enter the docker container in cli mode and see it for yourself.
Yes, you can change the default DB to any other NoSQL DB. Here's is an example of setting up CouchDB with Hyperledger fabric.
As you can see, CouchDB is hosted in a separate container linked to the peer node via an open port (Look at the Docker compose file for details of connection). You can do the same for any other NoSQL DB and use the correct PUT and GET APIs in chain code to access them. But you will have to make sure that data gets replicated in all the DBs in time to maintain the consistency of the Blockchain network

Hyperledger Fabric v0.6, set up network (additional peer) directly without docker any possible way?

I has a question related to network setup of additional peer in Hyperledger Fabric.
I want to add 2 more peers to existing peer to form a network ,but all available document is all about connection peer together by using Docker. In my case I already have multiple servers. so I just directly install peers to 3 different Servers separately ,but how can I connect that 3 peer up and running together. I cannot find any document related to this.
Hopp you can guide.
To install Fabric directly to Server is recommend or not?
Below is Screenshot of one peer. it's up and running fine. but How to connect 3 peers together directly on different Server without using Docker.
I have follow this link: https://github.com/hyperledger/fabric/blob/master/docs/Setup/Network-setup.md
but I still can't find the way since it used docker.
any file that can modify to make it such as core.yaml ..etc
enter image description here
When using Hyperledger Fabric version 0.6, there is not a straightforward way to connect multiple peers on different servers without using Docker. As you noted, the Setting Up a Network section covers how to use Docker Compose to link peers together. One of the primary uses of a Hyperledger Fabric version 0.6 network is to learn how to develop chaincode. The focus isn't so much on dynamically allowing peers to join a network.
There are a few options for creating a blockchain network for Hyperledger Fabric version 0.6.
Published Docker images
Setting up a development environment
An instance of the Blockchain service on Bluemix can be created.
Hyperledger Fabric 1.0 (currently under development) aims to make it easier for different entities to join a blockchain network. An early preview of related concepts were covered during a Connect-A-Thon event. There is also an article about this event.
Yes. We can create a blockchain network without docker using Hyperledger Fabric v0.6. We have been done it in practice. For sure, we have to use docker to deploy chaincode.
For Hyperledger Fabric v0.6, both with docker or without it, we can not add more peers to existing network.