ercfre
ercfre

Reputation: 193

How do I run this bitcoin python model (by PlanB) on my mac?

PlanB uploaded the code for his model re: pricing Bitcoin to github. I want to try and run it.

I clone the repo and setup python but then I get stuck (I know, not very far)

But when I run python rpc\ \(copy\).py I receive:

Traceback (most recent call last):
  File "rpc (copy).py", line 6, in <module>
    bbh = rpc_connection.getblockhash(i)
  File "/Library/Python/2.7/site-packages/bitcoinrpc/authproxy.py", line 136, in __call__
    'Content-type': 'application/json'})
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 832, in connect
    self.timeout, self.source_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 575, in create_connection
    raise err
socket.error: [Errno 61] Connection refused

I'm trying to move thru this one step at a time.

Do I need to download Bitcoin Core / bitcoind the Bitcoin Daemon?

I believe that I need to have a server running of some kind for this python script to interact with.

I have found the bitcoin python RPC by Garzik but fail to see how I can set it up / use it.

Failing that, what do I need to do next?

Thank you.

Upvotes: -1

Views: 164

Answers (1)

alphazeta
alphazeta

Reputation: 493

Noticed this is an old question but worth addressing.

PlanB's source code pulls data from a Bitcoin Full node using RPC. You would need a node running in order for the code to work.

If you look at the rpc (copy).py file:

rpc_connection = AuthServiceProxy("http://%s:%[email protected]:8332"%('username', 'password'), timeout = 500)

The code above is using RPC port 8332 at IP 127.0.0.1 using 'username' and 'password'.

All of these variables can be changed on the bitcoin.conf file after a node is installed.

Upvotes: -1

Related Questions