#blockchain #protobuf #rust-sdk #grpc

protochain-api

Protochain API Rust SDK - Generated protobuf and gRPC code

2 releases (1 stable)

1.0.0 Feb 12, 2026
0.1.0 Feb 12, 2026

#1 in #rust-sdk

34 downloads per month

MIT license

235KB
5K SLoC

Protochain API Rust SDK

This crate provides Rust bindings for the Protochain API protocol buffers.

Generated Code

All code in src/ (except lib.rs) is auto-generated from the protobuf definitions in api/proto/.

To regenerate the code:

./dev/tool.sh generate --project=api

Usage

Add this to your Cargo.toml:

[dependencies]
protochain-api = { path = "../path/to/api/rust" }

Then use in your code:

use protochain_api::{Transaction, SubmitTransactionRequest};
use protochain_api::service_client::ServiceClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut client = ServiceClient::connect("http://[::1]:50051").await?;
    
    let request = tonic::Request::new(SubmitTransactionRequest {
        transaction: Some(Transaction {
            hash: "example_hash".to_string(),
            data: "example_data".to_string(),
        }),
    });
    
    let response = client.submit_transaction(request).await?;
    println!("Response: {:?}", response);
    
    Ok(())
}

Dependencies

~7–11MB
~117K SLoC