如何将数据库钱包创建到 hyperledger-fabric 中?

How to create Database wallet into hyperledger-fabric?

我需要使用数据库 (mysql/mongodb) 而不是文件来将用户的钱包身份存储到 hyperledger-fabric。

Fabric 客户端 SDK 仅提供 file-system 和 CouchDB 钱包存储 out-of-the-box 因此您有两个选择:

  1. 编写您自己的 WalletStore 实现,用于存储和检索来自 MongoDB 的数据。
  2. 根据需要存储客户端凭据(在您选择的数据库或任何其他位置),然后将它们作为 X509Identity object in the identity field of the connection options.
  3. 直接传递给 SDK

查看此 tutorial and the WalletStore documentation for details of how to use a custom WalletStore implementation. You might also refer to the CouchDB store implementation 作为参考。

请注意,对于 Hyperledger Fabric v2.4 及更高版本,Fabric Gateway client API is the preferred API for Node, Java and Go applications. The model used with this API is for you to store client credentials however you chose (which could still be in a wallet) and then just supply an identity and signing implementation using those credentials to the API on connection. See the migration guide 了解详细信息。