Massa GRPC API
Through the API documentation, you can find out how to make calls and handle responses.
gRPC API: used for blockchain interactions. Default port: 33037 e.g. grpc://localhost:33037
Find the complete Massa gRPC specification here.
Note
We provide the generated API documentation which documents every available methods in gRPC Massa service.
Warning
Massa gRPC support is experimental. This API is not yet stable and may change in the future.
To enable gRPC support in your Massa node, edit file massa-node/config/config.toml
(or create it if absent) with the
following contents:
[api]
# whether to broadcast for blocks, endorsement and operations
enable_broadcast = true
[grpc]
# whether to enable gRPC
enabled = true
The complete gRPC configuration is available in node configuration .
Integrations
Postman: is a tool for software developers to create, test and debug API requests. More details can be found in Postman learning center. Find all maintained Massa Postman collections in our official workspace.
Code generation
Step 1: Download the `massa-proto` folder from GitHub
Go to the GitHub repository for massa.
Click the green
Code
button and selectDownload ZIP
to download the entire repository as a ZIP file.Extract the ZIP file to a folder on your computer.
Navigate to the
massa-proto
folder, which contains the.proto
files we’ll be using to generate gRPC clients.
Step 2: Install Buf CLI
Download the latest version of Buf CLI from the official website.
Extract the downloaded file to a folder on your computer.
Add the buf binary to your system PATH environment variable.
Step 3: Set up Buf
Create a new file called
buf.work.yml
Add the following content:
version: v1
directories:
- proto/massa/api/v1
- proto/third-party
By specifying the directories in the configuration file, Buf knows which .proto files to include in the build process.
Create another file called buf.gen.yml in the massa-proto folder.
Add the following content to
buf.gen.yml
:
version: v1
managed:
enabled: true
plugins:
- remote: buf.build/stephenh/plugins/ts-proto
out: gen/ts
opt:
- outputServices=...
- useExactTypes=...
This tells Buf to use the official ts-proto
plugin to generate gRPC client in TypeScript.
Note
The complete list of official Buf plugins.
Step 4: Generate gRPC client in TypeScript
Open a command prompt or terminal window and navigate to the
massa-proto
folder.Run the following command to generate the gRPC clients:
buf generate
This will generate the gRPC client in a new gen/ts
folder in the massa-proto
folder.
Note
More information about gRPC in developer documentation.