Onboard existing Bitcoin Core datadir without overwriting user settings #704

Closed
opened 2026-05-15 16:18:57 +00:00 by johnny9 · 4 comments
johnny9 commented 2026-05-15 16:18:57 +00:00 (Migrated from github.com)

Problem

QML onboarding needs to distinguish between:

  1. whether the GUI already has a datadir choice, and
  2. whether the active datadir/profile has already completed QML onboarding.

An existing Bitcoin Core user may launch the QML app for the first time using an already-initialized Core datadir. In that case, QML onboarding should still be shown if qml_onboarded has not yet been set for that profile, but the app must not treat that datadir as a fresh setup or overwrite existing user settings.

This is separate from #596, which covers custom datadir wiring for fresh onboarding.

Proposed behavior

Datadir resolution

Resolve the active datadir in this order:

  1. CLI -datadir
  2. GUI-saved datadir in global QSettings (matching Qt's strDataDir behavior)
  3. default datadir

The GUI-saved datadir should be global, not network-specific, like Qt. It should be persisted at the end of onboarding.

When to show the storage directory page

Whether OnboardingStorageLocation is shown should depend on whether the datadir has already been chosen by CLI or by a previous GUI onboarding run.

Show OnboardingStorageLocation only when:

  • no CLI -datadir is set, and
  • no previously saved GUI datadir choice exists in QSettings

Skip OnboardingStorageLocation when:

  • CLI -datadir is set, or
  • QSettings already contains a GUI-saved datadir from a prior completed onboarding

-resetguisettings should mimic Qt behavior by re-showing datadir selection and resetting the relevant GUI/onboarding state.

Support for -choosedatadir should be tracked separately in a new issue.

qml_onboarded remains datadir-specific

qml_onboarded should remain tied to the resolved active datadir/profile via that profile's settings.json, not to global QSettings.

After resolving the active datadir:

  • if qml_onboarded=true, skip onboarding
  • if qml_onboarded is missing/false, show onboarding

Detecting an existing Core profile

Whether to show the remaining settings choices should not be based on settings.json existence alone.

Treat the resolved datadir as an existing Core profile if any same-network Core state already exists there, including for example:

  • network-specific settings.json
  • bitcoin.conf
  • existing same-network block index / chainstate / block data
  • prior prune state such as prunedblockfiles

If none of those are present, treat the datadir as a fresh profile.

Page behavior when qml_onboarded is missing

If the resolved datadir is an existing Core profile:

  • show only:
    • OnboardingCover ("Bitcoin Core App")
    • OnboardingStrengthen ("Strengthen bitcoin")
    • OnboardingBlockclock ("The block clock")
  • skip:
    • OnboardingStorageLocation ("Storage location")
    • OnboardingStorageAmount ("Storage")
    • OnboardingConnection ("Starting initial download")
  • do not treat the datadir as a fresh profile
  • do not call resetSettings() by default
  • do not overwrite existing persistent storage/connection/prune settings
  • on completion, write only qml_onboarded=true

If the resolved datadir is a fresh profile:

  • show the full onboarding flow
  • on completion, persist the chosen datadir to global QSettings
  • write the onboarding-selected settings plus qml_onboarded=true
  • Fresh-profile custom datadir setup remains in #596.
  • Storage onboarding UX improvements remain separate in #405 and #406.
  • -choosedatadir support should be tracked in a new issue.

Definition of Done

  • Datadir resolution follows:
    1. CLI -datadir
    2. GUI-saved global QSettings datadir
    3. default datadir
  • OnboardingStorageLocation is shown only when no CLI datadir and no GUI-saved datadir choice exist.
  • qml_onboarded is evaluated for the resolved active datadir/profile, not as a global GUI flag.
  • Existing profile + missing qml_onboarded:
    • onboarding is shown
    • only OnboardingCover, OnboardingStrengthen, and OnboardingBlockclock are shown
    • OnboardingStorageLocation, OnboardingStorageAmount, and OnboardingConnection are skipped
    • existing persistent settings are preserved
  • Fresh profile + missing qml_onboarded:
    • full onboarding is shown
    • chosen datadir is persisted to global QSettings at the end of onboarding
  • -resetguisettings re-shows datadir selection and resets the relevant GUI/onboarding state without defaulting to destructive resets of an existing Core profile.
  • Functional coverage validates combinations of:
    • CLI -datadir set vs unset
    • GUI QSettings datadir set vs unset
    • resolved datadir looking fresh vs existing
    • qml_onboarded present vs absent
    • -resetguisettings behavior

Notes

PR #549 introduced the useful concept of a qml_onboarded marker. That marker should mean QML onboarding has completed for a specific profile. It should not be replaced with a broad rule that skips onboarding whenever any Core settings or config exist, because existing Bitcoin Core users are exactly the users who still need first-run QML onboarding without losing their prior configuration.

## Problem QML onboarding needs to distinguish between: 1. whether the GUI already has a datadir choice, and 2. whether the active datadir/profile has already completed QML onboarding. An existing Bitcoin Core user may launch the QML app for the first time using an already-initialized Core datadir. In that case, QML onboarding should still be shown if `qml_onboarded` has not yet been set for that profile, but the app must not treat that datadir as a fresh setup or overwrite existing user settings. This is separate from #596, which covers custom datadir wiring for fresh onboarding. ## Proposed behavior ### Datadir resolution Resolve the active datadir in this order: 1. CLI `-datadir` 2. GUI-saved datadir in global QSettings (matching Qt's `strDataDir` behavior) 3. default datadir The GUI-saved datadir should be global, not network-specific, like Qt. It should be persisted at the end of onboarding. ### When to show the storage directory page Whether `OnboardingStorageLocation` is shown should depend on whether the datadir has already been chosen by CLI or by a previous GUI onboarding run. Show `OnboardingStorageLocation` only when: - no CLI `-datadir` is set, and - no previously saved GUI datadir choice exists in QSettings Skip `OnboardingStorageLocation` when: - CLI `-datadir` is set, or - QSettings already contains a GUI-saved datadir from a prior completed onboarding `-resetguisettings` should mimic Qt behavior by re-showing datadir selection and resetting the relevant GUI/onboarding state. Support for `-choosedatadir` should be tracked separately in a new issue. ### `qml_onboarded` remains datadir-specific `qml_onboarded` should remain tied to the resolved active datadir/profile via that profile's `settings.json`, not to global QSettings. After resolving the active datadir: - if `qml_onboarded=true`, skip onboarding - if `qml_onboarded` is missing/false, show onboarding ### Detecting an existing Core profile Whether to show the remaining settings choices should not be based on `settings.json` existence alone. Treat the resolved datadir as an existing Core profile if any same-network Core state already exists there, including for example: - network-specific `settings.json` - `bitcoin.conf` - existing same-network block index / chainstate / block data - prior prune state such as `prunedblockfiles` If none of those are present, treat the datadir as a fresh profile. ### Page behavior when `qml_onboarded` is missing If the resolved datadir is an existing Core profile: - show only: - `OnboardingCover` ("Bitcoin Core App") - `OnboardingStrengthen` ("Strengthen bitcoin") - `OnboardingBlockclock` ("The block clock") - skip: - `OnboardingStorageLocation` ("Storage location") - `OnboardingStorageAmount` ("Storage") - `OnboardingConnection` ("Starting initial download") - do not treat the datadir as a fresh profile - do not call `resetSettings()` by default - do not overwrite existing persistent storage/connection/prune settings - on completion, write only `qml_onboarded=true` If the resolved datadir is a fresh profile: - show the full onboarding flow - on completion, persist the chosen datadir to global QSettings - write the onboarding-selected settings plus `qml_onboarded=true` ## Non-goals / related work - Fresh-profile custom datadir setup remains in #596. - Storage onboarding UX improvements remain separate in #405 and #406. - `-choosedatadir` support should be tracked in a new issue. ## Definition of Done - Datadir resolution follows: 1. CLI `-datadir` 2. GUI-saved global QSettings datadir 3. default datadir - `OnboardingStorageLocation` is shown only when no CLI datadir and no GUI-saved datadir choice exist. - `qml_onboarded` is evaluated for the resolved active datadir/profile, not as a global GUI flag. - Existing profile + missing `qml_onboarded`: - onboarding is shown - only `OnboardingCover`, `OnboardingStrengthen`, and `OnboardingBlockclock` are shown - `OnboardingStorageLocation`, `OnboardingStorageAmount`, and `OnboardingConnection` are skipped - existing persistent settings are preserved - Fresh profile + missing `qml_onboarded`: - full onboarding is shown - chosen datadir is persisted to global QSettings at the end of onboarding - `-resetguisettings` re-shows datadir selection and resets the relevant GUI/onboarding state without defaulting to destructive resets of an existing Core profile. - Functional coverage validates combinations of: - CLI `-datadir` set vs unset - GUI QSettings datadir set vs unset - resolved datadir looking fresh vs existing - `qml_onboarded` present vs absent - `-resetguisettings` behavior ## Notes PR #549 introduced the useful concept of a `qml_onboarded` marker. That marker should mean QML onboarding has completed for a specific profile. It should not be replaced with a broad rule that skips onboarding whenever any Core settings or config exist, because existing Bitcoin Core users are exactly the users who still need first-run QML onboarding without losing their prior configuration.
johnny9 commented 2026-05-26 20:15:30 +00:00 (Migrated from github.com)

Related to #549

If that bool is set should determine if we show onboarding or not.

In the case of this issue, with settings,json existing in the chosen path, Only show the mission statements and skip the persistant settings pieces like storage and connection.

Related to #549 If that bool is set should determine if we show onboarding or not. In the case of this issue, with settings,json existing in the chosen path, Only show the mission statements and skip the persistant settings pieces like storage and connection.
johnny9 commented 2026-05-26 20:24:41 +00:00 (Migrated from github.com)

Related to #405
Related to #406

Related to #405 Related to #406
jarolrod commented 2026-06-01 16:59:48 +00:00 (Migrated from github.com)

I’m working on a settings/onboarding QML branch that partially addresses this issue. This can be considered picked up for now; once the PR is ready, I’ll revisit whether it fully addresses this issue or whether follow-up work should remain tracked here.

I’m working on a settings/onboarding QML branch that partially addresses this issue. This can be considered picked up for now; once the PR is ready, I’ll revisit whether it fully addresses this issue or whether follow-up work should remain tracked here.
jarolrod commented 2026-06-29 16:26:36 +00:00 (Migrated from github.com)

For the first implementation, I’m intentionally choosing to show the full onboarding flow for an existing Core datadir when qml_onboarded has not been set yet.

The reason is partly my own choice and partly safety. Since the QML GUI is still experimental, I want existing Bitcoin Core users who try it for the first time to have an explicit chance to review the onboarding choices instead of silently skipping past storage and connection settings. In particular, showing the storage pages gives the user an escape hatch if they hadn't done so already to choose a different datadir for the experimental QML GUI rather than immediately reusing their existing Core datadir without confirmation.

My settings implementation rework overall still preserves existing settings: it preloads the resolved datadir/profile settings into onboarding, does not treat the profile as fresh, and avoids overwriting untouched settings. So this diverges from the issue’s originally proposed abbreviated onboarding flow, but it does so deliberately to make first-run QML onboarding safer for existing Core users as we demo.

If we still want the logic described here in this issue, we can open a follow-up issue specifying the need for the "what to show conditionals"

For the first implementation, I’m intentionally choosing to show the full onboarding flow for an existing Core datadir when `qml_onboarded` has not been set yet. The reason is partly my own choice and partly safety. Since the QML GUI is still experimental, I want existing Bitcoin Core users who try it for the first time to have an explicit chance to review the onboarding choices instead of silently skipping past storage and connection settings. In particular, showing the storage pages gives the user an escape hatch if they hadn't done so already to choose a different datadir for the experimental QML GUI rather than immediately reusing their existing Core datadir without confirmation. My settings implementation rework overall still preserves existing settings: it preloads the resolved datadir/profile settings into onboarding, does not treat the profile as fresh, and avoids overwriting untouched settings. So this diverges from the issue’s originally proposed abbreviated onboarding flow, but it does so deliberately to make first-run QML onboarding safer for existing Core users as we demo. If we still want the logic described here in this issue, we can open a follow-up issue specifying the need for the "what to show conditionals"
Sign in to join this conversation.
No description provided.