gui-qml icon indicating copy to clipboard operation
gui-qml copied to clipboard

[DRAFT] WIP QML Generate Snapshot Signet

Open D33r-Gee opened this issue 8 months ago • 18 comments

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 avatar Mar 04 '25 20:03 D33r-Gee