Explore Courses Blog Tutorials Interview Questions
0 votes
in Blockchain by (4.1k points)

 I´ve just replaced the Composer default sample ("sampleAsset", "sampleTransaction", etc) by another one I created, for my better understanding. Everything works except for the transaction, which return me the error message: "**Error: Could not find any functions to execute for transaction org.acme.sample.CompraDoVinho#**2b2d0624-bc..."

Find below the source codes. 

Model file:

namespace org.acme.sample

asset Vinho identified by IDvinho {

o String IDvinho
--> Participante owner
o String uva
o String nomeVinho
o Integer preco


participant Participante identified by IDparticipante {

o String IDparticipante
o String tipo
o String nomeEmpresa


transaction CompraDoVinho identified by IDcompra {

o String IDcompra
--> Vinho asset
o Integer precoVenda



CompraDoVinho.asset.preco = CompraDoVinho.precoVenda;
return getAssetRegistry('org.acme.sample.Vinho')
    .then(function (assetRegistry) {
        return assetRegistry.update(CompraDoVinho.asset);


rule Default {
description: "Allow all participants access to all resources"
participant: "ANY"
operation: ALL
resource: "org.acme.sample"
action: ALLOW

Could anybody help me finding where is the bug in my code?

Thanks in advance


1 Answer

0 votes
by (14.4k points)

You are facing the issue because you have renamed the transaction. The Composer has 2 mechanisms to route transactions to JS functions:

  • (Legacy) using an onMyTransactionType naming convention: The function will be called when an instance of MyTransactionType is submitted.
  • (Preferred) using the @transaction and @param annotations: The @transaction annotation indicates that the function would like to process transactions and the @param annotation is used to specify the type of the transaction to process.


     * Place an order for a vehicle

     * @param {org.acme.vehicle.lifecycle.manufacturer.PlaceOrder} placeOrder - the PlaceOrder transaction

     * @transaction


    function placeOrder(placeOrder) {


        let factory = getFactory();

        let NS = 'org.acme.vehicle.lifecycle.manufacturer';

        let order = factory.newResource(NS, 'Order', placeOrder.transactionId);

        order.vehicleDetails = placeOrder.vehicleDetails;

        order.orderStatus = 'PLACED';

        order.manufacturer = placeOrder.manufacturer;

        // save the order

        return getAssetRegistry(order.getFullyQualifiedType())

            .then(function (registry) {

                return registry.add(order);



Browse Categories