5#if defined(HAVE_CONFIG_H)
39 argsman.
AddCommand(
"create",
"Create new wallet file");
40 argsman.
AddCommand(
"salvage",
"Attempt to recover private keys from a corrupt wallet. Warning: 'salvage' is experimental.");
41 argsman.
AddCommand(
"dump",
"Print out all of the wallet key-value records");
42 argsman.
AddCommand(
"createfromdump",
"Create new wallet file from dumped records");
48 std::string error_message;
50 tfm::format(std::cerr,
"Error parsing command line arguments: %s\n", error_message);
57 "bitcoin-wallet is an offline tool for creating and interacting with " PACKAGE_NAME " wallet files.\n"
58 "By default bitcoin-wallet will act on wallets in the default mainnet wallet directory in the datadir.\n"
59 "To change the target wallet, use the -datadir, -wallet and -testnet/-regtest arguments.\n\n"
61 " bitcoin-wallet [options] <command>\n";
72 tfm::format(std::cerr,
"Error: Specified data directory \"%s\" does not exist.\n", args.
GetArg(
"-datadir",
""));
81int main(
int argc,
char* argv[])
85 util::WinCmdLineArgs winArgs;
86 std::tie(argc, argv) = winArgs.get();
99 }
catch (
const std::exception& e) {
109 tfm::format(std::cerr,
"No method provided. Run `bitcoin-wallet -help` for valid methods.\n");
112 if (command->args.size() != 0) {
113 tfm::format(std::cerr,
"Error: Additional arguments provided (%s). Methods do not take arguments. Please refer to `-help`.\n",
Join(command->args,
", "));
int main(int argc, char *argv[])
UrlDecodeFn *const URL_DECODE
static bool WalletAppInit(ArgsManager &args, int argc, char *argv[])
const std::function< std::string(const char *)> G_TRANSLATION_FUN
Translate string to current locale using Qt.
static void SetupWalletToolArgs(ArgsManager &argsman)
void SelectParams(const std::string &network)
Sets the params returned by Params() to those for the given chain name.
void SetupChainParamsBaseOptions(ArgsManager &argsman)
Set the arguments for chainparams.
std::optional< const Command > GetCommand() const
Get the command and command args (returns std::nullopt if no command provided)
@ ALLOW_ANY
disable validation
@ DISALLOW_NEGATION
disallow -nofoo syntax
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.
void AddCommand(const std::string &cmd, const std::string &help)
Add subcommand.
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
Returns the appropriate chain name from the program arguments.
Users of this module must hold an ECCVerifyHandle.
std::string FormatFullVersion()
static std::unique_ptr< ECCVerifyHandle > globalVerifyHandle
void ECC_Start()
Initialize the elliptic curve support.
void ECC_Stop()
Deinitialize the elliptic curve support.
BCLog::Logger & LogInstance()
std::unique_ptr< Init > MakeWalletInit(int argc, char *argv[], int &exit_status)
Return implementation of Init interface for the wallet process.
void RandomInit()
Initialize global RNG state and log any CPU features that are used.
auto Join(const std::vector< T > &list, const BaseType &separator, UnaryOp unary_op) -> decltype(unary_op(list.at(0)))
Join a list of items.
std::string(const std::string &url_encoded) UrlDecodeFn
bool HelpRequested(const ArgsManager &args)
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
bool CheckDataDirOption()
void PrintExceptionContinue(const std::exception *pex, const char *pszThread)