Create new, modern, backwards-incompatible RPC interface. #6690
Labels
C-feature-request
Category: This is a request for a new feature or functionality.
C-future-proofing
Category: Changes that minimise the effects of shocks and stresses of future events.
C-tech-debt
Category: Technical debt that needs to be paid off
D-bitcoin-divergence
Design issue: Divergence from Bitcoin (upstream code and/or architecture).
use case
Is your feature request related to a problem? Please describe.
The problems with the current RPC interface are many:
true
/false
, others are non-zero ints.z_getoperationstatus
are polling kludges.Describe the solution you'd like
Rather than iteratively extend the existing interface, which leaves a long tail of "straddling-the-fence" flaws of older-vs-newer APIs, what if we simply start a new RPC interface ex-nihilo that uses good modern clean design and mark the existing RPC as "maintenance-only mode".
There could be a variety of good options, but I'm most familiar with gRPC:
uint32
vssint64
vsdouble
)rpc GetWalletEvents () returns (stream WalletEvent)
which streams events for things like new transaction request, transaction constructed, transaction confirmed at depth D, transaction expired, etc… This would replace the polling-style design ofz_getoperationstatus
.ZcashdBlockExplorerBackend
vsZcashdWallet
. (I'm not familiar with multiplexing multiple gRPC services on a single connection; worst case, just have separate gRPC service ports for different interfaces.) These services could then be configured by their service name, iezcash.conf
might havegrpc_services_wallet = true
.For zcashd implementation, we could add a rust gRPC server, perhaps async within its own thread(s), then communicate between rust<->C++ with a message-passing design so that the rust code avoids the complexity of touching other C++ synchronization primitives.
One advantage of doing this is that the direct gRPC server could be a reusable crate with the "zcashd provider" as only one backend, thus enabling us to create standalone testmode services, zebra backends, etc…
I'm not too clear on the rust<->C++ interface or how convenient message passing could be or what tech would work well there.
Alternatives you've considered
There may be alternatives to gRPC that have similar advantages: schema, precise scalar types, tooling, language SDKs, …
Just deprecate all of zcashd in favor of zebra. We'd still need to potentially define RPC interfaces for the components we want.
Another option: for a new headless wallet, rather than reifying the current zcashd wallet design, we could rely on a
librustzcash -> lightwalletd -> zcashd
stack and just bundle those together in a single convenient package (e.g.zcashd-wallet
vszcashd-no-wallet
) for different use cases.Additional context
This is just a brainstorm proposal, and we'll be considering a wide variety of ways to reduce zcashd technical debt, foremost of which is deciding if we should simply wind-down support for some entire use-case classes.
The text was updated successfully, but these errors were encountered: