gRPCurl is a useful tool for interacting with gRPC servers.
The are significant differences between REST and gRPC:
- gRPC uses HTTP2 (REST generally uses HTTP1.1)
- gRPC requires a schema (generally a protobuf)
If the gRPC service supports reflection, you'll be able to grpcurl [host:port] list
. If it doesn't, you'll need to grab a copy of the schema (protobuf) so that gRPCurl can interact with the server.
I was unable to connect to access-mainnet-beta.onflow.org:9000
but:
grpcurl \
-plaintext \
access.devnet.nodes.onflow.org:9000 \
list
Failed to list services: server does not support the reflection API
So, it appears you'll need to grab the protos and pass these to grpcurl
.
And:
# list
grpcurl flow-testnet.g.alchemy.com:443 list
flow.access.AccessAPI
# list methods for the above service
grpcurl flow-testnet.g.alchemy.com:443 list flow.access.AccessAPI
flow.access.AccessAPI.ExecuteScriptAtBlockHeight
flow.access.AccessAPI.ExecuteScriptAtBlockID
flow.access.AccessAPI.ExecuteScriptAtLatestBlock
flow.access.AccessAPI.GetAccount
flow.access.AccessAPI.GetAccountAtBlockHeight
flow.access.AccessAPI.GetAccountAtLatestBlock
flow.access.AccessAPI.GetBlockByHeight
flow.access.AccessAPI.GetBlockByID
flow.access.AccessAPI.GetBlockHeaderByHeight
flow.access.AccessAPI.GetBlockHeaderByID
flow.access.AccessAPI.GetCollectionByID
flow.access.AccessAPI.GetEventsForBlockIDs
flow.access.AccessAPI.GetEventsForHeightRange
flow.access.AccessAPI.GetLatestBlock
flow.access.AccessAPI.GetLatestBlockHeader
flow.access.AccessAPI.GetLatestProtocolStateSnapshot
flow.access.AccessAPI.GetNetworkParameters
flow.access.AccessAPI.GetTransaction
flow.access.AccessAPI.GetTransactionResult
flow.access.AccessAPI.Ping
flow.access.AccessAPI.SendTransaction
# describe `Ping`
grpcurl flow-testnet.g.alchemy.com:443 describe flow.access.AccessAPI.Ping
flow.access.AccessAPI.Ping is a method:
rpc Ping ( .flow.access.PingRequest ) returns ( .flow.access.PingResponse );
# invoke `Ping`
grpcurl flow-testnet.g.alchemy.com:443 flow.access.AccessAPI.Ping
ERROR:
Code: Unauthenticated
Message: Missing api_key in metadata
I guess you need an API key to proceed.