1

This might be simple question but I would highly appreciate if anyone can bring their wisdom on this.

If you install bitcoin-core software through https://bitcoincore.org/, it gives you dmg file that automatically install the bitcoin core (bitcoin-qt). I was assuming that you can still use JSON-RPC-API just with bitcoin-qt since it still communicates with the network and the GUI and RPC console. However, even when I enabled RPC server, when I use curl command which is specified on this wiki page: https://en.bitcoin.it/wiki/API_reference_(JSON-RPC), it doesn't return any result.

Does anyone know if it is still possible to use JSON-RPC API with just bitcoin-qt installed? If not, is there a way to install bitcoind/bitcoin-cli without going through IBD since bitcoin core already has all the blocks installed? It seems like unnecessary to redownload all the blocks while they are stored locally. If this is possible, how can I achieve this? Ideally, I think I should be able to use JSON-RPC-API just by installing bitcoin-qt from bitcoincore.org.

1
  • When I check GUI, I can see "Enable RPC server" checkbox is clicked.
    – xor
    Feb 10, 2023 at 20:20

1 Answer 1

2

However, even when I enabled RPC server, when I use curl command which is specified on this wiki page: https://en.bitcoin.it/wiki/API_reference_(JSON-RPC), it doesn't return any result.

You need to configure a username and password for the JSON-RPC if you don't use bitcoin-cli (in the bitcoin.conf file, using the rpcuser and rpcpassword options, or alternatively the more modern and secure rpcauth option).

Does anyone know if it is still possible to use JSON-RPC API with just bitcoin-qt installed?

Yes, just enable the RPC server in the GUI, or start it with the -server command-line option.

If not, is there a way to install bitcoind/bitcoin-cli without going through IBD since bitcoin core already has all the blocks installed? It seems like unnecessary to redownload all the blocks while they are stored locally.

You can also install bitcoind, which has the RPC server enabled by default, but lacks the GUI.

If you run them with the same data directory you can even alternate between the two without redownloading. You can't run both simultaneously though, but there also shouldn't be any need, since bitcoin-qt also contains an RPC server.

bitcoin-cli is independent, it's only an RPC client to communicate with either bitcoind or bitcoin-qt.

If this is possible, how can I achieve this?

Just install the relevant binaries. The DMG installer only contains bitcoin-qt I believe; if you want the other ones, you need to get the .tgz file.

4
  • How does the curl command should look like if you are using rpcauth option? RPC server seems to be enabled but still returning no result. Also, where do I get .tgz file fore bitcoin-cli?
    – xor
    Feb 10, 2023 at 22:03
  • See bitcoincore.org/en/download, under macOS tar.gz for the download. Feb 10, 2023 at 22:12
  • The curl command would be something like curl --user USERNAME:PASSWORD --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/'. The USERNAME and PASSWORD are your username and password that you entered in the rpcauth tool (github.com/bitcoin/bitcoin/blob/master/share/rpcauth/rpcauth.py) to generate rpcauth= config line. Feb 10, 2023 at 22:16
  • Thank you so much for the help
    – xor
    Feb 11, 2023 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.