#bindings #zcash #protocols #grpc #wrapper #lightwalletd #thin-as-possible

zcash_lightwallet_proto

A thin-as-possible rust bindings wrapper for the Zcash lightwalletd gRPC protocol

2 releases

0.1.1 Oct 20, 2022
0.1.0 Oct 20, 2022

#41 in #zcash

Custom license

1MB
10K SLoC

Go 10K SLoC // 0.1% comments Shell 89 SLoC // 0.2% comments Rust 43 SLoC Bitbake 4 SLoC

A thin-as-possible rust bindings wrapper for the Zcash lightwalletd gRPC protocol.

Status

⚠️ ⚠ This is a proof-of-concept prototype and should not be used in production.

This repository is a proof of concept at creating a minimal modular rust bindings crate for the Lightwalletd protocol. The librustzcash project may integrate grpc bindings directly which would be better maintained and vetted for production use in the future, see librustzcash issue #585.

This crate depends on protobuf-codegen-pure which will be imminently superceded by protobug-codegen according to the docs.

Build

This crate relies on protobuf-codegen-pure to generate bindings without requiring any build toolchains outside of cargo (namely there's no requirement for protoc to be installed).

So a standard cargo build should work.

Build Design

The .proto files are imported directly from lightwalletd as a git subtree within the ./subtree directory. This design is intended to enable safe tracking of upstream changes by updating the subtree without other manual copying or editing of .proto files.

The build.rs script uses protobuf-codegen-pure to generate rust mods, writing them into $OUT_DIR/generated-source/. Additionally a container.rs source file is written with pub mod ${MODNAME}; for each .proto generated rust mod.

The lib.rs directly include!()'s the container.rs, which pulls in each generated submod.

Unfortunately API docs are not produced from the upstream .proto files with this current design. A nice improvement would be to ensure rust API docs are automatically generated from upstream .proto API documentation.

Dependencies