Bitcoin Forum
September 22, 2018, 06:22:57 AM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Bitcoin connection with easybitcoin.php  (Read 82 times)
sirtorvald
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
April 16, 2018, 03:53:34 PM
 #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:
<?php

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
"
1537597377
Hero Member
*
Offline Offline

Posts: 1537597377

View Profile Personal Message (Offline)

Ignore
1537597377
Reply with quote  #2

1537597377
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1537597377
Hero Member
*
Offline Offline

Posts: 1537597377

View Profile Personal Message (Offline)

Ignore
1537597377
Reply with quote  #2

1537597377
Report to moderator
Sellingaccs
Member
**
Offline Offline

Activity: 126
Merit: 49

Ask me for Pools, Nodes and Explorers.


View Profile
April 16, 2018, 04:07:51 PM
 #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:
<?php

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?

bob123
Hero Member
*****
Offline Offline

Activity: 686
Merit: 568



View Profile WWW
April 17, 2018, 08: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.

mocacinno
Legendary
*
Offline Offline

Activity: 1344
Merit: 1196


http://www.mocacinno.com


View Profile WWW
April 17, 2018, 08:54:30 AM
 #4

Sellingaccs is correct... Here's the code from mocacinno.com:

Code:
<?php
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": ""
}

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!