Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: XavierNauze on April 29, 2017, 05:03:58 AM



Title: BitcoinD RPC Server
Post by: XavierNauze on April 29, 2017, 05:03:58 AM
Hi there,

I have a small problem with my server bitcoind, when i taping example : bitcoin-cli getbalance i have that error :

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

But the port its open, how i can resolve that ?

System : Ubuntu Server

Bitcoin.conf :
prune=550
rpcport=8332
maxconnections=125
maxuploadtarget=0
rpcuser=USERHIDDEN
rpcpassword=PASSWORDHIDDEN
daemon=1
keypool=100

#Edit : Bad English
Thank



Title: Re: BitcoinD RPC Server
Post by: cloverme on April 29, 2017, 11:00:26 AM
Hi there,

I have a small problem with my server bitcoind, when i taping example : bitcoin-cli getbalance i have that error :

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

But the port its open, how i can resolve that ?

System : Ubuntu Server

Bitcoin.conf :
prune=550
rpcport=8332
maxconnections=125
maxuploadtarget=0
rpcuser=USERHIDDEN
rpcpassword=PASSWORDHIDDEN
daemon=1
keypool=100

#Edit : Bad English
Thank



A couple of things...

Use your RPC connect username and password in the command.
Code:
bitcoin-cli -rpcuser=userhidden -rpcpassword=passwordhidden -rpcport=8332

Check your firewall rules:
Code:
sudo iptables -L

or
Code:
sudo ufw status

For debugging, you can try turning off your firewall
Code:
sudo ufw disable
, dont forget to turn it back on.

If it was blocked locally, you can add a rule:
Code:
sudo ufw allow from (source ip) to (RPC IP) port 8332 proto tcp
example: sudo ufw allow from 192.168.1.1 to 192.168.1.1 port 8332 proto tcp

Good luck


Title: Re: BitcoinD RPC Server
Post by: BitcoinPot on April 29, 2017, 10:14:25 PM
Check this thread too:
https://bitcointalk.org/index.php?topic=1871447.0 (https://bitcointalk.org/index.php?topic=1871447.0)

I got similar problems this where caused by closed ports...


Title: Re: BitcoinD RPC Server
Post by: Casy on April 30, 2017, 10:35:11 AM

Bitcoin.conf :
prune=550
rpcport=8332
maxconnections=125
maxuploadtarget=0
rpcuser=USERHIDDEN
rpcpassword=PASSWORDHIDDEN
daemon=1
keypool=100


I don't know about the current defaults, but a
Code:
server=1
may also help


Title: Re: BitcoinD RPC Server
Post by: initstring on January 27, 2018, 03:39:37 AM
Quote
I don't know about the current defaults, but a
Code:
server=1
may also help

Thanks! For anyone else reading, I noticed that bitcoin-cli worked properly when bitcoind was invoked via the command line, but not when running the GUI.

Adding "server=1" to bitcoin.conf fixed this issue.


Title: Re: BitcoinD RPC Server
Post by: achow101 on January 29, 2018, 12:49:59 AM
Thanks! For anyone else reading, I noticed that bitcoin-cli worked properly when bitcoind was invoked via the command line, but not when running the GUI.

Adding "server=1" to bitcoin.conf fixed this issue.
bitcoind will default to server=1. bitcoin-qt will not. So if you want to use the RPC server while running bitcoin-qt, you need to set server=1