From e1828206dcc4c46b97ccce07ddbb3d03b54164d9 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 22 Oct 2021 13:30:44 +0200 Subject: [PATCH 1/4] Merge bitcoin/bitcoin#23002: Make descriptor wallets by default 9c1052a5218e191fd23c0d9fc06f2fca34b03411 wallet: Default new wallets to descriptor wallets (Andrew Chow) f19ad404631010a5e2dac2c7cbecd057b005fe2a rpc, wallet: Descriptor wallets are no longer experimental (Andrew Chow) Pull request description: Changes the default wallet type from legacy to descriptors. Descriptor wallets will now by the default type. Additionally, descriptor wallets will no longer be marked as experimental. This follows the timeline proposed in #20160 ACKs for top commit: lsilva01: Tested ACK https://github.com/bitcoin/bitcoin/pull/23002/commits/9c1052a5218e191fd23c0d9fc06f2fca34b03411 on Ubuntu 20.04 prayank23: tACK https://github.com/bitcoin/bitcoin/pull/23002/commits/9c1052a5218e191fd23c0d9fc06f2fca34b03411 meshcollider: Code review ACK 9c1052a5218e191fd23c0d9fc06f2fca34b03411 Tree-SHA512: 834e6fec88e0c18673af7ebe135bd5333694d1be502164eb93a90e3e76c27974165aa4e59426945100c88e4eca07356e16886ef5b05cf789683ecb23fc71a12a --- src/bitcoin-wallet.cpp | 1 + src/qt/forms/createwalletdialog.ui | 3 +++ src/wallet/rpc/wallet.cpp | 10 +++++----- src/wallet/wallettool.cpp | 18 +++++++++++++++++- test/functional/tool_wallet.py | 4 ++-- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index 21669542cd79..be9ba957ec4b 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -39,6 +39,7 @@ static void SetupWalletToolArgs(ArgsManager& argsman) argsman.AddArg("-dumpfile=", "When used with 'dump', writes out the records to this file. When used with 'createfromdump', loads the records into a new wallet.", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::OPTIONS); argsman.AddArg("-debug=", "Output debugging information (default: 0).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); argsman.AddArg("-descriptors", "Create descriptors wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); + argsman.AddArg("-legacy", "Create legacy wallet. Only for 'create'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-format=", "The format of the wallet file to create. Either \"bdb\" or \"sqlite\". Only used with 'createfromdump'", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS); argsman.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -debug is true, 0 otherwise).", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); diff --git a/src/qt/forms/createwalletdialog.ui b/src/qt/forms/createwalletdialog.ui index 8d1d64245735..9e739d4bda29 100644 --- a/src/qt/forms/createwalletdialog.ui +++ b/src/qt/forms/createwalletdialog.ui @@ -128,6 +128,9 @@ Descriptor Wallet + + true + diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index 8517754e2d90..e3a4e43d6cf9 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -634,7 +634,7 @@ static RPCHelpMan createwallet() {"blank", RPCArg::Type::BOOL, RPCArg::Default{false}, "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using upgradetohd (by mnemonic) or sethdseed (WIF private key)."}, {"passphrase", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Encrypt the wallet with this passphrase."}, {"avoid_reuse", RPCArg::Type::BOOL, RPCArg::Default{false}, "Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind."}, - {"descriptors", RPCArg::Type::BOOL, RPCArg::Default{false}, "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation."}, + {"descriptors", RPCArg::Type::BOOL, RPCArg::Default{true}, "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation."}, {"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."}, {"external_signer", RPCArg::Type::BOOL, RPCArg::Default{false}, "Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true."}, }, @@ -676,13 +676,13 @@ static RPCHelpMan createwallet() if (!request.params[4].isNull() && request.params[4].get_bool()) { flags |= WALLET_FLAG_AVOID_REUSE; } - if (!request.params[5].isNull() && request.params[5].get_bool()) { + if (!request.params[5].isNull() && request.params[6].isNull()) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "The createwallet RPC requires specifying the 'load_on_startup' flag when param 'descriptors' is specified. Dash Core v21 introduced this requirement due to breaking changes in the createwallet RPC."); + } + if (request.params[5].isNull() || request.params[5].get_bool()) { #ifndef USE_SQLITE throw JSONRPCError(RPC_WALLET_ERROR, "Compiled without sqlite support (required for descriptor wallets)"); #endif - if (request.params[6].isNull()) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "The createwallet RPC requires specifying the 'load_on_startup' flag when creating descriptor wallets. Dash Core v21 introduced this requirement due to breaking changes in the createwallet RPC."); - } flags |= WALLET_FLAG_DESCRIPTORS; } if (!request.params[7].isNull() && request.params[7].get_bool()) { diff --git a/src/wallet/wallettool.cpp b/src/wallet/wallettool.cpp index 1d0537f849dd..e6235f31fd69 100644 --- a/src/wallet/wallettool.cpp +++ b/src/wallet/wallettool.cpp @@ -134,6 +134,10 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command) tfm::format(std::cerr, "The -descriptors option can only be used with the 'create' command.\n"); return false; } + if (args.IsArgSet("-legacy") && command != "create") { + tfm::format(std::cerr, "The -legacy option can only be used with the 'create' command.\n"); + return false; + } if (command == "create" && !args.IsArgSet("-wallet")) { tfm::format(std::cerr, "Wallet name must be provided when creating a new wallet.\n"); return false; @@ -145,7 +149,19 @@ bool ExecuteWalletToolFunc(const ArgsManager& args, const std::string& command) DatabaseOptions options; ReadDatabaseArgs(args, options); options.require_create = true; - if (args.GetBoolArg("-descriptors", false)) { + // If -legacy is set, use it. Otherwise default to false. + bool make_legacy = args.GetBoolArg("-legacy", false); + // If neither -legacy nor -descriptors is set, default to true. If -descriptors is set, use its value. + bool make_descriptors = (!args.IsArgSet("-descriptors") && !args.IsArgSet("-legacy")) || (args.IsArgSet("-descriptors") && args.GetBoolArg("-descriptors", true)); + if (make_legacy && make_descriptors) { + tfm::format(std::cerr, "Only one of -legacy or -descriptors can be set to true, not both\n"); + return false; + } + if (!make_legacy && !make_descriptors) { + tfm::format(std::cerr, "One of -legacy or -descriptors must be set to true (or omitted)\n"); + return false; + } + if (make_descriptors) { options.create_flags |= WALLET_FLAG_DESCRIPTORS; options.require_format = DatabaseFormat::SQLITE; } diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py index 6c383b34f81a..a5e93ba24d6e 100755 --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -32,8 +32,8 @@ def skip_test_if_missing_module(self): def dash_wallet_process(self, *args): default_args = ['-datadir={}'.format(self.nodes[0].datadir), '-chain=%s' % self.chain] - if self.options.descriptors and 'create' in args: - default_args.append('-descriptors') + if not self.options.descriptors and 'create' in args: + default_args.append('-legacy') return subprocess.Popen([self.options.bitcoinwallet] + default_args + list(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) From e7e14e32f3d6d073456dda17e5272d32bbedaefa Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Wed, 16 Mar 2022 16:25:49 -0400 Subject: [PATCH 2/4] Merge bitcoin/bitcoin#24519: doc: update multisig-tutorial.md to descriptor wallet by default 5347c9732ff24bfcdcd62d0291972c86c80558dc doc: update multisig-tutorial.md to default wallet type (Jon Atack) Pull request description: Follow-up to #24281 and https://github.com/bitcoin/bitcoin/pull/24281#issuecomment-1033996386. The default wallet type was changed to descriptor wallets in #23002. ACKs for top commit: laanwj: ACK 5347c9732ff24bfcdcd62d0291972c86c80558dc michaelfolkson: ACK 5347c9732ff24bfcdcd62d0291972c86c80558dc achow101: ACK 5347c9732ff24bfcdcd62d0291972c86c80558dc theStack: Concept and code-review ACK 5347c9732ff24bfcdcd62d0291972c86c80558dc Tree-SHA512: 8074a33ad253ecb7d3f78645a00c808c7c224996cc1748067928aa59ef31a58f24fcfc75169494b26a19c7fbbf23bbd78516ab4102bc52fa92f08f1f49b18b63 --- doc/multisig-tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/multisig-tutorial.md b/doc/multisig-tutorial.md index 479f03f0384d..82dca25b99cd 100644 --- a/doc/multisig-tutorial.md +++ b/doc/multisig-tutorial.md @@ -27,7 +27,7 @@ These three wallets should not be used directly for privacy reasons (public key ```bash for ((n=1;n<=3;n++)) do - ./src/dash-cli -testnet -named createwallet wallet_name="participant_${n}" descriptors=true + ./src/dash-cli -testnet createwallet "participant_${n}" done ``` @@ -105,7 +105,7 @@ Then import the descriptors created in the previous step using the `importdescri After that, `getwalletinfo` can be used to check if the wallet was created successfully. ```bash -./src/dash-cli -testnet -named createwallet wallet_name="multisig_wallet_01" disable_private_keys=true blank=true descriptors=true +./src/dash-cli -testnet -named createwallet wallet_name="multisig_wallet_01" disable_private_keys=true blank=true ./src/dash-cli -testnet -rpcwallet="multisig_wallet_01" importdescriptors "$multisig_desc" From 1cb63a87932c09e2ee8ccc3378c41ce8a29d8453 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 17 Feb 2022 17:05:50 -0500 Subject: [PATCH 3/4] Merge bitcoin/bitcoin#24281: docs: Update to match new default wallet type 8e9699cb10db9cce9f03675c4a5b625ff2f34fd0 Update doc to match new default wallet type (Bitcoin Hodler) Pull request description: #23002 changed the default wallet type to descriptors, so this doc was out of date. ACKs for top commit: achow101: ACK 8e9699cb10db9cce9f03675c4a5b625ff2f34fd0 Tree-SHA512: 2f69b23c153163bf2a091dbf728b713d28f795cc81e031bf201160882d2456494e94955ff6385634615fdcfece11542749ad1c982e2994e64ed69011380a2353 --- doc/managing-wallets.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/managing-wallets.md b/doc/managing-wallets.md index 7096b6286249..584892fba64a 100644 --- a/doc/managing-wallets.md +++ b/doc/managing-wallets.md @@ -12,11 +12,9 @@ In the GUI, the `Create a new wallet` button is displayed on the main screen whe The following command, for example, creates a descriptor wallet. More information about this command may be found by running `dash-cli help createwallet`. ``` -$ dash-cli -named createwallet wallet_name="wallet-01" descriptors=true +$ dash-cli createwallet "wallet-01" ``` -The `descriptors` parameter can be omitted if the intention is to create a legacy wallet. For now, the default type is the legacy wallet, but that is expected to change in a future release. - By default, wallets are created in the `wallets` folder of the data directory, which varies by operating system, as shown below. The user can change the default by using the `-datadir` or `-walletdir` initialization parameters. | Operating System | Default wallet directory | @@ -54,7 +52,7 @@ Only the wallet's private key is encrypted. All other wallet information, such a The wallet's private key can also be encrypted in the `createwallet` command via the `passphrase` argument: ``` -$ dash-cli -named createwallet wallet_name="wallet-01" descriptors=true passphrase="passphrase" +$ dash-cli -named createwallet wallet_name="wallet-01" passphrase="passphrase" ``` Note that if the passphrase is lost, all the coins in the wallet will also be lost forever. From 5b3fc66185fa4105ca223271277f2208cb816fb0 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Fri, 6 Mar 2026 15:12:31 +0700 Subject: [PATCH 4/4] docs: add release notes for Descriptor Wallets creation by default --- doc/release-notes-7204.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 doc/release-notes-7204.md diff --git a/doc/release-notes-7204.md b/doc/release-notes-7204.md new file mode 100644 index 000000000000..fd8b4744470b --- /dev/null +++ b/doc/release-notes-7204.md @@ -0,0 +1,21 @@ +Notable changes +=============== + +Updated RPCs +------------ + + +Changes to wallet related RPCs can be found in the Wallet section below. + +Wallet +------ + +- Descriptor wallets are now the default wallet type. Newly created wallets + will use descriptors unless `descriptors=false` is set during `createwallet`, or + the `Descriptor wallet` checkbox is unchecked in the GUI. (dash#7204) + + Note that wallet RPC commands like `importmulti` and `dumpprivkey` cannot be + used with descriptor wallets, so if your client code relies on these commands + without specifying `descriptors=false` during wallet creation, you will need + to update your code. +