Skip to content

Instantly share code, notes, and snippets.

@kokjo
Created May 19, 2013 18:47
Show Gist options
  • Save kokjo/5608566 to your computer and use it in GitHub Desktop.
Save kokjo/5608566 to your computer and use it in GitHub Desktop.
Simple and short bitcoind jsonrpc api access.
import jsonrpc
from jsonrpc import ServiceProxy
from os.path import expanduser
conf = {p[0]: p[1].strip() for p in
(l.split("=", 1) for l in open(expanduser("~/.bitcoin/bitcoin.conf")))
if len(p) == 2}
proxy = ServiceProxy("http://%(rpcuser)s:%(rpcpassword)s@127.0.0.1:8332"%conf)
info = proxy.getinfo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment