Bitcoin Forum

Other => Beginners & Help => Topic started by: vebveb on April 06, 2013, 03:12:48 PM



Title: Send rpc commands to a bitcoin server not on the same computer
Post by: vebveb on April 06, 2013, 03:12:48 PM
Hello everybody,

I would like to have a bitcoind server running on a computer and access it from a different computer via the rpc commands.

What works:
run bitcoind.exe
on the same computer type bitcoind.exe 'my_command', with 'my_command' beeing getinfo, stop or other commands.

 
What doesn't work:
run bitcoind.exe with rpcallowip set to *, *.*.*.* or the ip of the computer which sends the commands
run bitcoind.exe getinfo (or other commands) with rpcconnect set to the ip of the computer running the bitcoind server.

I also tried:
On the same computer: run bitcoind.exe with rpcallowip not set, or set to the true ip of the computer (not the local ip)
and run bitcoind.exe getinfo (or stop) with rpcconnect set to the true ip of the computer.
but that didn't work.

So it seems I only succeed to have a local server, but I would like to access it from an other computer.

What should I do to make it work?

Thank you


Title: Re: Send rpc commands to a bitcoin server not on the same computer
Post by: centove on April 06, 2013, 03:30:17 PM
On linux machines the following steps seem to work.

Server:
~/.bitcoin/bitcoin.conf
rpcuser=<some user>
rpcpassword=<some password>

rpcallowip=<ip>
rpcallowip=<ip>
(and so on)

Then start it
bitcoind -daemon

Client:
bitcoind -rpcconnect=<ip> -rpcuser=<some user> -rpcpassword=<some password> getinfo

I imagine something similar on windows/macos should work as well..


Title: Re: Send rpc commands to a bitcoin server not on the same computer
Post by: clownius on April 06, 2013, 03:33:26 PM
Depends what the target machine is running OS wise.  But if its 'nix based then surely the easy method would be to ssh into the machine and run the commands that way?


Title: Re: Send rpc commands to a bitcoin server not on the same computer
Post by: lbr on April 06, 2013, 03:37:44 PM
Setting externalip=my_external_ip in bitcoin.conf helped me.
Also if there are routers in the way you need to configure port forwarding.


Title: Re: Send rpc commands to a bitcoin server not on the same computer
Post by: vebveb on April 06, 2013, 03:48:04 PM
centove: I defined these things. As I said, it works if it turns on the same computer.

clownius: It is a windows os, and I use bitcoind 8.1

lbr: I tried, but I didn't solve my problem. I think the issue could be about ports.
On the virtual machine I would like server to be, I opened the ports 8333 and 8332. Do I need to open other ports?


Title: Re: Send rpc commands to a bitcoin server not on the same computer
Post by: centove on April 06, 2013, 04:00:51 PM
centove: I defined these things. As I said, it works if it turns on the same computer.


What errors is it giving?

port 8333 is what the client uses to talk to other 'nodes' and exchange the blockchain packets.
port 8332 is the RPC port.


Title: Re: Send rpc commands to a bitcoin server not on the same computer
Post by: vebveb on April 06, 2013, 04:07:05 PM
It gives "error: couldn't connect to server" and in the debug informations of the server, there is no rpc commands received. It's like they can't communicate.


Title: Re: Send rpc commands to a bitcoin server not on the same computer
Post by: centove on April 06, 2013, 04:21:51 PM
It gives "error: couldn't connect to server" and in the debug informations of the server, there is no rpc commands received. It's like they can't communicate.
And on the server you started the bitcoind.exe with the -daemon option?


Title: Re: Send rpc commands to a bitcoin server not on the same computer
Post by: vebveb on April 06, 2013, 04:31:39 PM
I finally find out how to make it work.

On VM I wanted to make bitcoind turn on, I made extra firewall parameters and It now works.

thank you for your help