我正在尝试通过 JavaScript 与同行进行交互,但我不断得到
{ Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
at Object.exports.createStatusError (/blockchain-api-js/node_modules/grpc/src/common.js:87:15)
at Object.onReceiveStatus (/blockchain-api-js/node_modules/grpc/src/client_interceptors.js:1188:28)
at InterceptingListener._callNext (/blockchain-api-js/node_modules/grpc/src/client_interceptors.js:564:42)
at InterceptingListener.onReceiveStatus (/blockchain-api-js/node_modules/grpc/src/client_interceptors.js:614:8)
at callback (/blockchain-api-js/node_modules/grpc/src/client_interceptors.js:841:24)
code: 2,
metadata: [Object],
details: 'access denied: channel [mychannel] creator org [Org1MSP]' }
我正在使用fabric-ca示例,我能够从cli和cli通过run-fabric.sh执行事务,但我似乎无法从JS执行此操作,我创建了一个新用户并设置了客户端和证书client.setTlsClientCertAndKey(cert, key);
,我什至尝试提供管理员证书和密钥,/data/orgs/org1/admin/msp/signcerts, /data/orgs/org1/admin/msp/admincerts
以及/data/orgs/org1/admin/msp/keystore
来自/data/tls/
但没有运气的管理员证书和密钥这是我使用的代码部分:
var channel = this.client.newChannel('mychannel')
let serverCert = fs.readFileSync('/data/org0-ca-chain.pem');
channel.addOrderer(
this.client.newOrderer(
config.orderers['orderer1-org0'].url,
{
pem: Buffer.from(serverCert).toString()
}
)
);
serverCert = fs.readFileSync('/data/org1-ca-chain.pem');
const peer1 = this.client.newPeer(
config.peers['peer1-org1'].url,
{
pem: Buffer.from(serverCert).toString()
}
);
channel.addPeer(peer1);
this.eventhubs = []
this.eventhubs.push(channel.newChannelEventHub(peer1));
serverCert = fs.readFileSync('/data/org2-ca-chain.pem');
const peer2 = this.client.newPeer(
config.peers['peer1-org2'].url,
{
'pem': Buffer.from(serverCert).toString()
}
);
channel.addPeer(peer2);
this.eventhubs.push(channel.newChannelEventHub(peer2));
this.channel = channel;
console.log(this.channel)
return this.channel.sendTransactionProposal(request);
我的代码或执行方式有问题吗?有人可以告诉我我做错了什么吗?我见过一些类似的问题,但这些问题发生在主要使用作曲家时,我无法用那里的答案解决我的问题,