aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
Commit message (Collapse)AuthorAgeFilesLines
* rpc: Handle `getinfo` locally in bitcoin-cli w/ `-getinfo`Wladimir J. van der Laan2017-09-271-14/+105
| | | | | | | | | | | | | | | | | | | This adds the infrastructure `BaseRequestHandler` class that takes care of converting bitcoin-cli arguments into a JSON-RPC request object, and converting the reply into a JSON object that can be shown as result. This is subsequently used to handle the `-getinfo` option, which sends a JSON-RPC batch request to the RPC server with `["getnetworkinfo", "getblockchaininfo", "getwalletinfo"]`, and after reply combines the result into what looks like a `getinfo` result. There have been some requests for a client-side `getinfo` and this is my PoC of how to do it. If this is considered a good idea some of the logic could be moved up to rpcclient.cpp and used in the GUI console as well. Extra-Author: Andrew Chow <[email protected]>
* Fix style in -stdin and -stdinrpcpass handlingJoão Barbosa2017-09-071-3/+6
|
* Add option -stdinrpcpass to allow RPC password to be read from standard inputJoe Harvell2017-08-231-3/+10
|
* scripted-diff: stop using the gArgs wrappersMarko Bencun2017-08-141-16/+16
| | | | | | | | They were temporary additions to ease the transition. -BEGIN VERIFY SCRIPT- find src/ -name "*.cpp" ! -wholename "src/util.h" ! -wholename "src/util.cpp" | xargs perl -i -pe 's/(?<!\.)(ParseParameters|ReadConfigFile|IsArgSet|(Soft|Force)?(Get|Set)(|Bool|)Arg(s)?)\(/gArgs.\1(/g' -END VERIFY SCRIPT-
* scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-6/+6
| | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* Fix misleading "Method not found" multiwallet errorsRussell Yanofsky2017-07-261-0/+4
| | | | | | | | Raise RPC_WALLET_NOT_SPECIFIED instead of RPC_METHOD_NOT_FOUND when a required wallet filename was not specified in an RPC call. Also raise more specific RPC_WALLET_NOT_FOUND error instead of RPC_INVALID_PARAMETER in case an invalid wallet was specified, for consistency.
* Rename -usewallet to -rpcwalletAlex Morcos2017-07-191-2/+2
|
* Add wallet endpoint support to bitcoin-cli (-usewallet)Jonas Schnelli2017-07-171-1/+15
|
* Remove duplicate includepracticalswift2017-07-161-1/+0
|
* [utils] allow square brackets for ipv6 addresses in bitcoin-cliJohn Newbery2017-07-131-2/+9
| | | | | -rpcconnect can now accept ipv6 addresses with and without square brackets.
* Chainparams: Use a regular factory for creating chainparamsJorge Timón2017-05-031-1/+3
|
* Replace uses of boost::filesystem with fsWladimir J. van der Laan2017-04-031-1/+1
| | | | | | | | | Step two in abstracting away boost::filesystem. To repeat this, simply run: ``` git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g' ```
* Replace includes of boost/filesystem.h with fs.hWladimir J. van der Laan2017-04-031-1/+1
| | | | This is step one in abstracting the use of boost::filesystem.
* Docs: add details to -rpcclienttimeout docIan Kelling2017-03-021-1/+1
|
* rpc: Named argument support for bitcoin-cliWladimir J. van der Laan2017-01-101-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Usage e.g.: $ src/bitcoin-cli -testnet -named echo arg0="dfdf" [ "dfdf" ] Argument conversion also works, for arguments thus flagged in the table in `src/rpc/client.cpp`. $ src/bitcoin-cli -testnet -named echojson arg0="[1,2,3]" [ [ 1, 2, 3 ] ] Unknown parameter (detected server-side): $ src/bitcoin-cli -testnet -named getinfo arg0="dfdf" error code: -8 error message: Unknown named parameter arg0
* Merge #9387: [Refactor] RAII of libevent stuff using unique ptrs with deletersWladimir J. van der Laan2017-01-051-20/+12
|\ | | | | | | | | | | | | 05a55a6 Added EVENT_CFLAGS to test makefile to explicitly include libevent headers. (Karl-Johan Alm) 280a559 Added some simple tests for the RAII-style events. (Karl-Johan Alm) 7f7f102 Switched bitcoin-cli.cpp to use RAII unique pointers with deleters. (Karl-Johan Alm) e5534d2 Added std::unique_ptr<> wrappers with deleters for libevent modules. (Karl-Johan Alm)
| * Switched bitcoin-cli.cpp to use RAII unique pointers with deleters.Karl-Johan Alm2016-12-201-20/+12
| |
* | Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | | | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* | Un-expose mapArgs from utils.hMatt Corallo2016-12-241-3/+3
| |
* | Introduce (and use) an IsArgSet accessor methodMatt Corallo2016-12-231-2/+2
| |
* | Remove arguments to ParseConfigFileMatt Corallo2016-12-231-1/+1
|/
* bitcoin-cli: Make error message less confusingWladimir J. van der Laan2016-12-021-1/+1
| | | | | | | | | | | | | | | | | | Sorry for the churn on this, but the current message (introduced in #9073) isn't acceptable: $ src/bitcoin-cli getinfo rpc: couldn't connect to server (make sure server is running and you are connecting to the correct RPC port: -1 unknown) Putting the error code after the words "RPC port" made me wonder whether there was a port configuration issue. This changes it to: $ src/bitcoin-cli getinfo error: couldn't connect to server: unknown (code -1) (make sure server is running and you are connecting to the correct RPC port)
* Removed using namespace std from bitcoin-cli/-tx and added std:: in ↵Karl-Johan Alm2016-11-251-16/+14
| | | | appropriate places.
* Merge #9067: Fix exit codesWladimir J. van der Laan2016-11-081-9/+19
|\ | | | | | | | | 4441018 Every main()/exit() should return/use one of EXIT_ codes instead of magic numbers (UdjinM6) bd0de13 Fix exit codes: - `--help`, `--version` etc should exit with `0` i.e. no error ("not enough args" case should still trigger an error) - error reading config file should exit with `1` (UdjinM6)
| * Fix exit codes:UdjinM62016-11-041-9/+19
| | | | | | | | | | | | | | - `--help`, `--version` etc should exit with `0` i.e. no error ("not enough args" case should still trigger an error) - error reading config file should exit with `1` Slightly refactor AppInitRPC/AppInitRawTx to return standard exit codes (EXIT_FAILURE/EXIT_SUCCESS) or CONTINUE_EXECUTION (-1)
* | Add common failure cases for rpc server connection failureinstagibbs2016-11-031-1/+1
|/
* rpc: Change JSONRPCRequest to JSONRPCRequestObjWladimir J. van der Laan2016-10-191-1/+1
| | | | This is more consistent with `JSONRPCReplyObj`.
* Globals: Decouple GetConfigFile and ReadConfigFile from global mapArgsJorge Timón2016-10-011-2/+2
|
* bitcoin-cli: More detailed error reportingWladimir J. van der Laan2016-09-211-3/+39
| | | | | Register a evhttp error handler to get a more detailed error message if the HTTP request fails.
* bitcoin-cli.cpp: Use symbolic constant for exit codePuru2016-05-021-1/+1
|
* rpc: Input-from-stdin mode for bitcoin-cliWladimir J. van der Laan2016-02-241-9/+12
| | | | | | | | | | | | Implements #7442 by adding an option `-stdin` which reads additional arguments from stdin, one per line. For example ```bash echo -e "mysecretcode\n120" | src/bitcoin-cli -stdin walletpassphrase echo -e "walletpassphrase\nmysecretcode\n120" | src/bitcoin-cli -stdin ```
* Merge branch 'master' into single_prodnameLuke Dashjr2016-02-031-7/+8
|\
| * move rpc* to rpc/Daniel Cousens2016-01-211-2/+2
| |
| * Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
| |
| * Constrain rpcport default values to a single location in codeLuke Dashjr2015-12-011-1/+1
| |
| * Constrain constant values to a single location in codeLuke Dashjr2015-11-281-3/+4
| |
* | Unify package name to as few places as possible without major changesLuke Dashjr2015-12-141-2/+6
|/
* constify missing catch casesPhilip Kaufmann2015-10-271-1/+1
| | | | - ensure all missing catch cases are constant where possible
* Merge pull request #6846Wladimir J. van der Laan2015-10-221-1/+1
|\ | | | | | | 3cb56f3 *: alias -h for --help (Daniel Cousens)
| * *: alias -h for --helpDaniel Cousens2015-10-221-1/+1
| |
* | Merge pull request #6235Wladimir J. van der Laan2015-10-201-5/+5
|\ \ | |/ |/| | | | | 55a8975 Chainparams: Translations: DRY: options and error strings (Jorge Timón) f3525e2 Chainparams: Replace CBaseChainParams::Network enum with string constants (suggested by Wladimir) (Jorge Timón)
| * Chainparams: Translations: DRY: options and error stringsJorge Timón2015-10-201-5/+5
| | | | | | | | Also remove SelectBaseParamsFromCommandLine and SelectParamsFromCommandLine
* | [Univalue] add univalue over subtreeJonas Schnelli2015-10-011-1/+1
| | | | | | | | similar to secp256k1 include and compile univalue over a subtree
* | rpc: Split option -rpctimeout into -rpcservertimeout and -rpcclienttimeoutWladimir J. van der Laan2015-09-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The two timeouts for the server and client, are essentially different: - In the case of the server it should be a lower value to avoid clients clogging up connection slots - In the case of the client it should be a high value to accomedate slow responses from the server, for example for slow queries or when the lock is contended Split the options into `-rpcservertimeout` and `-rpcclienttimeout` with respective defaults of 30 and 900.
* | Move windows socket init to utility functionWladimir J. van der Laan2015-09-031-0/+4
| |
* | evhttpd implementationWladimir J. van der Laan2015-09-031-40/+93
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - *Replace usage of boost::asio with [libevent2](http://libevent.org/)*. boost::asio is not part of C++11, so unlike other boost there is no forwards-compatibility reason to stick with it. Together with #4738 (convert json_spirit to UniValue), this rids Bitcoin Core of the worst offenders with regard to compile-time slowness. - *Replace spit-and-duct-tape http server with evhttp*. Front-end http handling is handled by libevent, a work queue (with configurable depth and parallelism) is used to handle application requests. - *Wrap HTTP request in C++ class*; this makes the application code mostly HTTP-server-neutral - *Refactor RPC to move all http-specific code to a separate file*. Theoreticaly this can allow building without HTTP server but with another RPC backend, e.g. Qt's debug console (currently not implemented) or future RPC mechanisms people may want to use. - *HTTP dispatch mechanism*; services (e.g., RPC, REST) register which URL paths they want to handle. By using a proven, high-performance asynchronous networking library (also used by Tor) and HTTP server, problems such as #5674, #5655, #344 should be avoided. What works? bitcoind, bitcoin-cli, bitcoin-qt. Unit tests and RPC/REST tests pass. The aim for now is everything but SSL support. Configuration options: - `-rpcthreads`: repurposed as "number of work handler threads". Still defaults to 4. - `-rpcworkqueue`: maximum depth of work queue. When this is reached, new requests will return a 500 Internal Error. - `-rpctimeout`: inactivity time, in seconds, after which to disconnect a client. - `-debug=http`: low-level http activity logging
* rpc: Implement random-cookie based authenticationWladimir J. van der Laan2015-07-131-8/+16
| | | | | | | | | | | | | | | When no `-rpcpassword` is specified, use a special 'cookie' file for authentication. This file is generated with random content when the daemon starts, and deleted when it exits. Read access to this file controls who can access through RPC. By default this file is stored in the data directory but it be overriden with `-rpccookiefile`. This is similar to Tor CookieAuthentication: see https://www.torproject.org/docs/tor-manual.html.en Alternative to #6258. Like that pull, this allows running bitcoind without any manual configuration. However, daemons should ideally never write to their configuration files, so I prefer this solution.
* [bitcoin-cli] improve error outputJonas Schnelli2015-07-071-0/+9
|
* Remove JSON Spirit wrapper, remove JSON Spirit leftoversJonas Schnelli2015-06-041-6/+9
| | | | | | - implement find_value() function for UniValue - replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper - remove JSON Spirit sources
* remove JSON Spirit UniValue wrapperJonas Schnelli2015-06-041-5/+4
|