Question about invokeChaincode api #fabric-chaincode


BigBang019
 

Environment: fabric release-2.2
My chaincode named vulnerable is as follows:


When I invoke helloworld directly, it gives me responce "helloworld", everything works fine.

But when I invoke invokeChaincode method, it gives me



and chaincode docker container logging is as follows:



It seems like
(1) the statement System.out.printf("\n%s\n", chaincodeName) works fine.
(2) org.hyperledger.fabric.shim.impl.InvocationStubImpl.invokeChaincode also finds the registered method helloworld, but it encountered another exception half way the invocation.

Does anyone met this problem before?
Thanks in advance.


Matthew White
 

Hello;
 
Can I suggest that you raise an issue on the github  hyperledger/fabric-chaincode-java repo?
 
Though to check that you can call `helloworld()` directly from `invokeChaincode` without having to call invokeChaincode?  Pass on the ctx variable, and both methods are then part of the same transaction. 
 
Typically only use invokerChaincode, when you going to a completely different chaincode.
 
 
Regards, Matthew.
Matthew B White  IBM Blockchain Solutions Architect
 
Email me at WHITEMAT@...
Find me on StackOverflow, and generally at  calanais.me.uk
 
Note: restricted availability for meetings 14:30 to 17:00 UK Tuesday 
IBM United Kingdom Limited, Hursley Park, Winchester, Hampshire, SO21 2JN

"The wrong answers are the ones you go looking for when the right answers stare you in the face"
 
 
 
----- Original message -----
From: "BigBang019" <zhuxy0000@...>
Sent by: fabric@...
To: fabric@...
Cc:
Subject: [EXTERNAL] [Hyperledger Fabric] Question about invokeChaincode api #fabric-chaincode
Date: Fri, Dec 17, 2021 11:24 AM
 
Environment: fabric release-2.2 My chaincode named vulnerable is as follows: When I invoke helloworld directly, it gives me responce "helloworld", everything works fine. But when I invoke invokeChaincode method, it gives me and chaincode ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
Environment: fabric release-2.2
My chaincode named vulnerable is as follows:


When I invoke helloworld directly, it gives me responce "helloworld", everything works fine.

But when I invoke invokeChaincode method, it gives me



and chaincode docker container logging is as follows:



It seems like
(1) the statement System.out.printf("\n%s\n", chaincodeName) works fine.
(2) org.hyperledger.fabric.shim.impl.InvocationStubImpl.invokeChaincode also finds the registered method helloworld, but it encountered another exception half way the invocation.

Does anyone met this problem before?
Thanks in advance.
 

Unless stated otherwise above:

IBM United Kingdom Limited - Registered in England and Wales with number 741598.

Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



BigBang019
 

Thanks for your attention: https://github.com/hyperledger/fabric-chaincode-java/issues/218


David Faulstich Diniz Reis
 

Hi!

The chaincode has a unique identifier in the network when it is running. If a chaincode calls itself (another function) using invokeChaincode method, an error will occur.  You have to call the function directly without using invokeChaincode method. 

If a chaincode invokes another chaincode in the same channel, both calls will have their write sets appended to the transaction.

If a chaincode invokes another chaincode in another channel, it will be considered a query and no changes will be applied to the second chaincode state.

Best regards.

David




Em sex., 17 de dez. de 2021 às 08:24, BigBang019 <zhuxy0000@...> escreveu:

Environment: fabric release-2.2
My chaincode named vulnerable is as follows:


When I invoke helloworld directly, it gives me responce "helloworld", everything works fine.

But when I invoke invokeChaincode method, it gives me



and chaincode docker container logging is as follows:



It seems like
(1) the statement System.out.printf("\n%s\n", chaincodeName) works fine.
(2) org.hyperledger.fabric.shim.impl.InvocationStubImpl.invokeChaincode also finds the registered method helloworld, but it encountered another exception half way the invocation.

Does anyone met this problem before?
Thanks in advance.




BigBang019
 

Thank you guys so much, it's really helpful!