Skip to content

QML Load UTXO Snapshot #485

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

Open
wants to merge 3 commits into
base: qt6
Choose a base branch
from

Conversation

D33r-Gee
Copy link
Contributor

This is an re-opened PR based on #424 and #449

UTXO Snapshot Loading

Overview

This PR enables loading UTXO snapshots both during and after the initial onboarding process.

What This PR Does

  1. Adds a basic GUI interface for loading UTXO snapshots via the Connection Settings panel
  2. Enables snapshot selection during onboarding, with loading when headers are synced
  3. Implements non-blocking snapshot loading via QT Thread
  4. Provides visual confirmation of snapshot activation
  5. Adds a snapshot progress notifications accessible via a handler
  6. it adds a patch to the bitcoin submodule to expose snapshot loading functionality to the GUI via the interface system

Implementation Details

Core Components Modified

  1. CPP Backend (qml/models/nodemodel.cpp)
  • Manages snapshot loading state and progress
  • Uses Qt's thread system to prevent UI blocking
  • Provides progress updates via Qt signals
  • Adds support for storing snapshot file path during onboarding
  • Implements automatic snapshot loading once headers are synced
  1. UI Components (qml/components/SnapshotLoadSettings.qml, src/qml/components/ConnectionSettings.qml)
  • File selection dialog with onboarding awareness
  • Snapshot verification status
  • Progress tracking and visualization
  • Updated visibility conditions to enable loading during onboarding
  1. Snapshot Qml Model (qml/models/snapshotqml.cpp)
  • Introduces a worker class to manage snapshot metadata

Key Design Decisions

  1. Onboarding Integration
  • Allows users to select snapshot during setup
  • Delayed loading until headers are synced
  • Proper state handling between onboarding and regular modes

Testing Instructions

  1. Build
  2. Launch Bitcoin Core QML GUI
  3. Navigate to Connection Settings
  4. Test with different snapshots:
mainnet: magnet:?xt=urn:btih:559bd78170502971e15e97d7572e4c824f033492&dn=utxo-880000.dat&tr=udp%3A%2F%2Ftracker.bitcoin.sprovoost.nl%3A6969

alternatively, you can use the following link to download the mainnet snapshot: https://bitcoin-snapshots.jaonoctus.dev/

signet: https://drive.google.com/file/d/1VJeeGQncrs4xZhh6kU5IwkyatXVM4SOm/view?usp=sharing
  1. Test onboarding flow:

    • Select a snapshot file during initial setup
    • Verify it loads automatically after headers sync
  2. Verify (see screenshots below):

    • "Snapshot Loaded" confirmation appears
    • For errors, check debug.log for [snapshot]
Ubuntu 22.04 Screenshots

Screenshot 2025-05-05 154558
Screenshot 2025-05-05 154615
qt6_loading_snapshot_dialog
Screenshot 2025-05-05 154703
Screenshot 2025-05-05 154720
Screenshot 2025-07-30 103140

Expected Behavior

  • File selection dialog works
  • Node becomes usable while background validation continues
  • When selected during onboarding, snapshot loads after headers sync
Success/failure state properly displayed Screenshot 2025-07-30 101752

feedback welcome on the approach and implementation details.

D33r-Gee added 3 commits July 31, 2025 10:34
- This introduce the UI flow to load a AssumeUTXO snapshot
- It modifies the connection settings
- Adds a SnapshotLoadSettings file, Icon, and modified progress
bar.
- Also it adds error page on snapshotloading failure
- Added snapshot loading capabilities to NodeModel, including progress tracking and error handling.
- Introduced SnapshotQml class for processing snapshot files.
- Enhanced ChainModel with methods to retrieve snapshot information and check if a snapshot is active.
- Updated QML properties to reflect snapshot loading state and progress.
- Included necessary includes for snapshot handling in relevant files.
- Implemented a new method `snapshotLoadProgress(double progress)` in the notifications interface to report loading progress of UTXO snapshots.
- Updated `ChainstateManager::PopulateAndValidateSnapshot` to calculate and send progress updates during snapshot loading.
- Introduced a new signal `SnapshotLoadProgress` in the UI interface for handling progress notifications.
- Added necessary handlers in the node interface to connect the new progress signal.
- Included a patch file for clean CI environments to ensure consistent submodule state.
@D33r-Gee D33r-Gee force-pushed the qml-snapshot-load branch from 4439769 to 050fa0e Compare July 31, 2025 17:43
@D33r-Gee
Copy link
Contributor Author

with 050fa0e addressed @johnny9 comment to remove unnecessary icon descriptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants