3

I have a headless Bitcoin core 0.17.1 running on Debian 10, and have created a second wallet "johns-wallet".

I'd like to get the walletinfo (or any wallet request) of that specific wallet via curl, not the cli.

The Bitcoin core API reference doesn't offer an example of how to target different wallets when not using the CLI (and neither did my Google search).

I've tried:

curl --user johnsmith --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getwalletinfo", "params": [] }' -H 'content-type: text/plain;' bitcoind:18332/wallets/johns-wallet/

and also

curl --user johnsmith --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getwalletinfo", "params": ["/wallets/johns-wallet/"] }' -H 'content-type: text/plain;' bitcoind:18332

And also variations on the path itself to the wallet - none of them return a result, let alone an error.

Running without trying to specify a wallet returns:

{"result":null,"error":{"code":-19,"message":"Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path)."},"id":"curltest"}

(In case it matters, the Bitcoind is running in a docker container, with a named volume)

1
  • 2
    Off the top of my head, the path needs to match the wallet path relative to your datadir - so bitcoind:8332/wallets/john only works if your wallets are actually in $datadir/wallets/. I might be wrong on this though Jul 7, 2020 at 17:25

1 Answer 1

0

This is the command I use - the http address is the address of the docker container that the Bitcoin daemon is running in

curl --user johnsmith --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbalance", "params": ["*", 6] }' -H 'content-type: text/plain;' http://10.0.0.1:18332/

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.