【问题标题】:Fabric SDK unable to initialize cryptosuite configFabric SDK 无法初始化加密套件配置
【发布时间】:2019-03-31 02:53:08
【问题描述】:

我正在 IBM Cloud Blockchain Platform 2.0 上运行业务网络。我从平台控制台上的实例化智能合约部分下载了一个连接配置文件,并尝试使用 Fabric SDK for Go 进行连接,但我遇到了错误。

这是我当前的相关代码,在 main 下

configOpts := fabricConfig.FromFile("./profiles/flex.json")
fabSDK, err := fabsdk.New(configOpts)
if err != nil {
    entry.WithError(err).Fatal("Error setting up Fabric SDK")
}
defer fabSDK.Close()

预期:连接到业务网络实例

实际:我收到一个错误

FATA[0000] Error setting up Fabric SDK env=DEV 
error="failed to initialize configuration: unable to initialize cryptosuite using crypto suite config: 
failed to initialize crypto suite: Unsupported BCCSP Provider: "

【问题讨论】:

    标签: go hyperledger-fabric


    【解决方案1】:

    我将“cryptoconfig”路径添加到客户端。

    BCCSP 是可选的,您可以删除。

    我添加了示例配置,请参见下文。

    Github go-SDK config.yaml的更多详细配置

    {
    "name": "first-network-org1",
    "version": "1.0.0",
    "client": {
        "organization": "Org1",
        "logging": {
            "level": "info"
        },
        "cryptoconfig": {
            "path": "crypto-config"
        },
        "credentialStore": {
            "path": "/tmp/keystore",
            "cryptoStore": {
                "path": "/tmp/msp"
            }
        },
        "connection": {
            "timeout": {
                "peer": {
                    "endorser": "300"
                }
            }
        }
    },
    "channels": {
        "mychannel": {
            "peers": {
                "peer0.org1.example.com": {}
            }
        }
    },
    "orderers": {
        "orderer.example.com": {
            "url": "orderer.example.com:7050",
            "grpcOptions": {
                "ssl-target-name-override": "orderer.example.com",
                "keep-alive-time": "60s",
                "keep-alive-timeout": "60s",
                "keep-alive-permit": false,
                "fail-fast": false,
                "allow-insecure": false
            },
            "tlsCACerts": {
                "path": "crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem"
            }
        }
    },
    "organizations": {
        "Org1": {
            "mspid": "Org1MSP",
            "cryptoPath": "crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp",
            "peers": [
                "peer0.org1.example.com",
                "peer1.org1.example.com"
            ],
            "certificateAuthorities": [
                "ca.org1.example.com"
            ]
        }
    },
    "peers": {
        "peer0.org1.example.com": {
            "url": "grpcs://localhost:7051",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer0.org1.example.com"
            }
        },
        "peer1.org1.example.com": {
            "url": "grpcs://localhost:8051",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer1.org1.example.com"
            }
        }
    },
    "certificateAuthorities": {
        "ca.org1.example.com": {
            "url": "https://localhost:7054",
            "caName": "ca-org1",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "httpOptions": {
                "verify": false
            }
        }
    }
    

    }

    【讨论】:

    • 如果您自己部署网络,IBM 区块链平台不会提供您获得的加密配置文件,这就是问题所在
    • 我同意你的看法。我解决了很多解决配置文件的问题。现在我对 GO SDK 的尝试太过分了。我无法从 Github 运行 go test,我不知道为什么。
    猜你喜欢
    • 1970-01-01
    • 2017-09-03
    • 1970-01-01
    • 1970-01-01
    • 2018-02-17
    • 2019-09-25
    • 1970-01-01
    • 1970-01-01
    • 2018-01-11
    相关资源
    最近更新 更多