<p>The HTTP 404 error is returned when an RPC command does not exist. The RPC command you are trying to use is <code>getwork</code>, and <code>getwork</code> was removed in Bitcoin Core 0.10.0. If you want to use <code>getwork</code>, you will need to downgrade to a version of Bitcoin Core prior to 0.10.0, but I would recommend that you not do that. Instead you should use <code>getblocktemplate</code> which you do by using the <code>--no-getwork</code> option. When you do that, you must also specify <code>--coinbase-addr=ADDR</code> since Bitcoin Core will not build a coinbase transaction for the miner to use. Instead the miner will need to make its own coinbase transaction and needs to have that option set.</p>

CC BY-SA 3.0
2017-07-17T08:05:13.517Z
2017-07-17T08:05:13.517Z
Ava Chow
<p>In case you changed your <code>/etc/systemd/system/bitcoind.service</code> make sure you run</p>
<pre><code> sudo systemctl stop bitcoind
 sudo systemctl daemon-reload
 sudo systemctl start bitcoind
</code></pre>
<p>to apply the changes.</p>

CC BY-SA 4.0
2020-11-06T21:12:41.010Z
2020-11-06T21:12:41.010Z
bomben
<p>I have a little problem with the launch of the software: <a href="https://bitcointalk.org/index.php?topic=55038.0" rel="nofollow noreferrer">https://bitcointalk.org/index.php?topic=55038.0</a></p>

<p>My blockchain is fully loaded and JSON-RPC also works, since I use it in a PHP script whose code is:</p>

<pre><code>&lt;a href="?api=getblockcount"&gt;getblockcount&lt;/a&gt; |  
&lt;a href="?api=getdifficulty"&gt;getdifficulty&lt;/a&gt; | 

&lt;?php

require_once 'jsonRPCClient.php';
$bitcoin = new jsonRPCClient('http://user:xxxxx@127.0.0.1:8332/');

switch ($_GET['api']) {
    case 'getblockcount':  
          echo "&lt;pre&gt;\n";
            $homepage = file_get_contents('https://blockchain.info/q/getblockcount');
            echo 'Blockchain: ' .$homepage;           
          print_r('&lt;br /&gt;Mybitcoin: '.$bitcoin-&gt;getblockcount()); 
          echo "&lt;/pre&gt;";        
        break;    
    case 'getdifficulty':
          echo "&lt;pre&gt;\n";
          print_r($bitcoin-&gt;getdifficulty());
          echo "&lt;/pre&gt;";        
        break; 

    default:
          echo "&lt;pre&gt;\n";
          print_r($bitcoin-&gt;getinfo());
          echo "&lt;/pre&gt;";        
        break;
}


?&gt;
</code></pre>

<p>The result:<br>
<a href="https://i.sstatic.net/D3yZY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/D3yZY.png" alt="Result php json rpc code"></a></p>

<p>So, I have installed cpuminer and when I try to run this (basic) command:</p>

<pre><code>./minerd --url=http://127.0.0.1:8332 --userpass=user:xxxxx
</code></pre>

<p>I get this error:</p>

<pre><code>[2017-02-27 15:54:30] Binding thread 0 to cpu 0
[2017-02-27 15:54:30] 4 miner threads started, using 'scrypt' algorithm.
[2017-02-27 15:54:30] Binding thread 3 to cpu 3
[2017-02-27 15:54:30] Binding thread 2 to cpu 2
[2017-02-27 15:54:30] Binding thread 1 to cpu 1
[2017-02-27 15:54:30] No payout address provided, switching to getwork
[2017-02-27 15:54:30] HTTP request failed: The requested URL returned error: 404 Not Found
[2017-02-27 15:54:30] json_rpc_call failed, retry after 30 seconds
</code></pre>

<p>I have tried also this one:</p>

<pre><code>./minerd --url=stratum+tcp://127.0.0.1:8332 --userpass=user:xxxxx
</code></pre>

<p>I get this error:</p>

<pre><code>[2017-02-27 16:05:18] Starting Stratum on stratum+tcp://127.0.0.1:8332
[2017-02-27 16:05:18] 4 miner threads started, using 'scrypt' algorithm.
[2017-02-27 16:05:18] Binding thread 2 to cpu 2
[2017-02-27 16:05:18] Binding thread 3 to cpu 3
[2017-02-27 16:05:18] Binding thread 1 to cpu 1
[2017-02-27 16:05:18] Binding thread 0 to cpu 0
[2017-02-27 16:05:18] JSON decode failed(1): '[' or '{' expected near 'HTTP'
[2017-02-27 16:05:18] stratum_subscribe send failed
[2017-02-27 16:05:18] ...retry after 30 seconds
</code></pre>

<p>Yet my JSON-RPC port is properly open and running!<br>
I do not understand.</p>

<p><strong>Edit:</strong>
Output of <code>--protocol-dump</code> </p>

<pre><code>         {
            "txid": "d164587bb86b8bc512875234d9e9287a5c2b55132b1ac5cd17199e59fb3a7e15",
            "depends": [],
            "data": "0100000005763ec95f443d56ad1d6d6dc548ceef54b3337aa17f3ade0919ffe17e20ee049b000000006b483045022100c4dc98e9b602562fa1804866e2941059506d0d774aabd1c598d9316015fc091b02202d1866f029d5f4ca583e39e40ac37b6f3cda053d7f72021d3d208c7e2436bf61012102a6b445dad7a9786aedcbef422c43403a0ef456e07c93b20f73e8d3a645ce2df6ffffffff9db45cd39689cf3f0c963998d2c47ef46d8b02135cfeed6eba3d0925274e3c7f000000006a473044022056c3c0953f585a1d00e4898fba74be331c98df8fe4fd06b7d27b1671e1c08cf802207c173699816b91d0349412a835f3c0b6b1dc67cd233e405cd59bb0ca4fa1e738012102043891b2c24b09518aee54721276376e1a804972e6eab942bef6eb21ce47a3d3ffffffff20c626710f914e611a5153fc022ceb38a96039a7d480643cd707792043537bd4000000006b483045022100b161d4f4851f2cb6f3b3a2f28ade52eca51ae9927246ec0ee99f88986b2a3f4102203bdffc99bce188c50861e3d6719ce17118a06ac5653a506fd1cf8791cca964ef012103c4059c0171448f778dd80ab5ae94f73f7c939c2563a774eb922790b9414c872effffffff90e4efff277de68fe237bd97a63dbc3ffdb2b8bc7eeccbb05299ce8ebc27d1a7010000006a47304402200de759505eb62f672619b4747b68d4ac29d752a2f877ae1bff8f3f53cc9830a202203eeb5ff9b60590db2c5b68e75752a9a4cbf095cce2ea05acbd6c7b5174ff41480121020d36c0a1534fb2a98f8850d2df417ad2e797d32e300291a4889d6312f17710e3ffffffffe7ab3f1e1e2335fd99b85d4c76e23a67b08b217a3028e07fefaace55772d9693000000006a47304402200db21539819e7f78144a114d52f0ad7a6c2d83989f9d21f87e484cacf8aa9501022023e250bc6abf248fd954eb99438569c17f1c7b9140a3f9ed5acf1aec794b13b7012103f193e01a1a8489f88f0a3ea96e19c8e22d613beb654fca59fd4f5d4abbbec4feffffffff027fea0300000000001976a9144003f281c42fb1cc2d21a2be92212cf97b52b72188acb9b91000000000001976a9142a1665bf1affbac0503d4bf7481c505d96bb07ca88ac00000000",
            "hash": "d164587bb86b8bc512875234d9e9287a5c2b55132b1ac5cd17199e59fb3a7e15",
            "fee": 147240,
            "weight": 3260,
            "sigops": 2
         },
         {
            "txid": "0049b022864e0f27ca17177b768dfd990d2aed315b82cbf5c7e6574243223593",
            "depends": [],
            "data": "0100000001b68373162494d0409621feeb056e9d5133ae26245e1a44f839fd3c98bbe2e86a010000006b483045022100c0bd2aca622330e46b1fd58148420b1297754524ff820ac8845bf4dc17a842b40220372666ba44e9289f1fb1ac965486889d6ac365a46c61e0e85e81d6dff97aa38d012102409fafcff27fb07a8b1ce51898f081d4e84ce947a09bb4e5046cd4601ee239adffffffff010fe80200000000001976a9145d5925ac98510c6d331f1c4653332b391d79a00888ac00000000",
            "hash": "0049b022864e0f27ca17177b768dfd990d2aed315b82cbf5c7e6574243223593",
            "fee": 34683,
            "weight": 768,
            "sigops": 1
         }
      ],
      "target": "0000000000000000027e93000000000000000000000000000000000000000000",
      "noncerange": "00000000ffffffff",
      "sigoplimit": 20000,
      "sizelimit": 4000000,
      "bits": "18027e93",
      "height": 454996
   },
   "id": 0
}
[2017-02-27 16:25:17] No payout address provided, switching to getwork
[2017-02-27 16:25:17] JSON protocol request:
{"method": "getwork", "params": [], "id":0}


* Rebuilt URL to: http://127.0.0.1:8332/
* Found bundle for host 127.0.0.1: 0x7f58a0013d60 [can pipeline]
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 8332 (#0)
* Server auth using Basic with user 'user'
&gt; POST / HTTP/1.1
Host: 127.0.0.1:8332
Authorization: Basic Y29pbmNvaW46YXplcnR5
Accept-Encoding: deflate, gzip
Content-Type: application/json
Content-Length: 45
User-Agent: cpuminer/2.4.5
X-Mining-Extensions: midstate

* The requested URL returned error: 404 Not Found
* Closing connection 0
[2017-02-27 16:25:17] HTTP request failed: The requested URL returned error: 404 Not Found
[2017-02-27 16:25:17] json_rpc_call failed, retry after 30 seconds
</code></pre>

<p>Output of <code>--no-getwork</code> </p>

<pre><code>root@localhost:~/cpuminer-2.4.5# ./minerd --url=http://127.0.0.1:8332 --userpass=user:***** --no-getwork
[2017-02-27 16:51:50] Binding thread 0 to cpu 0
[2017-02-27 16:51:50] Binding thread 1 to cpu 1
[2017-02-27 16:51:50] Binding thread 2 to cpu 2
[2017-02-27 16:51:50] 4 miner threads started, using 'scrypt' algorithm.
[2017-02-27 16:51:50] Binding thread 3 to cpu 3
[2017-02-27 16:51:50] No payout address provided
[2017-02-27 16:51:50] json_rpc_call failed, retry after 30 seconds
[2017-02-27 16:52:21] No payout address provided
</code></pre>

CC BY-SA 3.0
2017-02-27T16:14:18.523Z
Can you try replacing `stratum+tcp` with `http` ?
Nick ODell
CC BY-SA 3.0
2017-02-27T16:17:48.193Z
@NickODell yep the output is just below the image
atmon3r
CC BY-SA 3.0
2017-02-27T16:23:53.070Z
Can you try the `http` version with `--protocol-dump`, and post the output? I think cpuminer is trying to call a method that doesn't exist.
Nick ODell
CC BY-SA 3.0
2017-02-27T16:29:08.583Z
Oh! nice tips `--protocol-dump`, post edited with output
atmon3r
CC BY-SA 3.0
2017-02-27T16:45:07.460Z
Can you try the option `--no-getwork` ? PS. I didn't think of this before, but the Authorization header from the log contains your password.
Nick ODell
CC BY-SA 3.0
2017-02-27T16:54:36.563Z
is not password but user (but thanks) ^^ Post edited with `--no-getwork` I do not see much information about this command
atmon3r
CC BY-SA 3.0
2017-02-27T17:02:15.893Z
Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/54441/discussion-between-atmon3r-and-nick-odell).
atmon3r
CC BY-SA 3.0
2017-07-16T16:39:40.287Z
Did you resolve this issue? I'm having exact same problem.
TedPanopolis
CC BY-SA 3.0
2017-07-16T17:23:13.813Z
no! But I use another script that works much better to create its own bitcoin: https://cryptonotestarter.org/
atmon3r
<bitcoind><json-rpc>
json_rpc_call failed
atmon3r
# json_rpc_call failed

