Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EPIC] Allow users to sync from a specific block height #1521

Open
11 of 12 tasks
nortonandreev opened this issue Mar 10, 2024 · 4 comments
Open
11 of 12 tasks

[EPIC] Allow users to sync from a specific block height #1521

nortonandreev opened this issue Mar 10, 2024 · 4 comments
Assignees
Labels
Epic A large feature encompassing multiple sub-issues module:web-wallet Issues related to web-wallet module need:brainstorm Call for participation: group brainstorming is requested to fix this issue need:feedback Call for participation: feedback is requested to fix this issue need:specs Call for participation: specs are requested to fix this issue

Comments

@nortonandreev
Copy link
Contributor

nortonandreev commented Mar 10, 2024

Allow users to sync from a specific block height

Summary

Currently, creating / restoring a Wallet takes a long time, dependent on the blockchain size. We should explore the option to optimize performance by allowing users to sync from the point when the user's wallet has been created.

This epic captures all the requirements and the work needed to fulfill this initiative.

Requirements

  • Let users specify the block height to sync from on Wallet restoration (with a link to Wiki, also should be emphasized it's an optional step)
  • Allow users to switch between sync from the genesis or a specific block height (option in Settings)
  • Make sure the Restore wallet flow is triggered if a user tries to access a wallet, different than the currently stored one in memory
  • Make sure new Wallet doesn't sync from the beginning of the blockchain (Create Wallet flow)
  • Display the current block height on Wallet creation, emphasizing saving this is not essential (unlike the seed phrase) and can be retrieved later from the Settings pane.
  • Redesign the landing page so that unlocking with a quick access to creating, resetting, and unlocking a Wallet

Each requirement needs a design, as well as making sure we have the APIs on the service side, dusk-wallet-js (eg. for setting the height to sync from, to receive the current block height, etc).

Tasks

web-wallet:

wallet-js:

docs:

Benefits

Syncing from a recent block height is considerably faster as there is significantly less historical data to process. Partial synchronization also uses less disk space and reduces network bandwidth consumption, which could be important for users with limited resources.

Risks

There are several risks related to syncing from a specific block height:

  • Missed relevant transactions which can lead to incorrect balance.
  • For entities that need to maintain comprehensive records for regulatory or compliance reasons, not having the full blockchain data could pose legal risks or complicate compliance efforts.
  • Syncing from a later point could expose the wallet to vulnerabilities that might have been patched in earlier blocks.
  • In the event of a blockchain reorganization (reorg), it's possible that the user's chosen block height becomes invalidated.

Risk Mitigation Strategies

  • Clear Warnings: Strongly emphasize the risks of missing transactions and security issues.
  • Guidance on Block Height Selection: Provide resources or tools to assist users in selecting a suitable block height that maximizes chances of not missing relevant transactions. Ensure that the initial block or snapshot used for synchronization comes from a trusted and reputable source.
  • User-Controlled Checkpoints: Allow advanced users to specify their own trusted block height or checkpoint, offering flexibility to those who have the knowledge to make informed decisions about their starting point.
  • Signature Verification: Implement a mechanism to verify the integrity and authenticity of the initial block data or snapshot through cryptographic signatures.
  • Robust Reorg Handling: Implement a reliable mechanism to detect and handle blockchain reorganizations, including automatic resynchronization if necessary.
  • Fallback to Full Sync Option: Offer users the option to perform a full sync from the genesis block if they prefer the highest level of security and verification.
  • Regular Software Updates: Maintain and update the wallet software regularly to address any emerging vulnerabilities or threats.
@nortonandreev nortonandreev added Epic A large feature encompassing multiple sub-issues need:specs Call for participation: specs are requested to fix this issue need:brainstorm Call for participation: group brainstorming is requested to fix this issue need:feedback Call for participation: feedback is requested to fix this issue module:web-wallet Issues related to web-wallet module labels Mar 10, 2024
@ZER0
Copy link
Contributor

ZER0 commented Mar 11, 2024

This is what Monero does: https://www.getmonero.org/resources/user-guides/change-restore-height.html#what-is-the-wallet-restore-height

@nortonandreev
Copy link
Contributor Author

nortonandreev commented Mar 11, 2024

This is what Monero does: https://www.getmonero.org/resources/user-guides/change-restore-height.html#what-is-the-wallet-restore-height

Lovely, thank you! Was looking for this info. To sum up, Monero:

  • suggests the custom block height should be the number of the block which included the first incoming transaction to your wallet
  • if unsure of the block height, suggests entering a lower restore height instead of a higher one (so that transactions are not missed)
  • supports a date – apart from the block height (I think this is useful, as users might not remember the block height, but instead might have an estimated date on when they have created their wallet) [Update: Won't do]

set_new_restore_height-date

  • has the block height as a setting – changing the height will trigger a resync (and rebuilding of the Wallet's cache)

change_wallet_restore_height

rescan_wallet_cache

@laremas
Copy link
Member

laremas commented Mar 12, 2024

As a starting draft i created this screen.

syncing

This is not to be intended as final, is just a draft that needs to be discussed.

@laremas
Copy link
Member

laremas commented Mar 18, 2024

Design Update.

Added a screen to copy the block height when creating a wallet.
1st setup


Added possibility to sync from genesis or custum height.
sync
sync1


Added current block height info/copy possibility in settings.
settings

@nortonandreev nortonandreev pinned this issue Mar 20, 2024
@HDauven HDauven unpinned this issue Apr 25, 2024
@HDauven HDauven removed their assignment Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic A large feature encompassing multiple sub-issues module:web-wallet Issues related to web-wallet module need:brainstorm Call for participation: group brainstorming is requested to fix this issue need:feedback Call for participation: feedback is requested to fix this issue need:specs Call for participation: specs are requested to fix this issue
Projects
None yet
Development

No branches or pull requests

5 participants