Bitcoin Forum

Bitcoin => Electrum => Topic started by: ThatRandom8543 on April 30, 2017, 06:43:13 AM



Title: Is JSONRPC still supported?
Post by: ThatRandom8543 on April 30, 2017, 06:43:13 AM
I been messing around with electrum and decided to try its jsonrpc. After setting up the daemon and run the curl command, it gives an server error after running it.

Code:
curl --data-binary '{"id":"curltext","method":"getbalance","params":[]}' http://127.0.0.1:7777
{"error": {"message": "Server error:   File \"/usr/lib/python2.7/site-packages/electrum/commands.py\", line 301, in getbalance | AttributeError: 'NoneType' object has no attribute 'get_balance'", "code": -32603}, "jsonrpc": "2.0", "id": "curltext"}

Does electrum still support this? The version im using is 2.8.2. Maybe im doing something wrong or maybe something broke between the version the doc used and now.



Title: Re: Is JSONRPC still supported?
Post by: kolloh on April 30, 2017, 11:31:18 PM
I been messing around with electrum and decided to try its jsonrpc. After setting up the daemon and run the curl command, it gives an server error after running it.

Code:
curl --data-binary '{"id":"curltext","method":"getbalance","params":[]}' http://127.0.0.1:7777
{"error": {"message": "Server error:   File \"/usr/lib/python2.7/site-packages/electrum/commands.py\", line 301, in getbalance | AttributeError: 'NoneType' object has no attribute 'get_balance'", "code": -32603}, "jsonrpc": "2.0", "id": "curltext"}

Does electrum still support this? The version im using is 2.8.2. Maybe im doing something wrong or maybe something broke between the version the doc used and now.



The function is get_balance with an underscore. Check out http://docs.electrum.org/en/latest/protocol.html for more information on the JSONRPC.

Edit: looks like that is actually for querying the balance of an individual address which is different than what you were attempting.


Title: Re: Is JSONRPC still supported?
Post by: ThatRandom8543 on May 01, 2017, 03:27:45 AM
I been messing around with electrum and decided to try its jsonrpc. After setting up the daemon and run the curl command, it gives an server error after running it.

Code:
curl --data-binary '{"id":"curltext","method":"getbalance","params":[]}' http://127.0.0.1:7777
{"error": {"message": "Server error:   File \"/usr/lib/python2.7/site-packages/electrum/commands.py\", line 301, in getbalance | AttributeError: 'NoneType' object has no attribute 'get_balance'", "code": -32603}, "jsonrpc": "2.0", "id": "curltext"}

Does electrum still support this? The version im using is 2.8.2. Maybe im doing something wrong or maybe something broke between the version the doc used and now.



The function is get_balance with an underscore. Check out http://docs.electrum.org/en/latest/protocol.html for more information on the JSONRPC.

I tried that before and got an error that the method isnt supported (it does it with about anything that is not a proper command).

Code:
curl --data-binary '{"id":"curltext","method":"get_balance","params":[]}' http://127.0.0.1:7777
{"error": {"message": "Method get_balance not supported.", "code": -32601}, "jsonrpc": "2.0", "id": "curltext"}

With random method
Code:
curl --data-binary '{"id":"curltext","method":"balanceget","params":[]}' http://127.0.0.1:7777
{"error": {"message": "Method balanceget not supported.", "code": -32601}, "jsonrpc": "2.0", "id": "curltext"}


EDIT: I did notice that there was a fix in https://github.com/spesmilo/electrum/commit/0e49274eae9f497164ecc694729acdcf1188a43a but did that ever make it out in 2.8.2 or should I install master?


Title: Re: Is JSONRPC still supported?
Post by: ThatRandom8543 on May 08, 2017, 04:07:34 AM
It looks like electrum 2.8.2 isnt giving an error about the wallet being loaded, which is why I am getting the error above. I will lock this thread now but if I have any issues I will reopen it or just submit an issue to electrum github.