Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hyperledger fabric 如何使用fabric sdk初始化fabric CA_Hyperledger Fabric_Hyperledger - Fatal编程技术网

Hyperledger fabric 如何使用fabric sdk初始化fabric CA

Hyperledger fabric 如何使用fabric sdk初始化fabric CA,hyperledger-fabric,hyperledger,Hyperledger Fabric,Hyperledger,我在初始化fabric sdk和fabric ca时遇到困难 我正在使用默认配置运行fabric CA服务器,为此我使用以下代码 当我使用下面的代码时,它将生成带有数据库的服务器配置文件 ./bin/fabric-ca-server start -b admin:adminpwd --home ~/ca 接下来我使用下面的代码注册管理员,这将在客户端和密钥中生成管理员yaml文件 ./bin/fabric-ca-client enroll admin:adminpws localhos

我在初始化fabric sdk和fabric ca时遇到困难

  • 我正在使用默认配置运行fabric CA服务器,为此我使用以下代码

    当我使用下面的代码时,它将生成带有数据库的服务器配置文件

    ./bin/fabric-ca-server start -b  admin:adminpwd --home ~/ca  
    
  • 接下来我使用下面的代码注册管理员,这将在客户端和密钥中生成管理员yaml文件

    ./bin/fabric-ca-client enroll admin:adminpws localhost:7054
    
    我想使用创建客户端上下文

    我的问题是

    要在fabric sdk中创建客户端上下文,需要加载哪个配置文件 因为我想打电话

    func New(clientProvider context.ClientProvider, opts ...ClientOption) (*Client, error)
    
    这给了我错误,请建议我

    failed to create msp client organization is not provided
    

  • 请遵循我的步骤,NodeJS SDK

     const caEndPoint = "https://localhost:7054"
     const caName = "ca-org1"
     let tlsOptions = {
        trustedRoots: [],
        verify: false
      };
    const fabricCAServices = require('fabric-ca-client');
    const caService = new fabricCAServices(caEndPoint, tlsOptions, caName);
    
    您可以使用CaseService调用可用的方法

    • 报名
    • 加入
    • 新身份服务
    • 新证书服务
    登记新身份

    const identityService = caService.newIdentityService();
        let registerObject = {
          enrollmentID: enrollmentId,
          type: type,
          affiliation: userOrg,
          maxEnrollments: maxEnrollments || 1,
          attrs: attributes,
          caname: caName
        }
    const response = await identityService.create(registerObject, admin_user);
    

    谢谢重播!,我正在运行go,我面临一些与fabric sdk go相关的问题,我需要创建上下文,但我不确定需要使用哪个配置文件来加载/运行fabric sdk。我正在启动fabric ca server,它还将创建fabric-ca-config.yaml我是否需要加载此配置文件来创建上下文或任何其他配置文件。