简体   繁体   English

是否可以从Hyperledger Composer脚本文件访问GO lang链码

[英]Is it possible to access a GO lang chaincode from Hyperledger Composer script file

This might seem like a weird question . 这似乎是一个奇怪的问题。 But i want to know if it is possible to access a GO language chaincode installed in the peers from Composer script file . 但是我想知道是否可以从Composer脚本文件访问安装在对等方中GO语言链代码。

That is in script.js file of the BNA file is it possible to access the GO Lang chaincode installed in the peers from Hyperledger Fabric side . 那就是在BNA文件的script.js文件中,可以从Hyperledger Fabric端访问安装在对等方中的GO Lang链码。

I want to invoke a chaincode 'mycc' from the script.js file and try to call 'mycc' functions from Composer 我想从script.js文件中调用链码“ mycc”,并尝试从Composer中调用“ mycc”功能

Any suggestions? 有什么建议么? Also an example would be good . 另外一个例子将是很好的。 Thanks ! 谢谢 !

It is possible to invoke another chaincode from a Composer transaction script. 可以从Composer事务脚本中调用另一个链码。 You would need to use the getNativeAPI() function. 您将需要使用getNativeAPI()函数。 It is introduced in the Composer documentation halfway down in this document where I think the example uses the native api to access the 'current' network (chaincode). 它在本文档中的Composer文档中进行了介绍 ,我认为该示例使用本机api访问“当前”网络(链码)。

There is an additional example in this tutorial where the getNativeAPI().invokeChaincode method is used to connect to a different Business Network. 本教程中还有一个示例,其中使用getNativeAPI().invokeChaincode方法连接到其他业务网络。

I have not seen other examples, but this should work for connecting to other chaincodes. 我没有看到其他示例,但这对于连接其他链码应该有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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