Crates.io | miden-node-proto-build |
lib.rs | miden-node-proto-build |
version | 0.11.0 |
created_at | 2025-03-27 01:12:52.435504+00 |
updated_at | 2025-08-29 06:28:55.291115+00 |
description | Miden node protobuf bindings builder |
homepage | https://miden.xyz |
repository | https://github.com/0xMiden/miden-node |
max_upload_size | |
id | 1607391 |
size | 79,976 |
This crate contains Protobuf files defining the Miden node gRPC API. The files are exposed via FileDescriptorSets to simplify generation of Rust bindings.
It also contains the raw Protobuf files in the proto directory to be used for binding generation in other languages.
To generate Miden node gRPC bindings in Rust, you'll need to add a build.rs
file to your project. The example below
generates the RPC component bindings and writes them into the src/generated
directory of your project.
use std::{fs, path::PathBuf, env};
use miden_node_proto_build::rpc_api_descriptor;
fn main() {
let crate_root: PathBuf = env::var("CARGO_MANIFEST_DIR").unwrap().into();
let dst_dir = crate_root.join("src").join("generated");
let _ = fs::remove_dir_all(&dst_dir);
fs::create_dir(&dst_dir).unwrap();
let file_descriptors = rpc_api_descriptor();
let mut prost_config = prost_build::Config::new();
prost_config.skip_debug(["AccountId", "Digest"]);
tonic_build::configure()
.out_dir(dst_dir)
.build_server(false) // this setting generates only the client side of the rpc api
.compile_fds_with_config(prost_config, file_descriptors)
.context("compiling protobufs")?;
}
To connect to the official RPC API, you need to enable TLS in your gRPC client. The easiest way to do this is by
enabling the tls-native-roots
feature in the tonic
crate. This ensures that your client automatically uses
system-native certificate roots without requiring additional configuration.
internal
: exposes Protobuf file descriptors for the internal components of the node. This is not intended for
general use.This project is MIT licensed.