Skip to content

Add cmake, qt6, and bitcoin core submodule #475

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 29 commits into
base: qt6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fb278ed
Use QtQuick.Dialogs default version for Qt6 compatibility
pinheadmz Jul 11, 2025
3643091
StorageLocations: Qt 6 FileDialog has slightly different properties
pinheadmz Jul 11, 2025
52599cd
explicity capture `this` in lambdas as required by C++11
pinheadmz Jul 11, 2025
655d02f
QQueue requires cast qtsizetype to int
pinheadmz Jul 11, 2025
6af46c5
Qt6 changed RegExpValidator to RegularExpressionValidator
pinheadmz Jul 11, 2025
7fe6636
send: access declared property color
pinheadmz Jul 11, 2025
ddc8293
bitcoin.cpp: replace LogPrint with LogDebug
pinheadmz Jul 11, 2025
210439d
icons: copy bitcoin.png into qml/
pinheadmz Jul 11, 2025
1140537
use FoundBlock() interface instead of removed getBlockTime()
pinheadmz Jul 11, 2025
92b5f03
use *CACHE constants from bitcoin core
pinheadmz Jul 11, 2025
947e7df
update QSGRendererInterface strings
pinheadmz Jul 11, 2025
26042dd
use fs::path::utf8string()
pinheadmz Jul 11, 2025
4de5fd6
remove UPnP
pinheadmz Jul 11, 2025
e0e235b
nodemodel: copy ProxyAddress methods into qml/
pinheadmz Jul 11, 2025
4a67da8
temporarily revert PeersNumByType (needs follow-up)
pinheadmz Jul 11, 2025
ee7928a
Clean up Untranslated strings
pinheadmz Jul 11, 2025
a1e1ef8
bitcoin.cpp: rebase node initialization for upstream master
pinheadmz Jul 11, 2025
3a98d9f
copy qt/main.cpp and remove legacy GUI logic
pinheadmz Jul 11, 2025
764cb5e
update time offset from NodeStateStats
pinheadmz Jul 11, 2025
b3d78ad
options_model: #include chainstatemanager_args
pinheadmz Jul 11, 2025
08f97b8
remove "watch only" -- no longer possible with descriptor wallets
pinheadmz Jul 11, 2025
c2ac37d
listWalletDir() now returns vector of std::pair
pinheadmz Jul 11, 2025
7d7f55f
Use Txid instead of uint256
pinheadmz Jul 11, 2025
58f8d5a
CRecipient now takes CTxDestination not CScript
pinheadmz Jul 11, 2025
9020d75
include Bitcoin Core as a git submodule
pinheadmz Jul 11, 2025
c01451c
build with cmake
pinheadmz Jul 11, 2025
7573889
move qml/README to front page
pinheadmz Jul 11, 2025
1091c9f
Update README for qt6 and cmake
pinheadmz Jul 11, 2025
67423ba
build artifacts in CI
pinheadmz Jul 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright (c) 2025 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

name: Artifacts
on:
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request.
pull_request:
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push.
push:
branches:
- '**'
tags-ignore:
- '**'

jobs:
build:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [macos-14, ubuntu-22.04]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: MacOS Install Deps
if: contains(matrix.os, 'macos')
run: |
brew install cmake ccache boost pkgconf libevent qt@6 qrencode coreutils
echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV"

- name: Ubuntu Install Deps
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update && sudo apt-get install -y \
build-essential ccache cmake pkgconf \
libevent-dev libboost-dev libsqlite3-dev libgl-dev libqrencode-dev \
qt6-base-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools \
qt6-declarative-dev qml6-module-qtquick qml6-module-qtqml
echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV"

- name: Restore Ccache cache
uses: actions/cache/restore@v4
id: ccache-cache
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.os }}-ccache-${{ github.run_id }}
restore-keys: ${{ matrix.os }}-ccache-

- name: Build
run: |
git submodule update --init
if [[ "${{ matrix.os }}" == macos* ]]; then
export CPLUS_INCLUDE_PATH="$(brew --prefix boost)/include"
export LIBRARY_PATH="$(brew --prefix boost)/lib"
fi
cmake -B build
cmake --build build -j$(nproc)

- name: Save Ccache cache
uses: actions/cache/save@v4
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.os }}-ccache-${{ github.run_id }}

- uses: actions/upload-artifact@v4
with:
name: unsecure_${{ matrix.os }}_gui
path: build/bin/bitcoin-core-app

