0

Is it possible to include other javascript libraries/functions and/or even node.js packages in Composer transaction functions/logic?

Examples:

  1. To use another HTTP library like axios to implement GET/PUT/DELETE and other HTTP methods that are not available yet
  2. Check a signature we can use the crypto2 node.js library.
Erazihel
  • 7,295
  • 6
  • 30
  • 53

2 Answers2

0

As of now I don't believe that is possible. See Can I use JavaScript libs with require on transaction processor

I have been using node-red along with the node-red-contrib-composer tie in:

https://medium.com/@CazChurchUk/integrate-your-blockchain-with-anything-using-hyperledger-composer-and-nodered-4226676f7e54

to call external services and send HTTP requests that are not possible using the post() function that is supported in the transaction processor

https://hyperledger.github.io/composer/integrating/call-out.html

0

add the javascript library to the lib folder of your business model . Then use them in the transaction 'logic.js' without import or require, since it will be injected later in the application .

enter image description here

enter image description here

Here the result in composer playground

enter image description here

here the result in composer-rest-server

enter image description here

Happy coding ...

Medium Story : https://medium.com/@tarek.lejmi/hyperledger-fabric-use-javascript-libraires-on-transaction-processor-33e13b8c020d

tlejmi
  • 526
  • 8
  • 13