1

Trying to implement Bitcoin JSON-RPC using Digital Ocean Ubuntu using bitcoin version 16.

Here is my php code

<?php

require_once('easybitcoin.php');

$bitcoin = new Bitcoin('someusername', 'somepassword');

print_r($bitcoin);

//print_r($bitcoin->getwalletinfo()());

$getinfo = $bitcoin->getblockchaininfo();

print_r($getinfo);

?>

Output

Bitcoin Object ( [username:Bitcoin:private] => someusername [password:Bitcoin:private] => somepassword [proto:Bitcoin:private] => http [host:Bitcoin:private] => localhost [port:Bitcoin:private] => 8332 [url:Bitcoin:private] => [CACertificate:Bitcoin:private] => [status] => [error] => [raw_response] => [response] => [id:Bitcoin:private] => 0 )

Giving error HTTP ERROR 500

I'm not much php aware, I tried enabling error reporting in php.ini but not getting errorlog.

Here is my bitcoin.conf

rpcuser=someusername
rpcpassword=somepassword
prune=600
maxconnections=12
maxuploadtarget=20
daemon=1
server=1
keypool=10000

Bitcoin server is fully synced in prune mode, up & running.bitcoin-cli properly working. If anyone have new working php-bitcoind examples, please share on vd30992@gmail.com

working bitcoin-cli

Thanks for any help.

Vishal Dalve
  • 147
  • 9

2 Answers2

1

getinfo was removed from Bitcoin Core 0.16. Use getblockchaininfo, getnetworkinfo, getmininginfo, or getwalletinfo depending on what you actually need. A mapping of each getinfo field to its replacement can be found here: https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.14.0.md#getinfo-deprecated

Andrew Chow
  • 67,209
  • 5
  • 76
  • 149
0

Working JSON-RPC from php. Reamined Ubuntu server configration causing problems.

Main thing ,allow 8332 port using sudo ufw allow 8332

Easybitcoin.php based on cURL. So install apt-get install php5-curl

Following post helped:

JSON RPC call from webpage to Bitcoin Core

Vishal Dalve
  • 147
  • 9