Massa GRPC API
Through the API documentation, you can find out how to make calls and handle responses.
gRPC Public API: used for blockchain interactions. Default port: 33037 e.g. grpc://localhost:33037
Find the complete Massa gRPC specification here.
Not
We provide the generated API and Commons documentation which documents every available message and method in gRPC Massa services.
Uyarı
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.
Massa proto rs: is a Rust library which contains generated code from Massa protobuf files. See massa-proto-rs.
Code generation
Step 1: Clone `massa-proto` repository
git clone https://github.com/massalabs/massa-proto.git
Not
If you are using an older version of Massa node, please use the corresponding commit hash to your node version.
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
Add the following content to
buf.work.yml:
version: v1
directories:
- proto/apis
- proto/commons
- proto/third_party
By specifying the directories in the configuration file, Buf knows which .proto files to include in the build process.
Create a file called
buf.gen.ymland add the following content:
version: v1
managed:
enabled: true
plugins:
- remote: buf.build/community/timostamm-protobuf-ts:v2.9.0
out: gen/ts
The configuration above tells Buf to use the official timostamm-protobuf-ts plugin to generate gRPC client and classes in TypeScript.
Not
The complete list of official Buf plugins. For each language, there are multiple plugins available. Please refer to the documentation of each plugin if it’s not supported.
Step 4: Generate gRPC client/classes in TypeScript
Launch the code generation:
buf generate
Install the required dependencies for the generated code to your project:
npm install @protobuf-ts/runtime@^2.9.0 @protobuf-ts/runtime-rpc@^2.9.0