Title: How to use -rpcwallet? Post by: OmegaStarScream on April 06, 2020, 07:49:50 AM I've been trying to use the following commands:
Code: bitcoin-cli -testnet listunspent But they're all returning the same error: Quote Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path). Try adding "-rpcwallet=<filename>" option to bitcoin-cli command line. Obviously, I tried to use -rpcwallet: Code: >bitcoin-cli -testnet -rpcwallet=/wallets/wallet.dat getnewaddress But that didn't work. It's telling me: requested wallet does not exist or is not loaded Now according to this article (https://bitcoin.org/en/release/v0.15.0.1#multi-wallet-support) (or at least from what I understood) I should use the -rpcwallet only if I'm running bitcoind with multiwallet, which I'm not doing here. Here is my bitcoin.config: Code: [test] Not sure if this changes anything, but my wallet.dat is not on the default location: D:\Bitcoin Core\testnet3\wallets\wallet.dat Any thoughts? Title: Re: How to use -rpcwallet? Post by: nc50lc on April 06, 2020, 10:31:46 AM TL;DR: Try 'loadwallet' first before using '-rpcwallet' using full directory path on both commands. Refer below for the commands.
Long "story" follows: I've been trying to use the following commands: It worked initially for me even if I use a different 'walletdir' in the config file.Code: bitcoin-cli -testnet listunspent But they're all returning the same error: But after using '-rpcwallet' once, only the two commands returned with the same error. The other one: bitcoin-cli -regtest createwallet xx still worked at my end. Any thoughts? Wallets from a different directory like E:\AppData\testdir\wallet1 just returned with this error:error code: -18 But it worked (with full directory path) after using 'loadwallet': Code: bitcoin-cli -regtest loadwallet E:\AppData\testdir\wallet1 Code: bitcoin-cli -regtest -rpcwallet=E:\AppData\testdir\wallet1 listunspent And my other test, I have other folders with wallet.dat in the same location as my custom wallet directory, using just that folder's name worked. Example: My custom wallet directory is in E:\AppData\testwalletdir My other wallet is in E:\AppData\testwalletdir\wallettest1 | These commands worked: Code: bitcoin-cli -regtest loadwallet wallettest1 Code: bitcoin-cli -regtest -rpcwallet=wallettest1 getnewaddress Title: Re: How to use -rpcwallet? Post by: OmegaStarScream on April 07, 2020, 01:25:32 PM Thanks for your response!
I ended up adding walletdir to my bitcoin.config since I didn't have any. Code: walletdir=D:/Bitcoin Core/testnet3/wallets/ And just like it happened with you, the commands worked fine the first time, but after that, only the createwallet did. As for using loadwallet, I tried it and I'm getting this error: Code: Wallet file verification failed: Invalid -wallet path 'D:\Bitcoin Core\testnet3\wallets\wallet.dat'. I tried to use: the full path, the directory, and also the filename on its own, but that didn't help. Title: Re: How to use -rpcwallet? Post by: nc50lc on April 08, 2020, 02:09:59 AM I tried to use: the full path, the directory, and also the filename on its own, but that didn't help. Adding the wallet.dat itself to the path wont work, just the path to the wallet.dat just like in my example.In your case, its should be bitcoin-cli -testnet loadwallet D:\Bitcoin Core\testnet3\wallets But since you've already included walletdir to the config, it should work now without using '-rpcwallet'. Figured that because core's createwallet doesn't create a renamed 'wallet.dat' but a folder with the name you've specified with a wallet.dat inside it. |