I'm trying to interact with the bitcoin network with Bitcoin Core server and the JSON RPC PHP library found on the wiki here: https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%

My setup:

I installed the Bitcoin core client, created the bitcoin.conf file with the settings:


the wallet is synchronised with the network.

I tried the example on the wiki like this:

require_once 'jsonRPCClient.php';
$bitcoin = new   jsonRPCClient('http://finder:AcdfghHBTfYHTFytBG526@');
print_r($bitcoin->getwork()); echo "\n";

When running the code I'm getting the error:

 Warning:  fopen(http://...@ failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in D:\xampp\htdocs\p\jsonRPCClient.php on line 132

Fatal error:  Uncaught exception 'Exception' with message 'Unable to connect to http://finder:AcdfghHBTfYHTFytBG526@' in D:\xampp\htdocs\p\jsonRPCClient.php:140
Stack trace:
0 D:\xampp\htdocs\p\index.php(9): jsonRPCClient->__call('getwork', Array)
1 D:\xampp\htdocs\p\index.php(9): jsonRPCClient->getwork()
2 {main}
  thrown in D:\xampp\htdocs\p\jsonRPCClient.php on line 140

I'm running the server with the batch command bitcoin-qt.exe -server Is there anything else I need to do to get the data from the network?

  • Is the firewall allowing connections? Try your browser with ... It should popup with credentials if all is well. Otherwise you may need a bitcoin.conf with rpcallowip Mar 20 '15 at 12:26
  • The credentials window shows up.In the meantime I've made some JSON requests without the library, I tried several API methods and all work except the 'getwork' method, was it removed completely? When I call it I'm getting the response {"result":null,"error":{"code":-32601,"message":"Method not found"},"id":"anything"}
    – free man
    Mar 20 '15 at 19:24
  • 1
    Are you using the latest version of Bitcoin? getwork has been removed in favor of getblocktemplate. Does getblocktemplate work?
    – Nick ODell
    Mar 22 '15 at 0:04
  • Yes I'm using the latest version of Bitcoin, getblocktemplate works perfectly. Thank you for clarifying that.
    – free man
    Mar 22 '15 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.