(Asked by: username_0 on 2017-02-27)

I have a little problem with the launch of the software: <https://bitcointalk.org/index.php?topic=55038.0>

My blockchain is fully loaded and JSON-RPC also works, since I use it in a PHP script whose code is:

```
<a href="?api=getblockcount">getblockcount</a> |  
<a href="?api=getdifficulty">getdifficulty</a> | 

<?php

require_once 'jsonRPCClient.php';
$bitcoin = new jsonRPCClient('http://user:xxxxx@127.0.0.1:8332/');

switch ($_GET['api']) {
    case 'getblockcount':  
          echo "<pre>\n";
            $homepage = file_get_contents('https://blockchain.info/q/getblockcount');
            echo 'Blockchain: ' .$homepage;           
          print_r('<br />Mybitcoin: '.$bitcoin->getblockcount()); 
          echo "</pre>";        
        break;    
    case 'getdifficulty':
          echo "<pre>\n";
          print_r($bitcoin->getdifficulty());
          echo "</pre>";        
        break; 

    default:
          echo "<pre>\n";
          print_r($bitcoin->getinfo());
          echo "</pre>";        
        break;
}

?>

```

The result:  
[![Result php json rpc code](https://i.sstatic.net/D3yZY.png)](https://i.sstatic.net/D3yZY.png)

So, I have installed cpuminer and when I try to run this (basic) command:

```
./minerd --url=http://127.0.0.1:8332 --userpass=user:xxxxx

```

I get this error:

```
[2017-02-27 15:54:30] Binding thread 0 to cpu 0
[2017-02-27 15:54:30] 4 miner threads started, using 'scrypt' algorithm.
[2017-02-27 15:54:30] Binding thread 3 to cpu 3
[2017-02-27 15:54:30] Binding thread 2 to cpu 2
[2017-02-27 15:54:30] Binding thread 1 to cpu 1
[2017-02-27 15:54:30] No payout address provided, switching to getwork
[2017-02-27 15:54:30] HTTP request failed: The requested URL returned error: 404 Not Found
[2017-02-27 15:54:30] json_rpc_call failed, retry after 30 seconds

```

I have tried also this one:

```
./minerd --url=stratum+tcp://127.0.0.1:8332 --userpass=user:xxxxx

```

I get this error:

```
[2017-02-27 16:05:18] Starting Stratum on stratum+tcp://127.0.0.1:8332
[2017-02-27 16:05:18] 4 miner threads started, using 'scrypt' algorithm.
[2017-02-27 16:05:18] Binding thread 2 to cpu 2
[2017-02-27 16:05:18] Binding thread 3 to cpu 3
[2017-02-27 16:05:18] Binding thread 1 to cpu 1
[2017-02-27 16:05:18] Binding thread 0 to cpu 0
[2017-02-27 16:05:18] JSON decode failed(1): '[' or '{' expected near 'HTTP'
[2017-02-27 16:05:18] stratum_subscribe send failed
[2017-02-27 16:05:18] ...retry after 30 seconds

```

Yet my JSON-RPC port is properly open and running!  
I do not understand.

**Edit:**
Output of `--protocol-dump`

```
         {
            "txid": "d164587bb86b8bc512875234d9e9287a5c2b55132b1ac5cd17199e59fb3a7e15",
            "depends": [],
            "data": "0100000005763ec95f443d56ad1d6d6dc548ceef54b3337aa17f3ade0919ffe17e20ee049b000000006b483045022100c4dc98e9b602562fa1804866e2941059506d0d774aabd1c598d9316015fc091b02202d1866f029d5f4ca583e39e40ac37b6f3cda053d7f72021d3d208c7e2436bf61012102a6b445dad7a9786aedcbef422c43403a0ef456e07c93b20f73e8d3a645ce2df6ffffffff9db45cd39689cf3f0c963998d2c47ef46d8b02135cfeed6eba3d0925274e3c7f000000006a473044022056c3c0953f585a1d00e4898fba74be331c98df8fe4fd06b7d27b1671e1c08cf802207c173699816b91d0349412a835f3c0b6b1dc67cd233e405cd59bb0ca4fa1e738012102043891b2c24b09518aee54721276376e1a804972e6eab942bef6eb21ce47a3d3ffffffff20c626710f914e611a5153fc022ceb38a96039a7d480643cd707792043537bd4000000006b483045022100b161d4f4851f2cb6f3b3a2f28ade52eca51ae9927246ec0ee99f88986b2a3f4102203bdffc99bce188c50861e3d6719ce17118a06ac5653a506fd1cf8791cca964ef012103c4059c0171448f778dd80ab5ae94f73f7c939c2563a774eb922790b9414c872effffffff90e4efff277de68fe237bd97a63dbc3ffdb2b8bc7eeccbb05299ce8ebc27d1a7010000006a47304402200de759505eb62f672619b4747b68d4ac29d752a2f877ae1bff8f3f53cc9830a202203eeb5ff9b60590db2c5b68e75752a9a4cbf095cce2ea05acbd6c7b5174ff41480121020d36c0a1534fb2a98f8850d2df417ad2e797d32e300291a4889d6312f17710e3ffffffffe7ab3f1e1e2335fd99b85d4c76e23a67b08b217a3028e07fefaace55772d9693000000006a47304402200db21539819e7f78144a114d52f0ad7a6c2d83989f9d21f87e484cacf8aa9501022023e250bc6abf248fd954eb99438569c17f1c7b9140a3f9ed5acf1aec794b13b7012103f193e01a1a8489f88f0a3ea96e19c8e22d613beb654fca59fd4f5d4abbbec4feffffffff027fea0300000000001976a9144003f281c42fb1cc2d21a2be92212cf97b52b72188acb9b91000000000001976a9142a1665bf1affbac0503d4bf7481c505d96bb07ca88ac00000000",
            "hash": "d164587bb86b8bc512875234d9e9287a5c2b55132b1ac5cd17199e59fb3a7e15",
            "fee": 147240,
            "weight": 3260,
            "sigops": 2
         },
         {
            "txid": "0049b022864e0f27ca17177b768dfd990d2aed315b82cbf5c7e6574243223593",
            "depends": [],
            "data": "0100000001b68373162494d0409621feeb056e9d5133ae26245e1a44f839fd3c98bbe2e86a010000006b483045022100c0bd2aca622330e46b1fd58148420b1297754524ff820ac8845bf4dc17a842b40220372666ba44e9289f1fb1ac965486889d6ac365a46c61e0e85e81d6dff97aa38d012102409fafcff27fb07a8b1ce51898f081d4e84ce947a09bb4e5046cd4601ee239adffffffff010fe80200000000001976a9145d5925ac98510c6d331f1c4653332b391d79a00888ac00000000",
            "hash": "0049b022864e0f27ca17177b768dfd990d2aed315b82cbf5c7e6574243223593",
            "fee": 34683,
            "weight": 768,
            "sigops": 1
         }
      ],
      "target": "0000000000000000027e93000000000000000000000000000000000000000000",
      "noncerange": "00000000ffffffff",
      "sigoplimit": 20000,
      "sizelimit": 4000000,
      "bits": "18027e93",
      "height": 454996
   },
   "id": 0
}
[2017-02-27 16:25:17] No payout address provided, switching to getwork
[2017-02-27 16:25:17] JSON protocol request:
{"method": "getwork", "params": [], "id":0}

* Rebuilt URL to: http://127.0.0.1:8332/
* Found bundle for host 127.0.0.1: 0x7f58a0013d60 [can pipeline]
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 8332 (#0)
* Server auth using Basic with user 'user'
> POST / HTTP/1.1
Host: 127.0.0.1:8332
Authorization: Basic Y29pbmNvaW46YXplcnR5
Accept-Encoding: deflate, gzip
Content-Type: application/json
Content-Length: 45
User-Agent: cpuminer/2.4.5
X-Mining-Extensions: midstate

* The requested URL returned error: 404 Not Found
* Closing connection 0
[2017-02-27 16:25:17] HTTP request failed: The requested URL returned error: 404 Not Found
[2017-02-27 16:25:17] json_rpc_call failed, retry after 30 seconds

```

Output of `--no-getwork`

```
root@localhost:~/cpuminer-2.4.5# ./minerd --url=http://127.0.0.1:8332 --userpass=user:***** --no-getwork
[2017-02-27 16:51:50] Binding thread 0 to cpu 0
[2017-02-27 16:51:50] Binding thread 1 to cpu 1
[2017-02-27 16:51:50] Binding thread 2 to cpu 2
[2017-02-27 16:51:50] 4 miner threads started, using 'scrypt' algorithm.
[2017-02-27 16:51:50] Binding thread 3 to cpu 3
[2017-02-27 16:51:50] No payout address provided
[2017-02-27 16:51:50] json_rpc_call failed, retry after 30 seconds
[2017-02-27 16:52:21] No payout address provided

```

**Tags:** bitcoind, json-rpc

> **Comments:**
> **username_1**: Can you try replacing `stratum+tcp` with `http` ?  
> **username_0**: @username_1 yep the output is just below the image  
> **username_1**: Can you try the `http` version with `--protocol-dump`, and post the output? I think cpuminer is trying to call a method that doesn't exist.  
> **username_0**: Oh! nice tips `--protocol-dump`, post edited with output  
> **username_1**: Can you try the option `--no-getwork` ? PS. I didn't think of this before, but the Authorization header from the log contains your password.  
> **username_0**: is not password but user (but thanks) ^^ Post edited with `--no-getwork` I do not see much information about this command  
> **username_0**: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/54441/discussion-between-username_0-and-username_1-username_1).  
> **username_2**: Did you resolve this issue? I'm having exact same problem.  
> **username_0**: no! But I use another script that works much better to create its own bitcoin: https://cryptonotestarter.org/  

---

## 2 answers

### Answer by username_3 on 2017-07-17. Score: 1

The HTTP 404 error is returned when an RPC command does not exist. The RPC command you are trying to use is `getwork`, and `getwork` was removed in Bitcoin Core 0.10.0. If you want to use `getwork`, you will need to downgrade to a version of Bitcoin Core prior to 0.10.0, but I would recommend that you not do that. Instead you should use `getblocktemplate` which you do by using the `--no-getwork` option. When you do that, you must also specify `--coinbase-addr=ADDR` since Bitcoin Core will not build a coinbase transaction for the miner to use. Instead the miner will need to make its own coinbase transaction and needs to have that option set.


---

### Answer by username_4 on 2020-11-06. Score: -1

In case you changed your `/etc/systemd/system/bitcoind.service` make sure you run

```
 sudo systemctl stop bitcoind
 sudo systemctl daemon-reload
 sudo systemctl start bitcoind

```

to apply the changes.


---

