How to access bitcoin Daemon from other services?

0 votes

I have built Catcoind (a fork of the Bitcoin / project) and I can access the commands in my terminal by doing this from root:

cd catcoin/src 
./catcoind -daemon

That will start Catcoind, open the port, and allow me to type commands like './catcoind getdifficulty', but I want to access them from a PHP JSON-RPC client running on another server. The code I currently have there is:

<?php

require_once 'jsonRPCClient.php'; 

$catcoin = new jsonRPCClient('http://RPCUSER:RPCPASS@IP:PORT'); 

print_r($catcoin->getinfo()); 
echo $catcoin->getdifficulty();

My config file for the Catcoind build on Ubuntu is:

server=1

rpcuser=USER

rpcpassword=PASS

rpcssl=0

rpcallowip=*

bind=IP:PORT

externalip=IP

proxy=IP:PORT

port=PORT

rpcconnect=IP
When I run the code, it says that it failed to open the stream / connection refused. The config for Catcoind is at location ~/.catcoin/catcoin.conf. Any ideas?
Aug 29, 2018 in Blockchain by slayer
• 29,050 points
206 views

1 answer to this question.

0 votes

You don't need all these things to be written in conf file just use following

server=1
daemon=1
rpcuser=<user_namer>
rpcpassword=<password>
rpctimeout=30

if connecting from remote host do add following line

rpcallowip=<remote_ip_address>

save and exit from conf file and restart daemon by first stopping it catecoind stop and then catcoind start

answered Aug 29, 2018 by digger
• 26,550 points

Related Questions In Blockchain

0 votes
1 answer
0 votes
1 answer

How to read the ETH value and other token values from an account?

You can do this eth.accounts shows you all known ...READ MORE

answered Oct 22, 2018 in Blockchain by Omkar
• 67,480 points
31 views
0 votes
1 answer

How is a request sent from an app to a smart contract?

Yes, the contract is distributed by every node ...READ MORE

answered Jun 4, 2018 in Blockchain by Perry
• 17,020 points
50 views
+1 vote
2 answers

How to return value from a chaincode in Hyperledger Fabric?

Hyperledger Fabric supports only 2 types of ...READ MORE

answered Jun 13, 2018 in Blockchain by Perry
• 17,020 points
813 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,550 points
3,066 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
140 views
0 votes
1 answer
0 votes
1 answer

How i can use nodejs to watch transactions in bitcoin network?

you can use  const Socket = require('blockchain.info/Socket'); const mySocket ...READ MORE

answered Jul 9, 2018 in Blockchain by digger
• 26,550 points
46 views
0 votes
1 answer

How to extract h160 address of bitcoin blockchain?

You can extract the data using the ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,550 points
121 views