{"repo":"IBM/queryPattern","free":true,"listed":false,"github":"https://github.com/IBM/queryPattern","clone":"git clone https://github.com/IBM/queryPattern.git","description":"Look at how to query the world state of a peer within Hyperledger Fabric. Querying the world state is useful for seeing the current state of the assets in the network.","language":"JavaScript","stars":14,"topics":["hyperledger-fabric","blockchain","querying"],"license":"Apache-2.0","category":"blockchain-web3","readme_excerpt":"Exploring the Querying Capability of Hyperledger Fabric 1.4 In this pattern, we will take a look at how you can query the world state of a peer within Hyperledger Fabric. Querying the world state is useful for seeing the current state of the assets in the network. For this pattern, we will be using the commercial paper use case from the Hyperledger Fabric 1.4 documentation. In this pattern, you will go through the process of creating indexes for the CouchDB world state database. You will then update the smart contract to include the logic to query the world state utilizing the newly created indexes. After updating and redeploying the smart contract, you will simulate 100 transactions to populate the world state with assets. Lastly, you will run a few queries utilizing the Node.js SDK and view the results that were returned. What are database indexes? In order to understand indexes, let's take a look at what happens when you query the world state. Say, for example, you want to find all assets owned by the user, \"Bob\". The database will search through each json document in the database one by one and return all documents that match user = \"bob\". This might not seem like a big deal but consider if you have millions of documents in your database. These queries might take a while to return the results as the database needs to go through each and every document. With indexes you create a reference that contains all the values of a specific field and which document contains that val","default_branch":null,"files":null,"tree":[],"storefront":"/r/IBM","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/IBM/queryPattern/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}