Author

Topic: Problems with multiple wallets on RPC in bitcoin-core (Read 192 times)

legendary
Activity: 1932
Merit: 1273
My plan is actually creating a transaction system on a third-party software.
What kind of transaction system?

Does BTCPay Server didn't suit your needs? https://docs.btcpayserver.org/UseCase/.
newbie
Activity: 4
Merit: 1
Oh got it! But im working on a program which will be creating a lot of new wallets etcetera. How would i be able to load all of these when for example starting Bitcoin Core?
And how would I about loading the wallet when i create it.
All of this should be through RPC ^^.

All RPC commands are already here https://chainquery.com/ and all wallet commands are here https://chainquery.com/bitcoin-cli#wallet

I think you are planning to create your own version of wallet?

What you want is already mentioned above to load a wallet after creating use the bitcoin-cli loadwallet "WalletName"
But if you mean to load all of the wallets you created at once I don't know if you can able to do that.

If your plan is to make a wallet(The version of yours) I think you can try to learn something about blockchain first below

- https://github.com/yjjnls/awesome-blockchain#implementation-of-blockchain

You can read the wallet under that link it might help to make a wallet program of yours or maybe it can help you to get some ideas.

My plan is actually creating a transaction system on a third-party software.
Im using Bitcoin Core to be able to avoid any ratelimits, downtime, etc.

And your answer and the answers above I fixed it!

Thanks!!!
legendary
Activity: 3374
Merit: 3095
Playbet.io - Crypto Casino and Sportsbook
Oh got it! But im working on a program which will be creating a lot of new wallets etcetera. How would i be able to load all of these when for example starting Bitcoin Core?
And how would I about loading the wallet when i create it.
All of this should be through RPC ^^.

All RPC commands are already here https://chainquery.com/ and all wallet commands are here https://chainquery.com/bitcoin-cli#wallet

I think you are planning to create your own version of wallet?

What you want is already mentioned above to load a wallet after creating use the bitcoin-cli loadwallet "WalletName"
But if you mean to load all of the wallets you created at once I don't know if you can able to do that.

If your plan is to make a wallet(The version of yours) I think you can try to learn something about blockchain first below

- https://github.com/yjjnls/awesome-blockchain#implementation-of-blockchain

You can read the wallet under that link it might help to make a wallet program of yours or maybe it can help you to get some ideas.
newbie
Activity: 4
Merit: 1
@kycklingrullen you have to load the wallet(s) first before you are able to use it on RPC.

Code:
bitcoin-cli loadwallet testingwallet
Use the above command to load wallets that you want to use. And to check if it's been loaded use: $ bitcoin-cli listwallets

Then i can run RPC commands but only get info from that wallet!
For multiple wallet RPC calls, you need to adjust the HTTP endpoint according to each of the wallet names.
e.g. http://myusername:[email protected]:18332/wallet/{walletname}
Oh got it! But im working on a program which will be creating a lot of new wallets etcetera. How would i be able to load all of these when for example starting Bitcoin Core?
And how would I about loading the wallet when i create it.
All of this should be through RPC ^^.
legendary
Activity: 1932
Merit: 1273
@kycklingrullen you have to load the wallet(s) first before you are able to use it on RPC.

Code:
bitcoin-cli loadwallet testingwallet
Use the above command to load wallets that you want to use. And to check if it's been loaded use: $ bitcoin-cli listwallets

Then i can run RPC commands but only get info from that wallet!
For multiple wallet RPC calls, you need to adjust the HTTP endpoint according to each of the wallet names.
e.g. http://myusername:[email protected]:18332/wallet/{walletname}
newbie
Activity: 4
Merit: 1
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.

There are at least 4 Python library which name contain "bitcoinrpc". Did you mean this library https://pypi.org/project/python-bitcoinrpc/?

In bitcoin-cli, you'll have to load all wallets that you want to work with,
then specify which wallet to use with each wallet command with -rpcwallet=
e.g.:
Code:
bitcoin-cli -testnet -rpcwallet=testingwallet getwalletinfo
Code:
bitcoin-cli -testnet -rpcwallet=otherwallet getwalletinfo

I don't know how to apply that to "python-bitcoinrpc" library though.
I checked the codebase on Github (a quick check) and I did not see any function for loading wallets. Therefore I don't believe python-bitcoinrpc supports this call at all.

Looks like so, there's 0 result for keyword "wallet", "key", "hd" and "private" on the source code.

Yep thats the library im using! And if you're wondering if it's the library that's making it not work, i tried with just making normal POST requests to the RPC. Still getting the same error:

{"result":null,"error":{"code":-18,"message":"Requested wallet does not exist or is not loaded"},"id":null}

And this is my test code with requests

----
import requests, json

headers = {'content-type': 'application/json'}
payload = json.dumps({"method": "getwalletinfo", "params": [], "jsonrpc": "2.0"})
response = requests.post("http://myusername:[email protected]:18332/wallet/testingwallet", headers=headers, data=payload)

print(response.text)
----
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
In bitcoin-cli, you'll have to load all wallets that you want to work with,
then specify which wallet to use with each wallet command with -rpcwallet=
e.g.:
Code:
bitcoin-cli -testnet -rpcwallet=testingwallet getwalletinfo
Code:
bitcoin-cli -testnet -rpcwallet=otherwallet getwalletinfo

I don't know how to apply that to "python-bitcoinrpc" library though.
I checked the codebase on Github (a quick check) and I did not see any function for loading wallets. Therefore I don't believe python-bitcoinrpc supports this call at all.
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
-snip-
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!
In bitcoin-cli, you'll have to load all wallets that you want to work with,
then specify which wallet to use with each wallet command with -rpcwallet=
e.g.:
Code:
bitcoin-cli -testnet -rpcwallet=testingwallet getwalletinfo
Code:
bitcoin-cli -testnet -rpcwallet=otherwallet getwalletinfo

I don't know how to apply that to "python-bitcoinrpc" library though.
newbie
Activity: 4
Merit: 1
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
    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!
Jump to: