| Crates.io | rose-grpc-proto |
| lib.rs | rose-grpc-proto |
| version | 0.1.4-nightly.17.1.a460619 |
| created_at | 2025-12-23 02:12:15.788893+00 |
| updated_at | 2025-12-23 19:25:11.19085+00 |
| description | Nockchain gRPC protobuf definitions |
| homepage | https://nockchain.net |
| repository | https://github.com/nocktoshi/rose-rs |
| max_upload_size | |
| id | 2000622 |
| size | 133,583 |
gRPC protobuf definitions and conversions for nockchain-wallet.
This crate provides protobuf type definitions compatible with nockchain's gRPC API, along with conversion traits to/from rose-nockchain-types.
This crate bridges the gap between:
rose-nockchain-types (no_std, custom types)
↕ conversion layer
rose-grpc-proto (std, protobuf)
↕ tonic/gRPC
nockchain server (nockchain-types)
| rose-nockchain-types | Protobuf | nockchain-types |
|---|---|---|
rose_ztd::Belt |
Belt { value: u64 } |
nockchain_math::Belt |
rose_ztd::Digest ([Belt; 5]) |
Hash (5 Belt fields) |
Hash ([Belt; 5]) |
Nicks (usize) |
Nicks { value: u64 } |
Nicks (usize) |
BlockHeight (usize) |
BlockHeight { value: u64 } |
BlockHeight(Belt) |
Version enum |
NoteVersion { value: u32 } |
Version enum |
Name: first, lastPkh: m, hashesPkhSignature: tuple field (Vec of PublicKey/Signature pairs)MerkleProof: root, pathHax: tuple field (Vec of Digest)rose_crypto::Signature (UBig c/s fields) and protobuf EightBelt arraysuse rose_grpc_proto::client::{PublicNockchainGrpcClient, BalanceRequest};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Connect to Nockchain server
let mut client = PublicNockchainGrpcClient::connect("http://localhost:50051").await?;
// Get balance for an address
let balance = client.wallet_get_balance(
&BalanceRequest::Address("address_base58".to_string())
).await?;
println!("Found {} notes", balance.notes.len());
// Send a transaction
let raw_tx = /* build your RawTx */;
let response = client.wallet_send_transaction(raw_tx).await?;
Ok(())
}
use rose_grpc_proto::{pb, convert};
use rose_nockchain_types::RawTx;
// Convert wallet transaction to protobuf
let raw_tx: RawTx = /* ... */;
let pb_tx: pb::common::v2::RawTransaction = raw_tx.into();
The .proto files are copied from nockchain's nockapp-grpc-proto crate:
nockchain/common/v1/primitives.proto - Basic types (Belt, Hash, etc.)nockchain/common/v1/blockchain.proto - V0 transaction typesnockchain/common/v2/blockchain.proto - V1 transaction types with witnessesnockchain/public/v2/nockchain.proto - gRPC service definitionswallet_get_balance - Get wallet balance (with automatic pagination)wallet_send_transaction - Send signed transactionstransaction_accepted - Check transaction acceptance statusClientErrortodo!())cargo build -p rose-grpc-proto
The build process automatically generates Rust code from .proto files using tonic-build.