4

I have been playing around a bit with Bitcoin Core (version 23.0), more specifically connecting to different wallets in Bitcoin Core through RPC in Python. I have found this library and tried to connect to my wallet(s) using this code:

from bitcoinrpc.authproxy import AuthServiceProxy

conn = AuthServiceProxy("http://myusername:[email protected]:18332/wallet/testingwallet")
print(conn.getwalletinfo())

But when running this i get this stacktrace:

Traceback (most recent call last):
  File "/home/kebab/Desktop/pron/testing.py", line 24, in <module>
    print(a.getwalletinfo())
  File "/home/kebab/.local/lib/python3.8/site-packages/bitcoinrpc/authproxy.py", line 141, in __call__
    raise JSONRPCException(response['error'])
bitcoinrpc.authproxy.JSONRPCException: -18: Requested wallet does not exist or is not loaded

Though what I have noticed is that if i load the wallet using bitcoin-cli -testnet loadwallet testingwallet. Then i can run RPC commands but only get info from that wallet!

And I have created my wallet using: bitcoin-cli -testnet createwallet testingwallet

Any help on this would really be appreciated!

1 Answer 1

1

You have to load the wallet into bitcoin core before you can use it. So first, load all the wallets you want to use with bitcoin-cli loadwallet. To verify the loaded wallets, you can use bitcoin-cli listwallets

After you have loaded the wallets you can specify the wallet in the connection. The format is <RPC IP address>:<RPC port>/wallet/<wallet name>, for example https://127.0.0.1:8332/wallet/wallet1.dat.

Info from wiki https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#Multi-wallet_RPC_calls and this discussion https://bitcointalk.org/index.php?topic=5398213.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.