How to decrypt result of query when using the Hyperledger Client SDK for Node.js

0 votes

In the Hyperledger Client SDK for Node.js , how can I decrypt the results of the query that are returned in the results variable below ?

tx.on('complete', function (results) {
       console.log('Results          [%j]', results);

The console.log shows a message like :

Results          ["7b22496e766f6963654944223a2269303031222c22436c69656e744944223a2269303031222c224e616d65223a224c656e6f766f2047726f7570204c74642e222c22416d6f756e74223a3130303030307d"]
Sep 18, 2018 in Blockchain by digger
• 26,550 points
32 views

1 answer to this question.

0 votes

In this case, it is just a hex-encoded string:

tx.on('complete', function (results) {
   console.log('Results:[%j]', new Buffer(results,'hex').toString());
}

should work

answered Sep 18, 2018 by slayer
• 29,170 points

Related Questions In Blockchain

+3 votes
2 answers

How to run ethereumjs using Node.JS

You need to install testrpc globally on ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,620 points
156 views
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,550 points
81 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
169 views
0 votes
1 answer
0 votes
1 answer