0

我注册用户 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

通过在为组织添加用户时遵循示例连接配置文件常见连接配置文件丢失错误,我构建了我的网络连接配置文件:

{
    "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"
                }
            ]
        }
    }
}

尽管可能无关紧要,但该网络使用稳定的 helm 图表在 Kubernetes 上运行。我可以从 CLI 执行所有操作。

4

1 回答 1

0

对于连接配置文件,在 下"organizations",您可以尝试使用"org3"而不是"Org3".

我仍然无法弄清楚为什么o是小写的,"org3"O大写的"Org1""Org2"

碰巧它对我有用!

于 2019-12-14T22:14:03.467 回答