How to connect to coin RPC-Server with PHP

0 votes

What we have to write to IP and port to connect ? I want to use my *coin-qt as a rpc-server.

<?php 
require_once 'jsonRPCClient.php';
$coin = new   jsonRPCClient('rpcuser:rpcpw123@IP:PORT/');
$json =$coin->getnewaddress();        
   var_dump($json);
   echo "</pre>";  
 ?>

Here is my .conf file :

listen=1
maxconnections=32
gen=1
genproclimit=-1
server=1
rpcuser=rpcuser
rpcpassword=rpcpw123
daemon=1
Sep 12, 2018 in Blockchain by digger
• 26,740 points
1,628 views

1 answer to this question.

0 votes

If you want to connect inside your box to the bitcoin client, then you have to use:

<?php 
   require_once 'jsonRPCClient.php';
   $coin = new   jsonRPCClient('rpcuser:rpcpw123@localhost:8332/');
   $json =$coin->getnewaddress();        
   var_dump($json);
   echo "</pre>";  
 ?>

i.e: rpchost = localhost and rpcport = 8332 (default port for bitcoin). For a different altcoin, use the provided documentation.

You previously have to enable the rpcserver with these options in your conf file.

listen=1
server=1
daemon=1
rpcuser=rpcuser
rpcpassword=rpcpw123
rpcport=8332
rpcallowip=127.0.0.1
answered Sep 12, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

+4 votes
2 answers

I am unable to connect Ganache with Truffle/Npm Dev server. Pls help.

The issue is at CurrentProvider. Give the url ...READ MORE

answered Mar 26, 2018 in Blockchain by Perry
• 17,100 points

edited Oct 11, 2018 by Omkar 2,697 views
0 votes
1 answer

PHP IPC with geth Ethereum: How to communicate with client?

You have to use PHP Sockets $sock = socket_create(AF_UNIX, ...READ MORE

answered Oct 22, 2018 in Blockchain by Omkar
• 69,220 points
1,769 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,427 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,922 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
+1 vote
4 answers

How to connect peers to a private network using geth?

Follow the below steps to connect peers ...READ MORE

answered Jul 13, 2018 in Blockchain by slayer
• 29,370 points
14,213 views
0 votes
1 answer

How to solve Yobit API connection 503 server error?

Try to use "https://www.yobit.net/api/3/info" URL Instead of ...READ MORE

answered Aug 21, 2018 in Blockchain by slayer
• 29,370 points
823 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