adityapk00/zecwallet-light-cli

Question How create checkpoint ?

NorbertBodziony opened this issue · 6 comments

Currently, checkpoint is a tuple (block, hash, tree) right? How I can generate tree for new checkpoint ?

To add some detail here, it seems best for UX to add a new checkpoint each time a version of the app is released, since that will minimize sync time for each user. What's the best way to do that?

Also, have any other approaches been discussed for addressing this problem?

Lightwallet::get_sapling_tree() returns the 3-tuple of block, hash, tree. Here: https://github.com/adityapk00/zecwallet-light-cli/blob/master/lib/src/lightwallet.rs#L702

The 3-tuple is written to the log file every 10,000 blocks, so I usually just copy it from there.
See the example of logging it here: https://github.com/adityapk00/zecwallet-light-cli/blob/master/lib/src/lightwallet.rs#L1948

@adityapk00 if our goal is to reduce startup syncing to an absolute minimum, what approach would you recommend?

Can we force the creation of the 3-tuple?

Should we create a modified zecwallet-lite-cli that creates the 3-tuple for every or every 10 blocks? What's the best way to do this?

Ideally a user would never be more than a few days behind.

Note that this technique - bootstrapping from a checkpoint - only works if the user is new - i.e., has no transactions, so doesn't need to sync.

The absolute fastest way to do this is to actually have lightwalletd return this 3-tuple in a new API call. Then, when zecwallet-lite-cli starts up, it simply queries the lightwalletd, gets the 3-tuple, and starts up.
Pros:

  • The 3-tuple can be the latest one, so the lightclient is instantly ready - i.e., needs to sync only 1 block to be ready
    Cons:
  • The lightclient now places enormous trust in lightwalletd. A compromised lightwalletd can mislead the client quite easily, since the client has no way to verify if the lightwalletd is telling the truth.

Is there a way to verify the one given by lightwalletd based on data
shipped with the app, without syncing all the blocks?
Could the app trust lightwalletd for a few minutes while it verifies from
its own checkpoint?

This is the current behaviour of the lite client. It verifies the checkpoint that ships in the code, and then syncs from there.

Does lightwalletd currently provide this?

No, because this would add another trust dependency on lightwalletd.