i used bitcoind with jsonrpc service.

but i added regtest=1 in bitcoin.conf at .bitcoin folder.


bitcoin-cli -regtest generate 101

bitcoin-cli -regtest getbalance


but I can't see the balance in php.


it doesn't show me the balance. it returns nothing.

if I remove regtest=1 from bitcoin.conf and start bitcoind -daemon.

$bitcoin->getbalance() it gives me the the real server balance.

what is solution for this problem???

  • This might be a stupid question, but are you echoing the return value of $bitcoin->getbalance() ? Also, what error logging level do you have set?
    – Nick ODell
    Aug 13, 2015 at 6:39
  • I think you are the stupid one commented on this question. if i can see the error then I will definitely add in body. don't ignore those people who need to learn something. if you have power of knowledge then use this. if you don't understand my question then you can comment. Aug 13, 2015 at 6:50
  • I wasn't trying to insult you or your question. In this context, "This might be a stupid question" means that I'm about to ask you about a debugging step that I think you've probably done, but I don't know for sure.
    – Nick ODell
    Aug 13, 2015 at 6:59

1 Answer 1


Very likely you need to tell your PHP JSON RPC client to connect to the right port.

If you start bitcoind without -regtest (= main net), it opens up the RPC server on port 8332. If you use -regtest, the port will be 18332.

I can't see what kind of PHP JSON RPC client you are using, but there must be a way to tell it should use port 18332.

  • so this answer works? so you mean we should write this line at bitcoin.conf file? rpcport=18332
    – creator
    Apr 26, 2018 at 6:17

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.