2
I'm running a testnet node. I can use bitcoin-cli just fine:
>bitcoin-cli.exe getinfo
{
"version" : 100000,
"protocolversion" : 70002,
"walletversion" : 60000,
[... snipped]
But when I run this python code:
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
import logging
rpc_user = "rpcuser"
rpc_password = "xxxxx"
logging.basicConfig()
logging.getLogger("BitcoinRPC").setLevel(logging.DEBUG)
rpc_connection = AuthServiceProxy("http://%s:%s@192.168.1.39:8332/" % (rpc_user, rpc_password))
print(rpc_connection.getinfo())
I get this error:
DEBUG:BitcoinRPC:-1-> getinfo []
Traceback (most recent call last):
File "<path>\rawtransactiondemo\raw.py", line 11, in <module>
print(rpc_connection.getinfo())
[... snipped]
File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
This is my bitcoin.conf:
testnet=1
rpcuser=bitcoinrpc
rpcpassword=xxxxx
daemon=1
rpcport=8332
rpcallowip=192.168.1.39
bind=192.168.1.39
I'm using the python-bitcoinrpc library.
3It's not required; you just need to use the same ports on both ends. In my bitcoin.conf, I set rpcport to 8332. – Nick ODell – 2015-03-13T14:15:05.933
@NickODell That would explain my testnet connectivity issues; I didn't realize the conf rpcport=8332 flag set port 8332 for mainnet AND testnet – Wizard Of Ozzie – 2015-03-15T10:42:03.773