*.proto files into various languages. These tools allow clients to be built easily. Often, the client connection (i.e. the transport) can be plugged and replaced easily. Let’s explore a popular transport method, gRPC.
Since the code generation library largely depends on your own tech stack, we will only present two alternatives:
grpcurlfor generic debugging and testing- Programmatically via Go, Python, or TS
grpcurl
grpcurl is likecurl, but for gRPC. It is also available as a Go library, but we will use it only as a CLI command for debugging and testing purposes. Follow the instructions in the previous link to install it.
Assuming you have a local node running (either a localnet, or connected to a live network), you should be able to run the following command to list the Protobuf services available. You can replace localhost:9090 by the gRPC server endpoint of another node, which is configured under the grpc.address field inside app.toml:
cosmos.bank.v1beta1.Query. This is called reflection, which is a Protobuf endpoint returning a description of all available endpoints. Each of these represents a different Protobuf service, and each service exposes multiple RPC methods you can query against.
In order to get a description of the service, you can run the following command:
Query for historical state using grpcurl
You may also query for historical data by passing some gRPC metadata to the query: thex-cosmos-block-height metadata should contain the block to query. Using grpcurl as above, the command looks like: