You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/run-node/interact-node.md
+4-15Lines changed: 4 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ Since the code generation library largely depends on your own tech stack, we wil
60
60
61
61
### grpcurl
62
62
63
-
[grpcurl])https://github.com/fullstorydev/grpcurl is like `curl` 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.
63
+
[grpcurl](https://github.com/fullstorydev/grpcurl) is like `curl` 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.
64
64
65
65
Assuming you have a local node running (either a localnet, or connected a live network), you should be able to run the following command to list the Protobuf services available (you can replace `localhost:9000` by the gRPC server endpoint of another node, which is configured under the `grpc.address` field inside [`app.toml`](../run-node/run-node.md#configuring-the-node-using-apptoml)):
66
66
@@ -70,27 +70,19 @@ grpcurl -plaintext localhost:9090 list
70
70
71
71
You should see a list of gRPC services, like `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.
72
72
73
-
In the Cosmos SDK, we use [gogoprotobuf](https://github.com/gogo/protobuf) for code generation, and [grpc-go](https://github.com/grpc/grpc-go) for creating the gRPC server. Unfortunately, these two don't play well together, and more in-depth reflection (such as using grpcurl's `describe`) is not possible. See [this issue](https://github.com/grpc/grpc-go/issues/1873) for more info.
74
-
75
-
Instead, we need to manually pass the reference to relevant `.proto` files. For example:
73
+
In order to get a description of the service you can run the following command:
76
74
77
75
```bash
78
76
grpcurl \
79
-
-import-path ./proto \ # Import these proto files too
80
-
-import-path ./third_party/proto \ # Import these proto files too
81
-
-proto ./proto/cosmos/bank/v1beta1/query.proto \ # That's the proto file with the description of your service
82
77
localhost:9090 \
83
78
describe cosmos.bank.v1beta1.Query # Service we want to inspect
84
79
```
85
80
86
-
Once the Protobuf definitions are given, making a gRPC query is then straightforward, by calling the correct `Query` service RPC method, and by passing the request argument as data (`-d` flag):
81
+
It's also possible to execute an RPC call to query the node for information:
87
82
88
83
```bash
89
84
grpcurl \
90
85
-plaintext
91
-
-import-path ./proto \
92
-
-import-path ./third_party/proto \
93
-
-proto ./proto/cosmos/bank/v1beta1/query.proto \
94
86
-d '{"address":"$MY_VALIDATOR"}' \
95
87
localhost:9090 \
96
88
cosmos.bank.v1beta1.Query/AllBalances
@@ -104,10 +96,7 @@ You may also query for historical data by passing some [gRPC metadata](https://g
0 commit comments