Author

Topic: How to use -rpcwallet? (Read 275 times)

legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
April 07, 2020, 10:09:59 PM
#4
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.
staff
Activity: 3402
Merit: 6065
April 07, 2020, 09:25:32 AM
#3
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'. 
-wallet path should point to a directory where wallet.dat and database/log.?????????? files can be stored,
a location where such a directory could be created, or (for backwards compatibility) the name of an existing data file
in -walletdir ("D:/Bitcoin Core\testnet3\wallets")

I tried to use: the full path, the directory, and also the filename on its own, but that didn't help.
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
April 06, 2020, 06:31:46 AM
#2
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:
Code:
bitcoin-cli -testnet listunspent
bitcoin-cli -testnet createwallet XXX
bitcoin-cli -testnet getnewaddress

But they're all returning the same error:
It worked initially for me even if I use a different 'walletdir' in the config file.
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
error message:
Requested wallet does not exist or is not loaded

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
Use 'loadwallet' only once.
staff
Activity: 3402
Merit: 6065
April 06, 2020, 03:49:50 AM
#1
I've been trying to use the following commands:
Code:
bitcoin-cli -testnet listunspent
bitcoin-cli -testnet createwallet XXX
bitcoin-cli -testnet getnewaddress

But they're all returning the same error:

Quote
Wallet file not specified (must request wallet RPC through /wallet/ uri-path).
Try adding "-rpcwallet=" 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 (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]
dbcache=8192
rpcuser=user
rpcpassword=pass
rpcallowip=127.0.0.1
rpcport=8332
rpcthreads=10
server=1

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?
Jump to: