19 releases (11 breaking)

0.12.1 Mar 27, 2024
0.11.1 Mar 9, 2024
0.10.0 Sep 25, 2023
0.9.0 Apr 28, 2023
0.1.0 Oct 8, 2019

#797 in Magic Beans

Download history 214/week @ 2024-01-01 596/week @ 2024-01-08 371/week @ 2024-01-15 953/week @ 2024-01-22 642/week @ 2024-01-29 729/week @ 2024-02-05 748/week @ 2024-02-12 1042/week @ 2024-02-19 409/week @ 2024-02-26 311/week @ 2024-03-04 522/week @ 2024-03-11 409/week @ 2024-03-18 450/week @ 2024-03-25 305/week @ 2024-04-01 573/week @ 2024-04-08 1110/week @ 2024-04-15

2,438 downloads per month
Used in 5 crates (4 directly)

MIT/Apache

2MB
33K 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

~16–33MB
~554K SLoC