5#if defined(HAVE_CONFIG_H)
6#include <config/bitcoin-config.h>
30 argsman.
AddArg(
"-datadir=<dir>",
"Specify data directory",
32 argsman.
AddArg(
"-wallet=<wallet-name>",
"Specify wallet name",
35 argsman.
AddArg(
"-debug=<category>",
36 "Output debugging information (default: 0).",
40 "Send trace/debug info to console (default: 1 when no -debug "
41 "is true, 0 otherwise).",
49 "Attempt to recover private keys from a corrupt wallet",
55 std::string error_message;
57 tfm::format(std::cerr,
"Error parsing command line arguments: %s\n",
63 strprintf(
"%s bitcoin-wallet version", PACKAGE_NAME) +
" " +
71 "bitcoin-wallet is an offline tool for creating and "
72 "interacting with " PACKAGE_NAME
" wallet files.\n"
73 "By default bitcoin-wallet will act on wallets in the default "
74 "mainnet wallet directory in the datadir.\n"
75 "To change the target wallet, use the -datadir, -wallet and "
76 "-testnet/-regtest arguments.\n\n"
78 " bitcoin-wallet [options] <command>\n";
91 "Error: Specified data directory \"%s\" does not exist.\n",
102int main(
int argc,
char *argv[]) {
104 common::WinCmdLineArgs winArgs;
105 std::tie(argc, argv) = winArgs.get();
113 }
catch (
const std::exception &e) {
121 std::string method{};
122 for (
int i = 1; i < argc; ++i) {
124 if (!method.empty()) {
126 "Error: two methods provided (%s and %s). Only one "
127 "method should be provided.\n",
135 if (method.empty()) {
137 "No method provided. Run `bitcoin-wallet -help` for "
146 "Wallet name must be provided when creating a new wallet.\n");
bool HelpRequested(const ArgsManager &args)
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
bool CheckDataDirOption(const ArgsManager &args)
bool IsSwitchChar(char c)
int main(int argc, char *argv[])
const std::function< std::string(const char *)> G_TRANSLATION_FUN
Translate string to current locale using Qt.
static bool WalletAppInit(int argc, char *argv[])
static void SetupWalletToolArgs(ArgsManager &argsman)
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given BIP70 chain name.
void SetupChainParamsBaseOptions(ArgsManager &argsman)
Set the arguments for chainparams.
bool ParseParameters(int argc, const char *const argv[], std::string &error)
std::string GetHelpMessage() const
Get the help string.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
std::string GetChainName() const
Looks for -regtest, -testnet and returns the appropriate BIP70 chain name.
Users of this module must hold an ECCVerifyHandle.
std::string FormatFullVersion()
std::string LicenseInfo()
Returns licensing information (for -version)
static std::unique_ptr< ECCVerifyHandle > globalVerifyHandle
void SetupCurrencyUnitOptions(ArgsManager &argsman)
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)
void ECC_Start()
Initialize the elliptic curve support.
void ECC_Stop()
Deinitialize the elliptic curve support.
BCLog::Logger & LogInstance()
void RandomInit()
Initialize global RNG state and log any CPU features that are used.
std::string FormatParagraph(std::string_view in, size_t width, size_t indent)
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line.