The testnet=1 option can be (not) specified in the bitcoin.conf file (thus causing it to be on mainnet by default), and this can be over-ridden in bitcoin-cli with the -testnet command-line option.

But, when using the json-rpc interface via curl, I can't figure out how to specify I want testnet in this case. I can put the testnet port 18332 in the url, but I don't know how to use any other "command line" switches when using curl?

Can I do it with curl?

1 Answer 1


The port 18332 is the specification you speak of. When the testnet bitcoind is running on your system, port 18332 is open to accept rpc's. In case of mainnet, that port changes to 8332.

Every thing that you can do from the commandline is accessible via curl on that port.

  • Note that I did have to remove testnet=1 and rpcport=8332 from the bitcoin.conf in order to have this flexibility. Good answer.
    – toddmo
    Commented Jun 27, 2018 at 20:00

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.