• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Wanted: Idiots guide to using RPC to talk to darkcoind

thelonecrouton

Well-known member
Foundation Member
...preferably using python.

I've figured out how to query the blockchain for whatever I want, but I want to be able to access a running instance of darkcoind and retieve the output of 'masternode list' etc.

I've got as far as being able to use this in python:
Code:
from jsonrpc import ServiceProxy
access = ServiceProxy("http://stu:[email protected]:8332")
getinfo = str(access.getinfo())
print getinfo
mininginfo = str(access.getmininginfo())
print mininginfo
lag = str(access.listaddressgroupings())
print lag
etc.
and standard bitcoin queries work but it doesn't work for any of the masternode related queries (masternode count, masternode list etc.) that I'm interested in.

How are other people pulling this info to produce sites like http://drk.poolhash.org/masternode.html ?

Thanks.

edit: never mind, I can do it this way...
Code:
r = subprocess.check_output('/home/stu/Downloads/darkcoin-0.10.11.6-linux/bin/64/darkcoind masternode list', shell=True)
print r
 
Last edited by a moderator:
Yes that works, I'm usually using ruby to do this.

Code:
puts rpc.masternode("start asdf1234")
And if this does not work, you can still call the daemon directly

Code:
puts `darkcoind masternode start asdf1234`
But you figured out already.

Calling the masternode commands directly using an rpc object might not work yet as the client does not accept valid json commands. This is due to the client still being developed on. You might want to create a ticket on github for that. https://github.com/darkcoinproject/darkcoin/issues
 
Back
Top