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.
- 34,928
- 2
- 58
- 123
- 1
- 1
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.
- 34,928
- 2
- 58
- 123
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"
}
- 34,928
- 2
- 58
- 123
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?
- 845
- 4
- 8