I am experimenting with the blockchain a bit, specifically trying to use the python-OP_RETURN module to put a few bytes into the blockchain op_return field. To use this module I blv I need a running bitcoin core instance so I installed bitcoind using a downloaded .tar.gz (and not thru the ppa which raised some system issues iirc). Anyway, I have the bitcoind daemon running and by writing a bitcoin.conf file it seems I can avoid devoting 200+GB to this by using the prune paramter. I also set the following in bitcoin.conf:
rpcuser=myuser
rpcpassword=mypassword
testnet=0
rpcport=8332
rpcallowip=127.0.0.1
rpcallowip=1.2.3.4
server=1
and now wanted to try putting some bytes into the blockchain :
jeremy@instance-1:~$ python3 python-OP_RETURN/store-OP_RETURN.py 'This example stores 47 bytes in the blockchain.'
testnet False [**this is debug info I printed]
url http://127.0.0.1:8332/ req {'id': '1620597001.3218298-441058', 'method': 'getinfo', 'params': ()} [**this is also debug info I printed]
Traceback (most recent call last):
File "python-OP_RETURN/store-OP_RETURN.py", line 47, in <module>
result=OP_RETURN_store(data, testnet)
File "/home/jeremy/python-OP_RETURN/OP_RETURN.py", line 116, in OP_RETURN_store
if not OP_RETURN_bitcoin_check(testnet):
File "/home/jeremy/python-OP_RETURN/OP_RETURN.py", line 410, in OP_RETURN_bitcoin_check
info=OP_RETURN_bitcoin_cmd('getinfo', testnet)
File "/home/jeremy/python-OP_RETURN/OP_RETURN.py", line 477, in OP_RETURN_bitcoin_cmd
raw_result=urlopen(url, json.dumps(request).encode('utf-8'), OP_RETURN_NET_TIMEOUT).read()
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.7/urllib/request.py", line 563, in error
result = self._call_chain(*args)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 1034, in http_error_401
url, req, headers)
File "/usr/lib/python3.7/urllib/request.py", line 987, in http_error_auth_reqed
return self.retry_http_basic_auth(host, req, realm)
File "/usr/lib/python3.7/urllib/request.py", line 997, in retry_http_basic_auth
return self.parent.open(req, timeout=req.timeout)
File "/usr/lib/python3.7/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.7/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
So my question is how I would avoid the 404 , and/or why its happening. The url and request from line 477 are
http://127.0.0.1:8332/ and {'id': '1620597001.3218298-441058', 'method': 'getinfo', 'params': ()} respectively. Should I use telnet maybe to check if the host:port is responding?