1

I can't seem to get a firm grasp of how to use the getwalletinfo RPC in the cmd line as well as in PHP code, The documentation says getwalletinfo doesn't take any parameters, but I've seen ways to send specific requests to the daemon this RPC. So, my question is, how do I use the getwalletinfo RPC in PHP to get information of a specific wallet?

1

getwalletinfo does not take parameters.

It sounds like what you are looking for is how to send getwalletinfo to a certain wallet loaded into Bitcoin Core. The way to do this is to use that wallet's API endpoint. The endpoint is /wallet/<name> where <name> is the name of the wallet you are trying to send commands to.

So the full URL that you need to send your RPC requests to is http://<ip>:<port>/wallet/<name> where <ip> is the IP address that Bitcoin Core is listening on (probably 127.0.0.1), <port> is the port the RPC interface is bound to (probably 8333), and <name> is the name of the wallet.

  • so that would be $bitcoin->getwalletinfo("http://127.0.0.1:8333/wallet/testwallet");? – frogman578 Aug 1 at 21:42
  • To be more specific, this is supposed to be automated, a new wallet is created for every user on my website. The way I see it, now that accounts are gone, wallets are the only thing to use! – frogman578 Aug 1 at 21:44
  • No, that is sending the URL as a parameter as getwalletinfo. As I said, getwalletinfo does not take parameters. You need to change $bitcoin to send RPC requests to http://127.0.0.1:8333/wallet/testwallet rather than http://127.0.0.1:8333/ – Andrew Chow Aug 1 at 22:17
  • So those changes take place in the bitcoin.conf file? Is the <ip><:port> the default URL? I can't think of anything else than parameters to use when automating the selection of wallets, this confuses me! – frogman578 Aug 1 at 22:32
  • No, they are not options to Bitcoin Core. They are something that you need to configure your RPC client to use. It's just like how for REST APIs you need to send requests to a certain URL. You need to do the same thing here; RPC is just a HTTP server where you send requests to a URL. This is something that you need to change in your PHP code. You need to look at the code for the RPC client in PHP and figure out how to set the URL it sends to. – Andrew Chow Aug 1 at 23:33

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.