我得到无法注册用户user1:错误:尝试在Hyperledger Fabric网络中注册用户时,公共连接配置文件缺少此客户端的组织和证书颁发机构。我正在使用fabcar示例。我可以注册管理员。
$ ts-node src/enrollAdmin.ts
Wallet path: /Users/<home>/ws/hlf/fabcar-api/wallet
Successfully enrolled admin user "admin" and imported it into the wallet
当我尝试注册新用户时:
$ ts-node src/registerUser.ts
Wallet path: /Users/<home>/ws/hlf/fabcar-api/wallet
Failed to register user user1: Error: Common connection profile is missing this client's organization and certificate authority
在遵循sample connection profile和Common connection profile missing error while adding user for organization之后,我构建了我的网络连接配置文件:
{
"name": "fabcar-network",
"version": "1.0.0",
"client": {
"tlsEnable": false,
"organization": "Org1",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
},
"orderer": "300"
}
}
},
"channels": {
"public-channel": {
"orderers": [
"ord1-hlf-ord.orderers.svc.cluster.local"
],
"peers": {
"peer0-hlf-peer.org1.svc.cluster.local": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true,
"discover": true
},
"peer0-hlf-peer.org2.svc.cluster.local": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true,
"discover": true
},
"peer0-hlf-peer.org3.svc.cluster.local": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true,
"discover": true
}
}
}
},
"organizations": {
"Org1": {
"mspid": "Org1MSP",
"peers": [
"peer0-hlf-peer.org1.svc.cluster.local"
],
"certificateAuthorities": [
"ca.org1.svc.cluster.local"
],
"adminPrivateKey": {
"path": "../crypto-config/peerOrganizations/org1.svc.cluster.local/users/Admin@org1.svc.cluster.local/msp/keystore/13d6b4ac07ce51716e94cb1139cfd2807307a8b908768e3297a7fedac0e08e5e_sk"
},
" signedCert": {
"path": "../crypto-config/peerOrganizations/org2.svc.cluster.local/users/Admin@org2.svc.cluster.local/msp/signcerts/Admin@org2.svc.cluster.local-cert.pem"
}
},
"Org2": {
"mspid": "Org2MSP",
"peers": [
"peer0-hlf-peer.org2.svc.cluster.local"
],
"certificateAuthorities": [
"ca.org2.svc.cluster.local"
],
"adminPrivateKey": {
"path": "../crypto-config/peerOrganizations/org2.svc.cluster.local/users/Admin@org2.svc.cluster.local/msp/keystore/98299178c3957967864dbe555e7acf677d329cdce3d7593a5f750bb3f002afb2_sk"
},
" signedCert": {
"path": "../crypto-config/peerOrganizations/org2.svc.cluster.local/users/Admin@org2.svc.cluster.local/msp/signcerts/Admin@org2.svc.cluster.local-cert.pem"
}
},
"Org3": {
"mspid": "Org3MSP",
"peers": [
"peer0-hlf-peer.org3.svc.cluster.local"
],
"certificateAuthorities": [
"ca.org3.svc.cluster.local"
],
"adminPrivateKey": {
"path": "../crypto-config/peerOrganizations/org3.svc.cluster.local/users/Admin@org3.svc.cluster.local/msp/keystore/4f62c790b545b1ff10f42a2ceb629f3f2f1068fe5ea1c78255d6332ed3f4a465_sk"
},
" signedCert": {
"path": "../crypto-config/peerOrganizations/org3.svc.cluster.local/users/Admin@org3.svc.cluster.local/msp/signcerts/Admin@org3.svc.cluster.local-cert.pem"
}
}
},
"orderers": {
"ord1-hlf-ord.orderers.svc.cluster.local": {
"url": "grpc://0.0.0.0:7050"
}
},
"peers": {
"peer0-hlf-peer.org1.svc.cluster.local": {
"url": "grpc://0.0.0.0:7051",
"events": "grpc://0.0.0.0:7053"
},
"peer0-hlf-peer.org2.svc.cluster.local": {
"url": "grpc://0.0.0.0:8051",
"events": "grpc://0.0.0.0:8053"
},
"peer0-hlf-peer.org3.svc.cluster.local": {
"url": "grpc://0.0.0.0:9051",
"events": "grpc://0.0.0.0:9053"
}
},
"certificateAuthorities": {
"ca.org1.svc.cluster.local": {
"url": "http://0.0.0.0:7054",
"httpOptions": {
"verify": false
},
"tlsCACerts": {
"path": ""
},
"caName": "ca.org1.svc.cluster.local",
"registrar": [
{
"enrollId": "admin",
"enrollSecret": "adminpw"
}
]
},
"ca.org2.svc.cluster.local": {
"url": "http://0.0.0.0:8054",
"httpOptions": {
"verify": false
},
"tlsCACerts": {
"path": ""
},
"caName": "ca.org2.svc.cluster.local",
"registrar": [
{
"enrollId": "admin",
"enrollSecret": "adminpw"
}
]
},
"ca.org3.svc.cluster.local": {
"url": "http://0.0.0.0:9054",
"httpOptions": {
"verify": false
},
"tlsCACerts": {
"path": ""
},
"caName": "ca.org3.svc.cluster.local",
"registrar": [
{
"enrollId": "admin",
"enrollSecret": "adminpw"
}
]
}
}
}
尽管可能无关紧要,但是网络正在使用稳定的头盔图在Kubernetes上运行。我可以从CLI执行所有操作。
答案 0 :(得分:0)
对于连接配置文件,在"organizations"
下,您可以尝试使用"org3"
而不是"Org3"
。
我仍然不知道为什么o
的{{1}}小写,而"org3"
和O
的{{1}}大写。 / p>
碰巧它对我有用!