[英]Why does connection profile in Hyperledger Fabric has gRPC URL?
In the client applications (using Node/Go) we provide connection profile to identify the endpoints of endorsers.在客户端应用程序(使用 Node/Go)中,我们提供连接配置文件来识别背书者的端点。
There we specify endpoint of peer in terms of grpc://localhost:port but actually gRPC runs on HTTP2 right?在那里我们根据 grpc://localhost:port 指定对等点的端点,但实际上 gRPC 在 HTTP2 上运行,对吗?
Then does the Fabric SDK convert the endpoint to a HTTP url or is it handled by fabric peer code?那么 Fabric SDK 是将端点转换为 HTTP url 还是由 Fabric 对等代码处理?
I mean how is grpc endpoint converted to an HTTP one?我的意思是 grpc 端点如何转换为 HTTP 端点?
Or does the peer expose a grpc endpoint itself?或者对等方是否公开了 grpc 端点本身? If yes, how?
如果是,如何?
For communicating between the front-end and the Hyperledger Fabric Layer, we have two ways, one to use the gRPC calls OR use one of the SDKs provided by the Hyperledger Community.对于前端和 Hyperledger Fabric Layer 之间的通信,我们有两种方式,一种使用 gRPC 调用或使用 Hyperledger Community 提供的 SDK 之一。 There are no REST API calls after v1.0, as opposed to v0.6, which had REST API calls, where you could use the IP Addresses to fire transactions to the Orderer, then Consensus.
v1.0 之后没有 REST API 调用,而 v0.6 具有 REST API 调用,您可以在其中使用 IP 地址将交易发送到 Orderer,然后是 Consensus。
Making it limited to gRPC and SDKs improves the design and connection security issues, which is vital for the Blockchain to work.使其仅限于 gRPC 和 SDK 改善了设计和连接安全问题,这对于区块链的工作至关重要。 gRPC is the HTTPS 2.0 protocol for communication which is faster and has improved security features over HTTPS 1.1.
gRPC 是用于通信的 HTTPS 2.0 协议,它比 HTTPS 1.1 更快并且具有改进的安全功能。 SDKs use gRPC calls to communicate to the network.
SDK 使用 gRPC 调用与网络通信。 So, putting it plainly, if you need to communicate with the Network, you need to use gRPC calls only
所以,说白了,如果你需要和 Network 通信,你只需要使用 gRPC 调用
As suggested by @david_k in comments above, the URL in connection profile is used for extracting the host and port number after identifying whether it is grpc or grpcs (over SSL) call.正如@david_k 在上面的评论中所建议的,连接配置文件中的 URL 用于在识别是grpc还是grpcs (通过 SSL)调用后提取主机和端口号。
To verify:验证:
fabcar
sample and install the node modules.fabcar
示例并安装节点模块。Endpoint.js
file in the fabric-common
node module inside the lib
directory.lib
目录中fabric-common
节点模块中的Endpoint.js
文件。 Edit the line corresponding to line 44 here .first-network
directory (the network used by fabcar sample) to edit the connection profile.first-network
目录(fabcar 示例使用的网络)编辑连接配置文件。 Replace the grpcs in the peer and orderer URL corresponding to the edit you made to the Endpoint.js
file in node modules.Endpoint.js
文件所做的编辑相对应的 peer 和orderer URL 中的grpcs 。javascript
directory and fetch the wallet identities.javascript
目录并获取钱包身份。invoke.js
to read the new connection profile.invoke.js
以读取新的连接配置文件。 Therefore, we can identify that only the host and port are fetched from the URL to be used for making a grpc/grpcs call to the fabric network.因此,我们可以确定只有主机和端口是从 URL 中获取的,用于对结构网络进行grpc/grpcs调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.