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,740 points
679 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,370 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,610 points
1,466 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,470 views
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,740 points
1,037 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
1,947 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP