Bitcoin Core 29.99.0
P2P Digital Currency
Classes | Functions | Variables
bitcoin.cpp File Reference
#include <bitcoin-build-config.h>
#include <clientversion.h>
#include <util/fs.h>
#include <util/exec.h>
#include <util/strencodings.h>
#include <util/translation.h>
#include <iostream>
#include <string>
#include <tinyformat.h>
#include <vector>
Include dependency graph for bitcoin.cpp:

Go to the source code of this file.

Classes

struct  CommandLine
 

Functions

CommandLine ParseCommandLine (int argc, char *argv[])
 
static void ExecCommand (const std::vector< const char * > &args, std::string_view wrapper_argv0)
 Execute the specified bitcoind, bitcoin-qt or other command line in args using src, bin and libexec directory paths relative to this executable, where the path to this executable is specified in wrapper_argv0. More...
 
int main (int argc, char *argv[])
 

Variables

const TranslateFn G_TRANSLATION_FUN {nullptr}
 Translate string to current locale using Qt. More...
 
static constexpr auto HELP_USAGE
 
static constexpr auto HELP_EXTRA
 

Function Documentation

◆ ExecCommand()

static void ExecCommand ( const std::vector< const char * > &  args,
std::string_view  wrapper_argv0 
)
static

Execute the specified bitcoind, bitcoin-qt or other command line in args using src, bin and libexec directory paths relative to this executable, where the path to this executable is specified in wrapper_argv0.

Parameters
argsCommand line arguments to execute, where first argument should be a relative path to a bitcoind, bitcoin-qt or other executable that will be located on the PATH or relative to wrapper_argv0.
wrapper_argv0String containing first command line argument passed to main() to run the current executable. This is used to help determine the path to the current executable and how to look for new executables.
Note
This function doesn't currently print anything but can be debugged from the command line using strace or dtrace like:
strace -e trace=execve -s 10000 build/bin/bitcoin ...
dtrace -n 'proc:::exec-success  /pid == $target/ { trace(curpsinfo->pr_psargs); }' -c ... 

Definition at line 157 of file bitcoin.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 57 of file bitcoin.cpp.

Here is the call graph for this function:

◆ ParseCommandLine()

CommandLine ParseCommandLine ( int  argc,
char *  argv[] 
)

Definition at line 112 of file bitcoin.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ G_TRANSLATION_FUN

const TranslateFn G_TRANSLATION_FUN {nullptr}

Translate string to current locale using Qt.

Definition at line 18 of file bitcoin.cpp.

◆ HELP_EXTRA

constexpr auto HELP_EXTRA
staticconstexpr
Initial value:
= R"(
Additional less commonly used commands:
bench [ARGS] Run bench command, equivalent to running 'bench_bitcoin [ARGS]'.
chainstate [ARGS] Run bitcoin kernel chainstate util, equivalent to running 'bitcoin-chainstate [ARGS]'.
test [ARGS] Run unit tests, equivalent to running 'test_bitcoin [ARGS]'.
test-gui [ARGS] Run GUI unit tests, equivalent to running 'test_bitcoin-qt [ARGS]'.
)"

Definition at line 37 of file bitcoin.cpp.

◆ HELP_USAGE

constexpr auto HELP_USAGE
staticconstexpr
Initial value:
= R"(Usage: %s [OPTIONS] COMMAND...
Options:
-m, --multiprocess Run multiprocess binaries bitcoin-node, bitcoin-gui.
-M, --monolithic Run monolithic binaries bitcoind, bitcoin-qt. (Default behavior)
-v, --version Show version information
-h, --help Show this help message
Commands:
gui [ARGS] Start GUI, equivalent to running 'bitcoin-qt [ARGS]' or 'bitcoin-gui [ARGS]'.
node [ARGS] Start node, equivalent to running 'bitcoind [ARGS]' or 'bitcoin-node [ARGS]'.
rpc [ARGS] Call RPC method, equivalent to running 'bitcoin-cli -named [ARGS]'.
wallet [ARGS] Call wallet command, equivalent to running 'bitcoin-wallet [ARGS]'.
tx [ARGS] Manipulate hex-encoded transactions, equivalent to running 'bitcoin-tx [ARGS]'.
help [-a] Show this help message. Include -a or --all to show additional commands.
)"

Definition at line 20 of file bitcoin.cpp.