#wallet #zcash #light #clients #shielded #api #traits

zcash_client_backend

APIs for creating shielded Zcash light clients

22 releases (14 breaking)

new 0.15.0 Nov 14, 2024
0.13.0 Aug 20, 2024
0.12.1 Mar 27, 2024
0.10.0 Sep 25, 2023
0.1.0 Oct 8, 2019

#325 in Magic Beans

Download history 1020/week @ 2024-07-29 651/week @ 2024-08-05 603/week @ 2024-08-12 598/week @ 2024-08-19 581/week @ 2024-08-26 516/week @ 2024-09-02 394/week @ 2024-09-09 474/week @ 2024-09-16 371/week @ 2024-09-23 634/week @ 2024-09-30 558/week @ 2024-10-07 27/week @ 2024-10-14 75/week @ 2024-10-21 249/week @ 2024-10-28 382/week @ 2024-11-04 551/week @ 2024-11-11

1,258 downloads per month
Used in 4 crates

MIT/Apache

2.5MB
41K SLoC

zcash_client_backend

This library contains Rust structs and traits for creating shielded Zcash light clients.

Building

Note that in order to (re)build the GRPC interface, you will need protoc on your $PATH. This is not required unless you make changes to any of the files in ./proto/.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

A crate for implementing Zcash light clients.

zcash_client_backend contains Rust structs and traits for creating shielded Zcash light clients.

Design

Wallet sync

The APIs in the data_api::chain module can be used to implement the following synchronization flow:

                         ┌─────────────┐  ┌─────────────┐
                         │Get required │  │   Update    │
                         │subtree root │─▶│subtree roots│
                         │    range    │  └─────────────┘
                         └─────────────┘         │
                                                 ▼
                                            ┌─────────┐
                                            │ Update  │
          ┌────────────────────────────────▶│chain tip│◀──────┐
          │                                 └─────────┘       │
          │                                      │            │
          │                                      ▼            │
   ┌─────────────┐        ┌────────────┐  ┌─────────────┐     │
   │  Truncate   │        │Split range │  │Get suggested│     │
   │  wallet to  │        │into batches│◀─│ scan ranges │     │
   │rewind height│        └────────────┘  └─────────────┘     │
   └─────────────┘               │                            │
          ▲                     ╱│╲                           │
          │      ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─              │
     ┌────────┐         ┌───────────────┐       │             │
     │ Choose │  │      │Download blocks│                     │
     │ rewind │         │   to cache    │       │             │
     │ height │  │      └───────────────┘           .───────────────────.
     └────────┘                 │               │  ( Scan ranges updated )
          ▲      │              ▼                   `───────────────────'
          │               ┌───────────┐         │             ▲
 .───────────────┴─.      │Scan cached│    .─────────.        │
( Continuity error  )◀────│  blocks   │──▶(  Success  )───────┤
 `───────────────┬─'      └───────────┘    `─────────'        │
                                │               │             │
                 │       ┌──────┴───────┐                     │
                         ▼              ▼       │             ▼
                 │┌─────────────┐┌─────────────┐  ┌──────────────────────┐
                  │Delete blocks││   Enhance   ││ │Update wallet balance │
                 ││ from cache  ││transactions │  │  and sync progress   │
                  └─────────────┘└─────────────┘│ └──────────────────────┘
                 └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─

Feature flags

Dependencies

~18–50MB
~704K SLoC