0

I'm very new to Bitcoin development, using its RPC API.

I created a wallet using

{
    "method": "createwallet",
    "params": {
        "wallet_name": "/wallets/walletA"
    }
}

Now I want to get info about this wallet. I try to use the getwalletinfo command.

But it seems you can't specify the wallet name/path when running this command? You have to "load" the wallet first (using loadwallet)?

This is the part I do not understand. Let's say I have created 10 wallets and I try to run a getwalletinfo command in a multithreaded environment... How can I make sure I target the right wallet? Do I really have to send a loadwallet request to specify the wallet I want to work on, before getting info about it?

What will occure if I want to get information about "walletA" so I run loadwallet walletA, but before I can run getwalletinfo to get its info, a loadwallet walletB request is made?

1

When more than one wallet is available, the wallet is selected by sending the RPC requests to <host:port>/wallet/<wallet_name>.

You might have to play around with the exact form, I suspect it might be <host:port>/wallet/wallets/walletA in your case, or <host:port>/wallets/walletA, or <host:port>/wallet/walletA.

  • I have been unable to make this work. Maybe because I'm on Windows with backslahes in paths. I tried everything: url encoding, escaping backslahes, etc. I even looked at Bitcoin code, and I'm not sure paths are properly managed when following /wallet/ in urls! In the end, I decided to use the walletdir config in bitcoin.confin order to specify the directory where wallets will be created. And I only use the name of a wallet (no path) in the RPC /wallet/[wallet_name] url. This works. Hope it helps someone, one day. – electrotype Sep 21 at 13:57
  • By the way, thanks for your help Raghav! :-) – electrotype Sep 21 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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