认可政策

Endorsing Policy

在 Hyperledger Fabric 中,背书策略是在链代码实例化时使用 -P 指定的。

除了在文件中指定使用 CLI 编写背书策略并 link 在链代码实例化时指定该文件而不是使用 cli 之外,还有其他方法吗?

提前致谢。

是的,您可以通过 Hyperledger 之一安装链代码 Fabric SDKs and specify the policy as a JSON object. Here's an example from the Node SDK:

背书政策:"Signed by any member from one of the organizations"

{
  identities: [
    { role: { name: "member", mspId: "org1" }},
    { role: { name: "member", mspId: "org2" }}
  ],
  policy: {
    "1-of": [{ "signed-by": 0 }, { "signed-by": 1 }]
  }
}