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,360 points
1,828 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,740 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
• 69,230 points
708 views
0 votes
1 answer

(bitcoin) Calculate hash from getwork function - how to do it?

This is correct as there is a ...READ MORE

answered Feb 28, 2022 in Blockchain by Soham
• 9,700 points
575 views
0 votes
0 answers

hd wallet bip44 in js - how to create an address for a chain other than bitcoin?

I have a small script basically taken ...READ MORE

Mar 2, 2022 in Blockchain by Aditya
• 7,680 points
905 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,740 points
44,603 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
1,787 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
742 views
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,740 points
1,098 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,740 points
2,407 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP