Before we move on to interactions with the ledger, it will help to review how the ledger is updated in Query.js. (see fabric-samples/fabcar/query.js)
When a client queries a Hyperledger node, the state object is returned as the consensus at that time. In section 1 we covered the transaction flow in greater detail, but we’ll now see how the query object is generated and passed to the network endpoint / SDK.
You can send the query by triggering the script using the following command:
If your Hyperledger node is running this should return a printout of json data, but right now it will be empty because we haven’t added any cars to the dealership’s registry! In the next section, we’ll explore the chaincode and see how this payload gets processed by other nodes on the network!