Author

Topic: php works, bitcoin-cli not? (Read 529 times)

copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
December 27, 2016, 02:39:42 AM
#4
-snip-
Same result, in php it works but not in terminal/ssh with bitcoin-cli.
I previously tried specifying datadir... same results.

Does it work if you specifiy the full path to the bitcoin-cli? e.g. (your path may vary)

Code:
/usr/bin/bitcoin-cli getinfo
newbie
Activity: 2
Merit: 0
December 23, 2016, 05:30:37 AM
#3
Are you using a separate datadir? If so, you need to specify it in the bitcoin-cli command.

Additionally, try stopping Bitcoin Core and seeing a file in the datadir named .cookie (or something like that) exists. If it does, then delete the file and restart Core and try again.

Lastly, rpcuser and rpcpassword have been deprecated and replaced with cookie authentication. For cookie auth, you read the user and pass from the aforementioned file. This user and pass will change every time your restart Bitcoin Core. If you do want to continue to use rpcuser and rpcpassword, I suggest you instead use rpcauth. You can take a look at https://github.com/bitcoin/bitcoin/blob/44f2df613f23d0a095a6e47b3d9c498b9df3055b/share/rpcuser/rpcuser.py for help with creating the proper string for rpcauth.

That's interesting..

Ok, So I've killed the bitcoin process, deleted the cookie and rebooted.
Same result, in php it works but not in terminal/ssh with bitcoin-cli.
I previously tried specifying datadir... same results.
staff
Activity: 3458
Merit: 6793
Just writing some code
December 22, 2016, 08:29:12 PM
#2
Are you using a separate datadir? If so, you need to specify it in the bitcoin-cli command.

Additionally, try stopping Bitcoin Core and seeing a file in the datadir named .cookie (or something like that) exists. If it does, then delete the file and restart Core and try again.

Lastly, rpcuser and rpcpassword have been deprecated and replaced with cookie authentication. For cookie auth, you read the user and pass from the aforementioned file. This user and pass will change every time your restart Bitcoin Core. If you do want to continue to use rpcuser and rpcpassword, I suggest you instead use rpcauth. You can take a look at https://github.com/bitcoin/bitcoin/blob/44f2df613f23d0a095a6e47b3d9c498b9df3055b/share/rpcuser/rpcuser.py for help with creating the proper string for rpcauth.
newbie
Activity: 2
Merit: 0
December 22, 2016, 03:09:12 PM
#1
Hi there,

I'm trying to set up a system for some specificv Penetration tests. So, I have an Hyper-V virtual machine running Ubuntu server 16.04.1 with Apache2(with PHP7) that accept request through Tor Hidden Service.
Also installed bitcoind with the conf:
server=1
listen=1
proxy=127.0.0.1:9050
rpcuser=myuser
rpcpassword=mypassword

bitcoind runs at boot from crontab.

Using easybitcoin.php "'library" I can see "getinfo", "sendtoaddress" etc.. tested with Tor browser bundle on an entirely different PC. so far so good.

The problem is that bitcoin-cli refuse to connect "cannot connect to server". I tried everything: user, root, using rpcuser & rpcpassword with the credentials in the conf, pointing to the conf, pointing to port, pointing to datadir, Nothing works!
Also tried to point it to the wrong port just to see if the error changes and it did, to 501.

What can I do to make it work?
Any Ideas?

Please Help!

Thanks
Jump to: