gRPC is a simple protocol built on top of HTTP/2. The typical way of working with gRPC is to use the protoc
compiler
to generate stubs for each method in a gRPC service. The stubs take pre-parsed protobuf objects and return protobuf
objects and all serialization is handled by the framework. This doesn't work all that well for us.
When we receive a gRPC request for paid queries or for any transaction, we need the raw bytes to send to the hashgraph
platform for consensus. We would like to get the raw bytes from the gRPC request, not pre-parsed objects. We also have
our own highly tuned protobuf parsing library that generates nearly no garbage, and we would like to use it for parsing
rather than the code generated by protoc
. For these reasons, the built-in gRPC frameworks are of little to use to us.
It turns out that gRPC is an extremely simple API built on top of HTTP/2, and we can therefore have our own simple gRPC framework built on top of an HTTP/2 server (like Netty) and get everything we want.
NEXT: Records