0

请帮助我创建频道。在节点 sdk 我有

// // extract the channel config bytes from the envelope to be signed
const envelope = fs.readFileSync(`${channelConfigPath+channelName}.tx`),
 channelConfig = client.extractChannelConfig(envelope),
 signature     = client.signChannelConfig(channelConfig);

 // get an admin based transactionID
 // send to orderer
 const request = {
   config: channelConfig,
   signatures: [signature],
   name: channelName,
   txId: client.newTransactionID(true)
 };

client.createChannel(request)

但我得到错误docker logs orderer.example.com

-2018-06-26 14:41:04.631 UTC [policies] Evaluate -> DEBU 120 Signature set  did not satisfy policy /Channel/Application/Gov1MSP/Admins
-2018-06-26 14:41:04.631 UTC [policies] Evaluate -> DEBU 121 == Done Evaluating *cauthdsl.policy Policy /Channel/Application/Gov1MSP/
-2018-06-26 14:41:04.631 UTC [policies] func1 -> DEBU 122 Evaluation Failed: Only 0 policies were satisfied, but needed 1 of [ Gov1MSP.Admins ]
-2018-06-26 14:41:04.631 UTC [policies] Evaluate -> DEBU 123 Signature set did not satisfy policy /Channel/Application/ChannelCreationPolicy
-2018-06-26 14:41:04.631 UTC [policies] Evaluate -> DEBU 124 == Done Evaluating *policies.implicitMetaPolicy Policy /Channel/Application/ChannelCreationPolicy
-2018-06-26 14:41:04.631 UTC [orderer/common/broadcast] Handle -> WARN 125 [channel: usachannel] Rejecting broadcast of config message from 172.18.0.1:46638 because of error: Error authorizing update: Error validating DeltaSet: Policy for [Groups] /Channel/Application not satisfied: Failed to reach implicit threshold of 1 sub-policies, required 1 remaining
-2018-06-26 14:41:04.631 UTC [orderer/common/server] func1 -> DEBU 126 Closing Broadcast stream

那么,我应该如何/etc/hyperledger/msp/users/Admin@org1.example.com/msp在 Fabric Node SDK 中设置证书?

PS 上面的证书我可以使用创建频道peer channel create

4

1 回答 1

3

我为fabric-client 和fabric-ca-client 使用“^1.2.0”版本。

要设置客户端的签名身份,您需要使用setAdminSigningIdentity方法。

对于私钥,我使用了 msp 文件夹的 keystore 目录中的私钥。就我而言,它是:“crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore”。对于证书,我使用了相同的文件夹,但文件“signcerts/Admin@org1.example.com-cert.pem”。

然后您需要使用 newTransaction(true),因为如果您不这样做,它将使用您不想要的 userContext,因为您提供了 adminSigningIdentity。

于 2018-07-23T14:57:47.263 回答