Fatal error: Uncaught RuntimeException: Request have return error: Method not found; Request: {"jsonrpc":"2.0","method":"getblockcount","params":null,"id":1}; in jsonRPCClient.php:166
I don't know what to do. I started monero-wallet-rpc on the port and configured the example.php with port, localhost, username and password.
First I was running with no-rpc-auth and it gave me same error, then I deleted that argument and launched and told me unauthorized, then I edited the example.php and same error is up.
I also launched monerod in screen.
3 Answers
getblockcount is a daemon RPC, but you mention monero-wallet-rpc mostly. It is likely you are trying to call this RPC on the wallet, not on the daemon, and the wallet rightfully errors out.
-
This is the right answer. It's not an authorization problem, the
getblockcount
method just doesn't exist on the wallet RPC, only on the daemon RPC Commented Dec 22, 2018 at 8:46
Try params:{} maybe.
This one works for me:
curl -X POST http://127.0.0.1:28081/json_rpc -d
'{"jsonrpc":"2.0","id":"0","method":"getblockcount","params":{}}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"count": 1097471,
"status": "OK"
}
-
I tried if params = null, then params = {} but didn't work. Request have return error: Method not found; Request: {"jsonrpc":"2.0","method":"getblockcount","params":"{}","id":1} Commented May 20, 2018 at 18:23
-
Are you sure you're conneting to the right URL (/json_rpc), the right server/port ? Commented May 20, 2018 at 19:52
Have you try "id": "0"
instead of "id": "1"
From the deamon RPC dev guide (up to date):
curl -X POST http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_count"}' -H 'Content-Type: application/json'
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"count": 993163,
"status": "OK"
}
}
I ran it successfully when i did the update. So either the id field or the server you try to connect to is your problem.
Are you using both --confirm-external-bind
and --rpc-bind-ip 0.0.0.0
on your monderod?