2

I have started bitcoin daemon with -regtest flag. The output was

Bitcoin server starting

But, when I run

bitcoin-cli -regtest generate 101

command, it shows

error: couldn't connect to server: unknown (code -1) (make sure server is running and you are connecting to the correct RPC port)

How this happens?

1

Try changing port number in bitcoin.conf. open file

nano ~/.bitcoin/bitcoin.conf

add new line

rpcport=18332;

save the file and restart bitcoind

  • This is only the regtest RPC port then? – Willtech Mar 21 '18 at 11:58
  • This will effect all instances of bitcoind that are started, regardless of network. – Andrew Chow Mar 21 '18 at 19:53
  • @Willtech I think it is – Prayag k Mar 22 '18 at 6:45
1

Adding rpcport=18332 temporarily solve your problem. If you want to run mainnet or testnet at the same time when regtest is running, you wont be able to use them, it is because when you assign rpcport=xyz all bitcoin instances will try to interact through same rpcport when daemon is started but at one time only single daemon can access single port number.But in your case all three daemons tries to take rpcport as 18332.

Infact what you can do is, try to get connected to default rpc port for regtest by typing command:

bitcoind -regtest -daemon -rpcport=18443

Mainnet:8332 
Testnet:18332 
Regtest:18443`

Note:For bitcore v15 rpc port is same for testnet and mainnet where as in v16 rpc port is diffrent for all of them

  • From their docs, for testnet&regtest port is same. ie.18832. Is there a different port for regtest?! – Prayag k Mar 23 '18 at 5:57
  • @Prayagk For bitcore v15 rpc port is same for testnet and mainnet where as in v16 rpc port is diffrent for all of them – cryptoKTM Mar 23 '18 at 7:51
  • ok..that's new for me – Prayag k Mar 23 '18 at 8:21
  • 2
    you can see which version you using with command getinfo – cryptoKTM Mar 23 '18 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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