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