8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Build subdirectories.
/*build*
!/build-aux
!/build_msvc

*.pyc

/CMakeUserPresets.json
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "bitcoin"]
path = bitcoin
url = https://github.com/bitcoin/bitcoin
128 changes: 128 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
cmake_minimum_required(VERSION 3.22)

project(BitcoinCoreApp
DESCRIPTION "Bitcoin GUI"
HOMEPAGE_URL "https://bitcoincore.org/"
LANGUAGES CXX
)

# Language setup
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_HOST_APPLE)
# We do not use the install_name_tool when cross-compiling for macOS.
# So disable this tool check in further enable_language() commands.
set(CMAKE_PLATFORM_HAS_INSTALLNAME FALSE)
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Set top-level target output locations.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)

# Include Find*.cmake files
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)

# Qt dependencies QML
set(qt_components Core Gui LinguistTools Widgets Qml Quick QuickControls2)
find_package(Qt 6.2 MODULE REQUIRED
COMPONENTS ${qt_components}
)
find_package(Libevent 2.1.8 MODULE REQUIRED)

# Do not build any executable targets from bitcoin submodule
set(BUILD_BENCH OFF)
set(BUILD_BITCOIN_BIN OFF)
set(BUILD_CLI OFF)
set(BUILD_DAEMON OFF)
set(BUILD_FOR_FUZZING OFF)
set(BUILD_FUZZ_BINARY OFF)
set(BUILD_GUI_TESTS OFF)
set(BUILD_KERNEL_LIB OFF)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_TESTS OFF)
set(BUILD_TX OFF)
set(BUILD_UTIL OFF)
set(BUILD_UTIL_CHAINSTATE OFF)
set(BUILD_WALLET_TOOL OFF)
# We need this libraries, can ignore the executable bitcoin-qt
set(BUILD_GUI ON)
set(ENABLE_WALLET ON)

# Bitcoin Core codebase
# Builds libraries: univalue, core_interface, bitcoin_node, bitcoin_wallet
add_subdirectory(bitcoin)

# Qt-specific commands
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOMOC_MOC_OPTIONS "-p${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# but don't let Qt interfere with bitcoin core libraries
set_target_properties(bitcoin_wallet PROPERTIES AUTOUIC OFF)

# Compile Qt+QML sources
set(CMAKE_AUTOMOC_MOC_OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/qml")
file(GLOB_RECURSE QML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/qml/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/qml/*.h")
list(FILTER QML_SOURCES EXCLUDE REGEX "androidnotifier\\.(cpp|h)$")
set(QML_QRC "${CMAKE_CURRENT_SOURCE_DIR}/qml/bitcoin_qml.qrc")
qt6_add_resources(QML_QRC_CPP ${QML_QRC})
list(APPEND QML_SOURCES ${QML_QRC_CPP})
list(APPEND QML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/bitcoin/src/init/bitcoin-qt.cpp")

# Build QML library
add_library(bitcoinqml STATIC ${QML_SOURCES})
# Prevent Qt macros like "signal" from polluting bitcoin core code
target_compile_definitions(bitcoinqml
PUBLIC
QT_NO_KEYWORDS
QT_USE_QSTRINGBUILDER
)
target_include_directories(bitcoinqml
PRIVATE
# to keep the convention of #include <qml/*.h>
${CMAKE_CURRENT_SOURCE_DIR}

# for interfaces consensus chainparams etc...
${CMAKE_CURRENT_SOURCE_DIR}/bitcoin/src

# for qt/guiutil.h qt/peertablemodel.h qt/rpcconsole.h etc...
${CMAKE_CURRENT_SOURCE_DIR}/bitcoin/src/qt

# for bitcoin-build-config.h
${CMAKE_CURRENT_BINARY_DIR}/bitcoin/src
)
target_link_libraries(bitcoinqml
PUBLIC
core_interface
bitcoin_node
univalue
Qt6::Qml
Qt6::Quick
Qt6::QuickControls2
Qt6::Widgets
)

# Put it all together
add_executable(bitcoin-core-app main.cpp)
target_include_directories(bitcoin-core-app
PRIVATE
# to keep the convention of #include <qml/*.h>
${CMAKE_CURRENT_SOURCE_DIR}

# for interfaces compat util etc...
${CMAKE_CURRENT_SOURCE_DIR}/bitcoin/src

# for bitcoin-build-config.h
${CMAKE_CURRENT_BINARY_DIR}/bitcoin/src
)
target_link_libraries(bitcoin-core-app
PRIVATE
univalue
core_interface
bitcoin_node
bitcoinqml
bitcoinqt
)
85 changes: 52 additions & 33 deletions qml/README.md → README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Bitcoin Core QML GUI
# Bitcoin Core App

*(The QML GUI)*

**WARNING: THIS IS EXPERIMENTAL, DO NOT USE BUILDS FROM THIS REPO FOR REAL TRANSACTIONS!**

This directory contains the source code for an experimental Bitcoin Core graphical user interface (GUI) built using the [Qt Quick](https://doc.qt.io/qt-5/qtquick-index.html) framework.
This directory contains the source code for an experimental Bitcoin Core graphical user interface (GUI) built using the [Qt Quick](https://doc.qt.io/qt-6/qtquick-index.html) framework.

Unsecure CI artifacts are available for local testing of the master branch, avoiding the need to build. These can be found under the [Actions](https://github.com/bitcoin-core/gui-qml/actions?query=branch%3Amain) tab. It is required to have and be logged into a github account in order to download these.
Unsecure CI artifacts are available for local testing of the master branch, avoiding the need to build. These can be found under the [Actions](https://github.com/bitcoin-core/gui-qml/actions?query=branch%3Aqt6) tab. It is required to have and be logged into a github account in order to download these.

Note: For macOS, the CI artifact binary must be made executable and code-signed before it can
be ran. To make executable and apply a signature, run the following on the unzipped CI artifact:

```
chmod +x ./Downloads/bitcoin-qt && codesign -s - ./Downloads/bitcoin-qt
chmod +x ./Downloads/bitcoin-core-app && codesign -s - ./Downloads/bitcoin-core-app
```

## Goals and Limitations
Expand All @@ -25,24 +27,22 @@ The primary goals of the project can be summed up as follows:
- Work alongside the Bitcoin Design community to develop an aesthetic GUI
- Develop a mobile-optimized GUI

We must avoid conflicts with the Bitcoin Core repo.
As such, this project will aim to make very few changes outside of the qml directory.
Pull requests must be focused on developing the GUI itself, adding build support,
or improving relevant documentation.
Avoid conflicts with the Bitcoin Core repository by importing it unmodified as a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
As such, this project **can not** accept pull requests making any significant changes unrelated to the GUI.
Pull requests must be focused on developing the GUI itself, adding build support, or improving relevant documentation.

This project will **not** accept pull requests making any significant changes unrelated to the GUI.

## Development Process

This repo is synced with the [Bitcoin Core repo](https://github.com/bitcoin/bitcoin) on a weekly basis, or as needed to resolve conflicts.
This repo is synced with the [Bitcoin Core repo](https://github.com/bitcoin/bitcoin) on a regular basis.

Contributions are welcome from all, developers and designers. If you are a new contributor, please read [CONTRIBUTING.md](../../CONTRIBUTING.md).
Contributions are welcome from all, developers and designers. If you are a new contributor, please read [CONTRIBUTING.md](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md).

### Minimum Required Qt Version

All development must adhere to the current upstream Qt Version to minimize our divergence from upstream and avoid costly changes. Review of open PR's must ensure that changes are compatible with this Qt version. Currently, the required version is [Qt 5.15.2](https://github.com/bitcoin-core/gui-qml/blob/main/depends/packages/qt.mk#L2).
All development must adhere to the current upstream Qt Version to minimize our divergence from upstream and avoid costly changes. Review of open PR's must ensure that changes are compatible with this Qt version. Currently, the required version is [Qt 6.2](https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md#build-1).

As the Qt Version changes upstream, refactoring is allowed to use the now available features.
As the Qt Version changes upstream, refactoring is allowed to use the newly available features.

### Policies

Expand All @@ -52,50 +52,69 @@ This project has custom policies for development, see:

## Compile and Run

The master branch is only guaranteed to work and build on Debian-based systems, Fedora, and macOS.
The master branch is only guaranteed to work and build on Debian-based systems and macOS.
Support for more systems will be confirmed and documented as the project matures.

### Dependencies
No additional dependencies, besides those in [build-osx.md](../../doc/build-osx.md), are needed for macOS.

Aside from the dependencies listed in [build-unix.md](../../doc/build-unix.md), the following additional dependencies are required to compile:
Bitcoin Core App requires all the same dependencies as Bitcoin Core, see the
appropriate document for your platform:

- [build-osx.md](https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md)

- [build-unix.md](https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md)

In addition the following dependencies are required for the GUI:

#### Debian-based systems:

```
sudo apt install qtdeclarative5-dev qtquickcontrols2-5-dev
sudo apt install \
qt6-base-dev \
qt6-tools-dev \
qt6-l10n-tools \
qt6-tools-dev-tools \
qt6-declarative-dev \
qml6-module-qtquick \
qml6-module-qtqml \
libgl-dev \
libqrencode-dev
```

The following runtime dependencies are also required for dynamic builds;
they are not needed for static builds:
Additionally, to support Wayland protocol for modern desktop environments:

```
sudo apt install qml-module-qtquick2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-layouts qml-module-qtquick-window2 qml-module-qt-labs-settings
sudo apt install qt6-wayland
```
##### Important:

If you're unable to install the dependencies through your system's package manager, you can instead perform a [depends build](../../depends/README.md).

#### Fedora:
#### macOS:

```
sudo dnf install qt5-qtdeclarative-devel qt5-qtquickcontrols qt5-qtquickcontrols2-devel
brew install qt@6 qrencode
```

### Build

For instructions on how to build and compile Bitcoin Core, refer to your respective system's build doc.

As long as the required dependencies are installed, the qml GUI will be built.
To ensure that you are in fact building the qml GUI, you can configure with the following option:

1. Install the required dependencies for your platform and clone the repository
2. Fetch the Bitcoin Core submodule:
```
./configure --with-qml
git submodule update --init
```
3. Configure
```
cmake -B build
```
4. Build
```
cmake --build build -j$(nproc)
```

### Run

To run the qml GUI:
Binaries are exported to the `build/` directory:
```
./src/qt/bitcoin-qt
build/bin/bitcoin-core-app
```



1 change: 1 addition & 0 deletions bitcoin
Submodule bitcoin added at 8ffbd7
Loading
Loading