Bitcoin Forum
May 02, 2024, 01:01:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to use -rpcwallet?  (Read 276 times)
OmegaStarScream (OP)
Staff
Legendary
*
Offline Offline

Activity: 3458
Merit: 6106



View Profile
April 06, 2020, 07:49:50 AM
Last edit: April 06, 2020, 08:20:59 AM by OmegaStarScream
Merited by HeRetiK (1), ABCbits (1)
 #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/<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 (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?

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
1714611716
Hero Member
*
Offline Offline

Posts: 1714611716

View Profile Personal Message (Offline)

Ignore
1714611716
Reply with quote  #2

1714611716
Report to moderator
Transactions must be included in a block to be properly completed. When you send a transaction, it is broadcast to miners. Miners can then optionally include it in their next blocks. Miners will be more inclined to include your transaction if it has a higher transaction fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714611716
Hero Member
*
Offline Offline

Posts: 1714611716

View Profile Personal Message (Offline)

Ignore
1714611716
Reply with quote  #2

1714611716
Report to moderator
1714611716
Hero Member
*
Offline Offline

Posts: 1714611716

View Profile Personal Message (Offline)

Ignore
1714611716
Reply with quote  #2

1714611716
Report to moderator
nc50lc
Legendary
*
Offline Offline

Activity: 2394
Merit: 5578


Self-proclaimed Genius


View Profile
April 06, 2020, 10:31:46 AM
Merited by OmegaStarScream (2), bones261 (2), HeRetiK (1), ABCbits (1), Heisenberg_Hunter (1)
 #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.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
OmegaStarScream (OP)
Staff
Legendary
*
Offline Offline

Activity: 3458
Merit: 6106



View Profile
April 07, 2020, 01:25:32 PM
Last edit: April 07, 2020, 01:39:14 PM by OmegaStarScream
 #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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
nc50lc
Legendary
*
Offline Offline

Activity: 2394
Merit: 5578


Self-proclaimed Genius


View Profile
April 08, 2020, 02:09:59 AM
Merited by OmegaStarScream (2)
 #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.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!