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

[DRAFT] WIP QML Generate Snapshot Signet #446

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

D33r-Gee
Copy link
Contributor

@D33r-Gee D33r-Gee commented Mar 4, 2025

Based on #424. For evaluation purposes only!

GUI Integration for Generating UTXO Snapshots

Overview

This PR adds initial GUI support for generating a signet UTXO snapshot at height 160,000, building on Bitcoin Core's assumeutxo infrastructure.

What This PR Does

  1. Adds a basic GUI interface for generating UTXO snapshots via the Connection Settings panel
  2. Implements non-blocking snapshot generation via QT Thread
  3. Provides visual confirmation of snapshot generation
  4. Adds a snapshot progress notifications accessible via a handler

Implementation Details

Core Components Modified

  1. Node Interface (src/node/interfaces.cpp)
  • Implements a notification handler for snapshot generation progress (rewind and restore)
  1. Snapshot Qml (src/qml/models/snapshotqml.h)
  • Introduces a worker class to manage snapshot generation
  1. QML Integration (src/qml/models/nodemodel.cpp)
  • Manages snapshot generation state and progress
  • Uses Qt's thread system to prevent UI blocking
  • Provides progress updates via Qt signals
  1. UI Components (src/qml/components/SnapshotGenSettings.qml)
  • File view for snapshot generation
  • Snapshot generation progress and completion

Key Design Decisions

  1. Non-blocking Implementation
  • Snapshot generation runs in separate QT thread
  • UI remains responsive during generation
  • Node is disconnected from the network during generation
  1. Extensibility
  • Interface designed to accommodate future assumeutxo changes
  • Error handling framework in place

Testing Instructions

  1. Build
  2. Launch Bitcoin Core QML GUI
  3. Navigate to Connection Settings
  4. Wait for IBD to complete
  5. Click "Generate Snapshot"
  6. Verify (see screenshots below):
    • "Snapshot Generated" confirmation appears
    • snapshot file is created in the signet data directory
Ubuntu 22.04 Screenshots

Screenshot 2025-03-04 115218
Screenshot 2025-03-04 115246
Screenshot 2025-03-04 115309
Screenshot 2025-03-04 115323
Screenshot 2025-03-04 115356
Screenshot 2025-03-04 115641
Screenshot 2025-03-04 gen file view

Expected Behavior

  • File selection dialog works
  • Success/failure state properly displayed
  • Node is disconnected from the network during generation

Future Work

  1. Cancel Snapshot Generation
  • Add ability to cancel snapshot generation
  1. Integration
  • Coordinate with upstream assumeutxo changes
  • Add support for network-specific snapshots (testnet and mainnet)

Notes for Reviewers

Snapshot Compatibility

  • Currently only works with signet
  • Limited to specific 160,000 height
  • Validates against chain parameters m_assumeutxo_data
    (the changes there can be discarded once synced since m_assumeutxo_data is already hardcoded)

This is a work in progress - feedback welcome on the approach and implementation details.

@D33r-Gee D33r-Gee force-pushed the qml-gen-snapshot-signet branch from d44eb7f to abc189a Compare March 5, 2025 16:20
@yashrajd
Copy link

yashrajd commented Mar 5, 2025

Great start! Thanks for continuing to do this man. I have not tested on my machine, responding to screenshots below.

What This PR Does

  1. Adds a basic GUI interface for generating UTXO snapshots via the Connection Settings panel
  2. Implements non-blocking snapshot generation via QT Thread
  3. Provides visual confirmation of snapshot generation
  4. Adds a snapshot progress notifications accessible via a handler

...

  1. UI Components (src/qml/components/SnapshotGenSettings.qml)
  • File view for snapshot generation
  • Snapshot generation progress and completion

Key Design Decisions

  1. Non-blocking Implementation
  • Snapshot generation runs in separate QT thread
  • UI remains responsive during generation
  • Node is disconnected from the network during generation
  1. Extensibility
  • Interface designed to accommodate future assumeutxo changes
  • Error handling framework in place

Top-tier PR write-up, kudos!

Screenshot 2025-03-04 115309

My main gripe still is that 'load/generate snapshot' makes no sense in Connection Settings. Otherwise looks good.

Screenshot 2025-03-04 115323

"A snapshot captures the current state of bitcoin transactions on the network. It can be imported into other bitcoin nodes to speed up the initial setup. You can generate a snapshot of the current chain state.

Isn't the snapshot generated a pre-decided block height only? not the current block height?

  • if so, we should mention the date/block height in the text.
  • we should also update the text so as to avoid giving wrong impression
  • long-standing issue with reference to transactions

Suggested copy: "A snapshot captures the state of the bitcoin network up to a certain date in the recent past. It can be imported into other bitcoin nodes to speed up their initial sync.
Snapshot date: 23rd September 2023 (block 657478)

Screenshot 2025-03-04 115356

Perhaps the "Rewinding" text is placeholder. Should be something like:
**This might take a while.

You can continue using the application while the process continues in the background.**

Good to have would be to show some a % progress number

Screenshot 2025-03-04 115641

The View File button is awesome! Consider adding a Done button too that will send the user back to home screen/block clock...

@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented Mar 6, 2025

My main gripe still is that 'load/generate snapshot' makes no sense in Connection Settings. Otherwise looks good.

in the figma design where would you idealy prefer these options would be placed under?

@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented Mar 6, 2025

Isn't the snapshot generated a pre-decided block height only? not the current block height?

  • if so, we should mention the date/block height in the text.
  • we should also update the text so as to avoid giving wrong impression
  • long-standing issue with reference to transactions

Great suggestions will update with the next push

@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented Mar 6, 2025

Good to have would be to show some a % progress number

Could you share some design ideas for this?

@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented Mar 6, 2025

Consider adding a Done button too that will send the user back to home screen/block clock...

Could you update the figma to reflect that?

This introduce the UI flow to load a AssumeUTXO snapshot
into the Bitcoin Core App. It modifies the connection seetings
and adds a SnapshotSettings file, Icon, and modified profress
bar.

It has been rebased
- Extend node interface with virtual functions for UTXO snapshot loading
- Add signal mechanism to monitor snapshot loading progress
- Include predefined signet UTXO dataset in chainparams for validation
This introduces a Rewind Progress notification so that it is available when generating an AssumeUTXO snapshot through the UI.
This commit adds the Snapshot Gen files to the Connection Settings page. It wires the generate snapshot functionality through the node model and expands the snapshot qml worker class.
@D33r-Gee D33r-Gee force-pushed the qml-gen-snapshot-signet branch from abc189a to 34a6f54 Compare March 19, 2025 16:39
@D33r-Gee
Copy link
Contributor Author

with 34a6f54 rebased over main and addressed feedback from @yashrajd (see screenshots below)

WSL Ubuntu 22.04 screenshots

Screenshot 2025-03-19 085821
Screenshot 2025-03-19 085754

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