# gRPC Server
gRPC Server is a node extension that allows running gRPC services on a node. gRPC interaface can be used to run apps on your own node.
gRPC services provide information about:
# Client Generation
The clients generated from proto files are used to connect to gRPC services.
Example of usage of gRPC client generated from .proto files: Retrieving blocks in C#
To create a TypeScript or JavaScript client, we recommend using the node-api-grpc library.
# gRPC Server Installation
The gRPC Server extension can be installed on the node by two methods: using DEB package or TGZ archive.
# Installation via DEB Package
Download the latest version of the DEB package from the Releases page (Assets section).
The extension package name is as follows:
• for Mainnet
grpc-server_{version number}_all.deb
• for Testnet
grpc-server-testnet_{version number}_all.deb
• for Stagenet
grpc-server-stagenet_{version number}_all.deb
Install the package.
Mainnet:
sudo dpkg -i grpc-server_{version number}_all.deb
Testnet:
sudo dpkg -i grpc-server-testnet_{version number}_all.deb
Stagenet:
sudo dpkg -i grpc-server-stagenet_{version number}_all.deb
Edit the node configuration file as described in the Node Configuration article. For Mainnet, the configuration file is located at
/etc/waves/waves.conf
, for Testnet at/etc/waves-testnet/waves.conf
, for Stagenet at/etc/waves-stagenet/waves.conf
.3.1. Add gRPC Server to the
waves.extensions
section:waves { ... extensions = [ com.wavesplatform.api.grpc.GRPCServerExtension ] }
3.2. If you want to change the port for client connection (default is 6870), add the following setting:
waves { ... grpc { port = 6877 # Specify port }
Restart the node.
Mainnet:
sudo systemctl restart waves
Testnet:
sudo systemctl restart waves-testnet
Stagenet:
sudo systemctl restart waves-testnet
# Installation via TGZ Archive
Download the TGZ archive with the extension from the Releases page (Assets section) on Github.
The TGZ archive name is as follows:
• for Mainnet
grpc-server-{version number}.tgz
• for Testnet
grpc-server-testnet-{version number}.tgz
• for Stagenet
grpc-server-stagenet-{version number}.tgz
Unpack the archive to the directory containing node's JAR-file.
Create a new configuration file or open the existing one, see the Node Configuration article.
3.1. Add gRPC Server to the
waves.extensions
section:waves { ... extensions = [ com.wavesplatform.api.grpc.GRPCServerExtension ] }
3.2. If you want to change the port for client connection (default is 6870), add the following setting:
waves { ... grpc { port = 6877 # Specify port }
Run the command:
Mainnet
java -cp 'waves-all-{version number}.jar:grpc-server-{version number}/lib/*' com.wavesplatform.Application {configuration file name}.conf
Testnet:
java -cp 'waves-all-{version number}.jar:grpc-server-testnet-{version number}/lib/*' com.wavesplatform.Application {configuration file name}.conf
Stagenet:
java -cp 'waves-all-{version number}.jar:grpc-server-stagenet-{version number}/lib/*' com.wavesplatform.Application {configuration file name}.conf
On Windows, use
;
instead of:
, for example:java -cp 'waves-all-{version number}.jar;grpc-server-{version number}/lib/*' com.wavesplatform.Application {configuration file name}.conf
# gRPC on Public Nodes
You can connect to the public gRPC services provided by the Waves team for getting acquainted:
- Mainnet: https://nodes.wavesnodes.com:6870
- Testnet: https://nodes-testnet.wavesnodes.com:6870
- Stagenet: https://nodes-stagenet.wavesnodes.com:6870
Limitations:
- The maximum number of simultaneous requests per IP address is 5.
- The maximum number of the requests per second (r/s) from IP address is 20.
# Debugging with gRPCurl
gRPCurl is a command-line tool that lets you interact with gRPC servers. It's basically curl
for gRPC servers.
You can use gRPCurl to make requests to the gRPC Server of the Waves node and get data in a command-line interface, without writing any code:
Install gRPCurl, see Installation.
Clone or download the repository with proto files.
Specify request parameters:
•
plaintext
•
-proto
: path to the proto file that contains the definition of service to request,•
--import-path
- path to the directory containing all the proto files,•
-d
— request arguments in JSON,• the node address and the gRPC Server port,
• the service and function to invoke.
⚠️ All byte arrays in JSON must be base64 encoded, including addresses, asset IDs, and other data that are base58 encoded in the Node REST API. The response also contains base64 encoded data.
Request example:
grpcurl -v -plaintext \
-proto /home/projects/waves/protobuf-schemas/proto/waves/node/grpc/assets_api.proto \
-import-path /home/projects/waves/protobuf-schemas/proto \
-d '{ "asset_id": "PFrWEj4csGLWzPmlsjs/xccLxChfBm27mGoHZtYJSzU=" }' \
nodes.wavesnodes.com:6870 waves.node.grpc.AssetsApi/GetInfo