简体   繁体   中英

Hyperledger composer: Error: Could not find any functions to execute for transaction

Before marking it duplicate because of this post

Why does transaction give this error I want to mention this post have`nt solved my problem.

my issue is that I am defining transaction in model file and then using it in js script but it throws an error " Error: Could not find any functions to execute for transaction." when i try to execute it.

my cto code` /** * New model file */

       namespace org.acme.model

      participant Trader identified by email {
       o String email 
       o Double balance 
     }

          transaction simpleDemo {
        }`

js file

/**
      * @param {org.acme.model.simpleDemo} SimpleDemo
       * @transaction 
       */

     function SimpleDemo (SimpleDemo) 
     {
  console.log('hello');
      }

picture is attached for reference. enter image description here

In above stated case if there is a space between where our param is ending and where we define our function, hyperledger composer will throw the error.

You have to write it like this without any space.

/**
 * @param {org.acme.model.simpleDemo} SimpleDemo
 * @transaction 
 */
function SimpleDemo (SimpleDemo) 
{
    console.log('hello');
}

Thank you @lakshay gaur for solving this issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM