dash/src/qt
Samuel Dobson f812de4e66 Merge #18115: wallet: Pass in transactions and messages for signing instead of exporting the private keys
d2774c09cfcc6c5c967d40bb094eabc8c0bdb6bf Clear any input_errors for an input after it is signed (Andrew Chow)
dc174881ad8498a6905ba282a48077bc5c8037a7 Replace GetSigningProvider with GetSolvingProvider (Andrew Chow)
6a9c429084b40356aa36aa67992da35f61c2f6a2 Move direct calls to MessageSign into new SignMessage functions in CWallet and ScriptPubKeyMan (Andrew Chow)
82a30fade70a2a95c2bbeac4aa06dafda600479d Move key and script filling and signing from CWallet::FillPSBT to ScriptPubKeyMan::FillPSBT (Andrew Chow)
3d70dd99f9f74eef70b19ff6f6f850adc0d5ef8f Move FillPSBT to be a member of CWallet (Andrew Chow)
a4af324d15c1ee43c2abd11a304ae18c7ee82eb0 Use CWallet::SignTransaction in CreateTransaction and signrawtransactionwithwallet (Andrew Chow)
f37de927442d3f024926a66c436d59e391c8696a Implement CWallet::SignTransaction using ScriptPubKeyMan::SignTransaction (Andrew Chow)
d999dd588cab0ff479bc7bee8c9fc33880265ec6 Add SignTransaction function to ScriptPubKeyMan and LegacyScriptPubKeyMan (Andrew Chow)
2c52b59d0a44a86d94fee4e437978d822862c542 Refactor rawtransaction's SignTransaction into generic SignTransaction function (Andrew Chow)

Pull request description:

  Following #17261, the way to sign transactions, PSBTs, and messages was to use `GetSigningProvider()` and get a `SigningProvider` containing the private keys. However this may not be feasible for future `ScriptPubKeyMan`s, such as for hardware wallets. Instead of exporting a `SigningProvider` containing private keys, we need to pass these things into the `ScriptPubKeyMan` (via `CWallet`) so that they can do whatever is needed internally to sign them. This is largely a refactor as the logic of processing transactions, PSBTs, and messages for is moved into `LegacyScriptPubKeyMan` and `CWallet` instead of being handled by the caller (e.g. `signrawtransaction`).

  To help with this, I've refactored the 3(!) implementations of a `SignTransaction()` function into one generic one. This function will be called by `signrawtransactionwithkey` and `LegacyScriptPubKeyMan::SignTransaction()`. `CWallet::CreateTransaction()` is changed to call `CWallet::SignTransaction()` which in turn, calls `LegacyScriptPubKeyMan::SignTransaction()`. Other `ScriptPubKeyMan`s may implement `SignTransaction()` differently.

  `FillPSBT()` is moved to be a member function of `CWallet` and the `psbtwallet.cpp/h` files removed. It is further split so that `CWallet` handles filling the UTXOs while the `ScriptPubKeyMan` handles adding keys, derivation paths, scripts, and signatures. In the end `LegacyScriptPubKeyMan::FillPSBT` still calls `SignPSBTInput`, but the `SigningProvider` is internal to `LegacyScriptPubKeyMan`. Other `ScriptPubKeyMan`s may do something different.

  A new `SignMessage()` function is added to both `CWallet` and `ScriptPubKeyMan`. Instead of having the caller (i.e. `signmessage` or the sign message dialog) get the private key, hash the message, and sign, `ScriptPubKeyMan` will now handle that (`CWallet` passes through to the `ScriptPubKeyMan`s as it does for many functions). This signing code is thus consolidated into `LegacyScriptPubKeyMan::SignMessage()`, though other `ScriptPubKeyMan`s may implement it differently. Additionally, a `SigningError` enum is introduced for the different errors that we expect to see from `SignMessage()`.

  Lastly, `GetSigningProvider()` is renamed to `GetPublicSigningProvider()`. It will now only provide pubkeys, key origins, and scripts. `LegacySigningProvider` has it's `GetKey` and `HaveKey` functions changed to only return false. Future implementations should return `HidingSigningProvider`s where private keys are hidden.

  Other things like `dumpprivkey` and `dumpwallet` are not changed because they directly need and access the `LegacyScriptPubKeyMan` so are not relevant to future changes.

ACKs for top commit:
  instagibbs:
    reACK d2774c09cf
  Sjors:
    re-utACK d2774c09cfcc6c5c967d40bb094eabc8c0bdb6bf
  meshcollider:
    re-utACK d2774c09cfcc6c5c967d40bb094eabc8c0bdb6bf

Tree-SHA512: 89c83e7e7e9315e283fae145a2264648a9d7f7ace8f3281cb3f44f0b013c988d67ba4fa9726e50c643c0ed921bdd269adaec984840d11acf4a681f3e8a582cc1
2023-03-19 11:08:31 -05:00
..
android
forms fix(gui): remove "Upgrade wallet format" button from "Wallet Repair" tab 2023-02-17 14:21:19 -06:00
locale Merge pull request #4478 from kittywhiskers/undashify 2022-08-11 12:34:55 -04:00
res Merge #20223: build: Drop the leading 0 from the version number 2022-04-28 13:47:53 +03:00
test Merge #17261: Make ScriptPubKeyMan an actual interface and the wallet to have multiple 2023-03-19 11:08:31 -05:00
addressbookpage.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
addressbookpage.h
addresstablemodel.cpp merge bitcoin#20480: Replace boost::variant with std::variant 2022-10-20 16:08:45 -05:00
addresstablemodel.h
appearancewidget.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
appearancewidget.h chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
askpassphrasedialog.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
askpassphrasedialog.h merge bitcoin#15450: Create wallet menu option 2022-04-06 13:49:58 +05:30
bantablemodel.cpp Merge #18036: gui: Break trivial circular dependencies 2022-10-16 13:06:40 -05:00
bantablemodel.h Merge #18036: gui: Break trivial circular dependencies 2022-10-16 13:06:40 -05:00
bitcoin.cpp trivial: revert dashification of source and header filenames 2022-08-09 14:16:29 +05:30
bitcoin.h trivial: revert dashification of header guards 2022-08-09 14:16:29 +05:30
bitcoinaddressvalidator.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
bitcoinaddressvalidator.h
bitcoinamountfield.cpp Merge #14608: qt: Remove the "Pay only required fee..." checkbox 2022-05-30 01:11:05 -04:00
bitcoinamountfield.h Merge #14608: qt: Remove the "Pay only required fee..." checkbox 2022-05-30 01:11:05 -04:00
bitcoingui.cpp fix(qt): Overview page should always be accessible (#5221) 2023-02-27 11:50:02 -06:00
bitcoingui.h revert: revert bitcoin#15454 (Remove the automatic creation and loading of the default wallet) 2022-12-04 18:02:40 -06:00
bitcoinunits.cpp chore: bump copyrights (#4873) 2022-06-08 02:36:46 +03:00
bitcoinunits.h chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
clientmodel.cpp refactor: migrate globals to managed pointers in preparation for deglobalization (#4930) 2022-08-26 16:52:53 -05:00
clientmodel.h refactor: migrate globals to managed pointers in preparation for deglobalization (#4930) 2022-08-26 16:52:53 -05:00
coincontroldialog.cpp Merge #15452: Replace CScriptID and CKeyID in CTxDestination with dedicated types 2023-02-10 23:34:57 +03:00
coincontroldialog.h
coincontroltreewidget.cpp
coincontroltreewidget.h
createwalletdialog.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
createwalletdialog.h Merge #16822: gui: Create wallet menu option follow-ups 2022-04-11 09:40:27 -07:00
csvmodelwriter.cpp
csvmodelwriter.h
dash_locale.qrc
dash.qrc
dashstrings.cpp merge bitcoin#21694: Use XLIFF file to provide more context to Transifex translators 2022-06-11 21:03:04 +05:30
editaddressdialog.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
editaddressdialog.h
governancelist.cpp chore: add missing copyrights via copyright_header.py insert 2023-01-13 00:49:04 +03:00
governancelist.h chore: add missing copyrights via copyright_header.py insert 2023-01-13 00:49:04 +03:00
guiconstants.h chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
guiutil.cpp merge bitcoin#21016: remove boost::thread_group usage 2023-01-19 03:42:51 +00:00
guiutil.h Merge #17826: qt: Log Qt related info 2022-06-17 04:06:49 +07:00
intro.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
intro.h
macdockiconhandler.h
macdockiconhandler.mm
macnotificationhandler.h
macnotificationhandler.mm
macos_appnap.h
macos_appnap.mm
main.cpp trivial: revert dashification of source and header filenames 2022-08-09 14:16:29 +05:30
masternodelist.cpp feat(qt): add MN type to MN tab (#5201) 2023-02-15 22:59:54 +02:00
masternodelist.h feat(qt): add MN type to MN tab (#5201) 2023-02-15 22:59:54 +02:00
modaloverlay.cpp Merge #15084: gui: don't disable the sync overlay when wallet is disabled 2022-06-18 17:19:47 +05:30
modaloverlay.h Merge #15084: gui: don't disable the sync overlay when wallet is disabled 2022-06-18 17:19:47 +05:30
networkstyle.cpp chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
networkstyle.h chore: run copyright_header.py update 2023-01-13 00:49:04 +03:00
notificator.cpp
notificator.h partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
openuridialog.cpp chore: bump copyrights (#4873) 2022-06-08 02:36:46 +03:00
openuridialog.h merge #17165: Remove BIP70 support (#4023) 2022-04-25 12:01:47 +03:00
optionsdialog.cpp refactor: implement c++23 inspired ToUnderlying (#5210) 2023-02-20 13:12:12 +03:00
optionsdialog.h merge bitcoin#21328: pass uint16 CService::port as uint16 2022-11-01 00:28:53 -05:00
optionsmodel.cpp merge bitcoin#18134: Replace std::to_string with locale-independent alternative 2023-01-02 14:19:33 -06:00
optionsmodel.h merge bitcoin#19314: Use uint16_t instead of unsigned short 2022-10-20 16:08:45 -05:00
overviewpage.cpp merge bitcoin#21016: remove boost::thread_group usage 2023-01-19 03:42:51 +00:00
overviewpage.h
paymentserver.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
paymentserver.h partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
peertablemodel.cpp Merge #18060: gui: Drop PeerTableModel dependency to ClientModel 2022-10-16 13:06:40 -05:00
peertablemodel.h Merge #18060: gui: Drop PeerTableModel dependency to ClientModel 2022-10-16 13:06:40 -05:00
qrdialog.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
qrdialog.h refactor(qt): Reuse QRImageWidget in QRDialog (#4853) 2022-06-11 12:18:01 +03:00
qrimagewidget.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
qrimagewidget.h
qvalidatedlineedit.cpp
qvalidatedlineedit.h
qvaluecombobox.cpp
qvaluecombobox.h
README.md merge #17165: Remove BIP70 support (#4023) 2022-04-25 12:01:47 +03:00
receivecoinsdialog.cpp qt: adds more setPlaceholderText by form .ui instead code aproach 2022-05-30 19:09:39 +07:00
receivecoinsdialog.h
receiverequestdialog.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
receiverequestdialog.h
recentrequeststablemodel.cpp Merge #17634: qt: Fix comparison function signature 2022-06-16 01:34:38 -04:00
recentrequeststablemodel.h Merge #17634: qt: Fix comparison function signature 2022-06-16 01:34:38 -04:00
rpcconsole.cpp refactor: implement c++23 inspired ToUnderlying (#5210) 2023-02-20 13:12:12 +03:00
rpcconsole.h fix(gui): remove "Upgrade wallet format" button from "Wallet Repair" tab 2023-02-17 14:21:19 -06:00
sendcoinsdialog.cpp Merge #18115: wallet: Pass in transactions and messages for signing instead of exporting the private keys 2023-03-19 11:08:31 -05:00
sendcoinsdialog.h Merge #16944: gui: create PSBT with watch-only wallet 2023-02-04 10:02:37 -06:00
sendcoinsentry.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
sendcoinsentry.h
signverifymessagedialog.cpp Merge #18115: wallet: Pass in transactions and messages for signing instead of exporting the private keys 2023-03-19 11:08:31 -05:00
signverifymessagedialog.h
splashscreen.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
splashscreen.h merge #19099: refactor: Move wallet methods out of chain.h and node.h 2022-06-21 19:08:57 +05:30
trafficgraphdata.cpp chore: add missing copyrights via copyright_header.py insert 2023-01-13 00:49:04 +03:00
trafficgraphdata.h chore: add missing copyrights via copyright_header.py insert 2023-01-13 00:49:04 +03:00
trafficgraphwidget.cpp
trafficgraphwidget.h
transactiondesc.cpp partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
transactiondesc.h
transactiondescdialog.cpp
transactiondescdialog.h
transactionfilterproxy.cpp
transactionfilterproxy.h
transactionrecord.cpp merge bitcoin#20480: Replace boost::variant with std::variant 2022-10-20 16:08:45 -05:00
transactionrecord.h
transactiontablemodel.cpp Merge #15098: qt: Show addresses for "SendToSelf" transactions 2022-06-18 17:19:46 +05:30
transactiontablemodel.h
transactionview.cpp feat(qt): Let users resend stuck txes one by one via context menu (#4861) 2022-06-08 00:07:27 +03:00
transactionview.h feat(qt): Let users resend stuck txes one by one via context menu (#4861) 2022-06-08 00:07:27 +03:00
utilitydialog.cpp Merge #18036: gui: Break trivial circular dependencies 2022-10-16 13:06:40 -05:00
utilitydialog.h Merge #18036: gui: Break trivial circular dependencies 2022-10-16 13:06:40 -05:00
walletcontroller.cpp merge bitcoin#19619: Remove wallet.dat path handling from wallet.cpp, rpcwallet.cpp 2022-10-17 08:03:10 +05:30
walletcontroller.h merge bitcoin#16923: Handle duplicate fileid exception 2022-05-13 18:04:31 +05:30
walletframe.cpp fix(qt): Overview page should always be accessible (#5221) 2023-02-27 11:50:02 -06:00
walletframe.h fix(qt): Overview page should always be accessible (#5221) 2023-02-27 11:50:02 -06:00
walletmodel.cpp fix(qt): Ignore change output in reassignAmounts (#5182) 2023-02-09 03:19:49 +03:00
walletmodel.h partial revert dash#2911: s/dash-config/bitcoin-config/g 2022-08-09 14:16:28 +05:30
walletmodeltransaction.cpp fix(qt): Ignore change output in reassignAmounts (#5182) 2023-02-09 03:19:49 +03:00
walletmodeltransaction.h fix(qt): Ignore change output in reassignAmounts (#5182) 2023-02-09 03:19:49 +03:00
walletview.cpp Merge bitcoin-core/gui#11: Remove needless headers from qt/walletview.cpp 2023-01-22 00:27:52 -06:00
walletview.h Merge #18062: gui: Fix unintialized WalletView::progressDialog 2022-10-16 13:06:40 -05:00
winshutdownmonitor.cpp
winshutdownmonitor.h

This directory contains the DashQT graphical user interface (GUI). It uses the cross-platform framework Qt.

The current precise version for Qt 5 is specified in qt.mk. Qt 4 is not supported.

Compile and run

See build instructions (macOS, Windows, Unix, etc).

To run:

./src/qt/dash-qt

Files and directories

forms

Contains Designer UI files. They are created with Qt Creator, but can be edited using any text editor.

locale

Contains translations. They are periodically updated. The process is described here.

res

Resources such as the icon.

test

Tests.

bitcoingui.(h/cpp)

Represents the main window of the Dash UI.

*model.(h/cpp)

The model. When it has a corresponding controller, it generally inherits from QAbstractTableModel. Models that are used by controllers as helpers inherit from other Qt classes like QValidator.

ClientModel is used by the main application bitcoingui and several models like peertablemodel.

*page.(h/cpp)

A controller. :NAMEpage.cpp generally includes :NAMEmodel.h and forms/:NAME.page.ui with a similar :NAME.

*dialog.(h/cpp)

Various dialogs, e.g. to open a URL. Inherit from QDialog.

paymentserver.(h/cpp)

Used to process BIP21 payment URI requests. Also handles URI based application switching (e.g. when following a dash:... link from a browser).

walletview.(h/cpp)

Represents the view to a single wallet.

Other .h/cpp files

  • UI elements like BitcoinAmountField, which inherit from QWidget.
  • bitcoinstrings.cpp: automatically generated
  • bitcoinunits.(h/cpp): BTC / mBTC / etc handling
  • callback.h
  • guiconstants.h: UI colors, app name, etc
  • guiutil.h: several helper functions
  • macdockiconhandler.(h/mm): macOS dock icon handler
  • macnotificationhandler.(h/mm): display notifications in macOS

Contribute

See CONTRIBUTING.md for general guidelines. Specifically for Qt:

Using Qt Creator as IDE

You can use Qt Creator as an IDE. This is especially useful if you want to change the UI layout.

Download and install the community edition of Qt Creator. Uncheck everything except Qt Creator during the installation process.

Instructions for macOS:

  1. Make sure you installed everything through Homebrew mentioned in the macOS build instructions
  2. Use ./configure with the --enable-debug flag
  3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
  4. Enter "dash-qt" as project name, enter src/qt as location
  5. Leave the file selection as it is
  6. Confirm the "summary page"
  7. In the "Projects" tab select "Manage Kits..."
  8. Select the default "Desktop" kit and select "Clang (x86 64bit in /usr/bin)" as compiler
  9. Select LLDB as debugger (you might need to set the path to your installation)
  10. Start debugging with Qt Creator (you might need to the executable to "dash-qt" under "Run", which is where you can also add command line arguments)