2

我在开发阶段建立了一个具有四个节点的超级账本结构网络,我想知道是否有办法在不暴露源代码(链代码)的情况下将 nodejs 链代码(用于安装)提供给生产团队,类似于java项目中的jar文件。打包链码对我有帮助吗?如果不是,我们可以直接安装chaincode而不打包,打包chaincode有什么用。

4

1 回答 1

2

无论我遇到什么(使用 Go 链码):

1) 不可以。没有源代码,无法直接安装链码二进制文件。因此,您不能循环链码二进制文件或 jar。

2) 打包不会帮你隐藏源代码。即使在一个身份签署并打包了一个链码之后,其他人也应该能够查看并将他们的签名添加到这个已经签名的包中。这用于建立链码的“所有者”,并确保链码的所有必要“所有者”已按照链码实例化策略中的定义对其进行签名。

来自文档:参考:https ://hyperledger-fabric.readthedocs.io/en/release-1.4/chaincode4noah.html#packaging

一个包包括:

a) ChaincodeDeploymentSpec or CDS
b) Instantiation policy
c) Signatures

签名用于以下目的:

a) To establish an ownership of the chaincode.
b) To allow verification of the contents of the package.
c) To allow detection of package tampering.

所以,在我看来,包装有助于:

a) Identifying the owners of the chaincode (through signatures).
b) Allowing instantiation of chaincode only when the package has necessary signatures as defined in instantiation policy. This ensures all chaincode owners have reviewed and signed the package.
于 2019-06-04T12:44:39.927 回答