Author

Topic: Bitcoin connection with easybitcoin.php (Read 235 times)

legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
April 17, 2018, 03:54:30 AM
#4
Sellingaccs is correct... Here's the code from mocacinno.com:

Code:
require_once('easybitcoin.php');
$bitcoin = new Bitcoin('[your rcp username here]','[your rcp password here]','[bitcoind\'s ip address here]','8332');
?>


bob123 is also correct, your server can't have a firewall that blocks port 8332, the port has to be correct,.... This is testable by opening a console and entering:
Code:
lsof -i :8332

you can also try to open a telnet session from the host running the script to the host running the daemon (preferably the same host, since IIRC, json-rpc queries are sent in plain text)
Code:
telnet localhost 8332

oh, by the way, getinfo is depreciated.... i haven't updated my node yet, so i don't know if it's even still available...

Code:
{
  "deprecation-warning": "WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16",
  "version": 150100,
  "protocolversion": 70015,
  "walletversion": 60000,
  "balance": 0.00000000,
  "blocks": 518594,
  "timeoffset": 0,
  "connections": 30,
  "proxy": "",
  "difficulty": 3839316899029.672,
  "testnet": false,
  "keypoololdest": 1479499499,
  "keypoolsize": 1000,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}
legendary
Activity: 1624
Merit: 2481
April 17, 2018, 03:50:34 AM
#3
What problem exactly drives you crazy?

Did you 'open' the port? Note: When configuring the firewall on your router you need to configure port forwarding.
'Opening' ports mostly allows incoming connections to your router. This is not the same as forwarding (Forwarding = destination ports from packet header are being forwarded to the destination machine).

I think the majority of router does not distinguish between opening and forwarding. But there still quite a few which do.
member
Activity: 126
Merit: 50
Ask me for Pools, Nodes and Explorers.
April 16, 2018, 11:07:51 AM
#2
Not really familiar with php, but i suspect that the problem is indeed with ports or RPC details.
Try going to Canyouseeme.org then enter your port and see if it can connect to it.

If yes, then i'd suggest replacing then i'd try this code instead:

Code:

require_once 'easybitcoin.php';

$bitcoin = new Bitcoin('melog','mepass','localhost','8332');

$ginf $bitcoin->getinfo();

print_r($ginf);

?>


And if that does not work either then i'd try adding the "rpcport=port" value into your config file.
Does it give out any errors?
newbie
Activity: 1
Merit: 0
April 16, 2018, 10:53:34 AM
#1
Hi. I was testing how betcoin daemon worked with easybitcoin.php, and there was a problem which drove me crazy. So, I tried to make a test, iis absolutly easy and there's no mistake
Code:

require_once 'easybitcoin.php';

$bitcoin = new Bitcoin("melog""mepass");

$ginf $bitcoin->getinfo();

print_r($ginf);

?>
And in the guide there was shown an information about the wallet. So, i looked through my bitcoin.conf file, and it was correct, port 8332 was open and could you just advise please, what to do to make it work?? PLEASE!!!
Bitcoin.conf: "
rpcpassword=mepass
rpcuser=melog
daemon=1
server=1
"
Jump to: