I'm running a Bitcoin testnet node on a Ubuntu 22.04 VM using UTM for Macbooks M1.
I'm trying to connect via json-rpc using https://github.com/jgarzik/python-bitcoinrpc.
1 - I installed the package etc..
2 - I edited my .conf file in /home/kk/snap/bitcoin-core/common/.bitcoin/bitcoin.conf
:
server=1
testnet=1
daemon=1
prune=1000
fallbackfee=0.00001
rpcuser=kk
rpcpassword=testpass
rpcallowip=127.0.0.1
[test]
rpcbind=127.0.0.1
rpcport=18332
3 - I created a file called "btcrpc.py":
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from print import pprint
# rpc_user and rpc_password are set in the bitcoin. conf file
rpc_user = "kk"
rpc_pass = "testpass"
rpc_host = "127.0.0.1"
pc_client = AuthServiceProxy(f'http://frpc_user}:{rpc_pass}@{rpc_host}:18332", timeout=120)
block_count = rpc_client.getblockcount()
print (block_count)
When I run btcrpc.py that's the error:
What am I doing wrong?