Bitcoin Forum
May 02, 2024, 07:29:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Working with multiple wallets in Bitcoin Core  (Read 168 times)
kbdwarrior (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 9


View Profile
December 03, 2020, 09:36:23 PM
Merited by vapourminer (1), ABCbits (1)
 #1

Hi, I'm trying to work with multiple wallets with Bitcoin Core on regtest, for learning purposes.

I created 3 wallets like

Code:
bitcoin-cli -regtest createwallet "wallet1"
bitcoin-cli -regtest createwallet "wallet2"
bitcoin-cli -regtest createwallet "wallet3"

Now I want to unload/load wallets, but

Code:
bitcoin-cli -regtest loadwallet "wallet1"
gives me an error message:

Code:
error code: -4
error message:
Wallet file verification failed: Error loading wallet wallet1. Duplicate -wallet filename specified.

Depending on the path I give for "wallet1" I get various different errors, but nothing loads the wallet.

I understand that I can specify the wallet via the
Code:
-rpcwallet="walletname"
option. But for what purpose are the loadwallet/unloadwallet commands? How are they meant to be used?

Thanks.
1714678185
Hero Member
*
Offline Offline

Posts: 1714678185

View Profile Personal Message (Offline)

Ignore
1714678185
Reply with quote  #2

1714678185
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, but full nodes are more resource-heavy, and they must do a lengthy initial syncing process. As a result, lightweight clients with somewhat less security are commonly used.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Rath_
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3131



View Profile
December 03, 2020, 10:49:24 PM
 #2

Now I want to unload/load wallets, but
Code:
bitcoin-cli -regtest loadwallet "wallet1"
gives me an error message:

Those wallets should have been loaded automatically after you have created them so that's why you're getting that error. What error do you get when you try to unload them?
BitMaxz
Legendary
*
Offline Offline

Activity: 3248
Merit: 2955


Block halving is coming.


View Profile WWW
December 03, 2020, 10:58:30 PM
Merited by vapourminer (1)
 #3

I think the error means that the wallet1 is already loaded according to the issue reported from here https://github.com/bitcoin/bitcoin/issues/14917
and some issue report it was a crash error code.

Are you running the latest version of the Bitcoin core? It seems they are trying to fix this issue and going to release a new version.
It seems they already have beta here v0.21.0

I think it would be better to report this issue directly to https://github.com/bitcoin/bitcoin/issues


Some other solution posted here https://github.com/bitcoin/bitcoin/pull/20199 and https://github.com/bitcoin/bitcoin/pull/19300

█▀▀▀











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











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

Activity: 2408
Merit: 5581


Self-proclaimed Genius


View Profile
December 04, 2020, 03:53:25 AM
Merited by Jet Cash (5), ABCbits (1)
 #4

I understand that I can specify the wallet via the
Code:
-rpcwallet="walletname"
option. But for what purpose are the loadwallet/unloadwallet commands? How are they meant to be used?
I second the post above but I think there's no issue on your side, the command is to load the specified wallet.
You got that error of Duplicate -wallet filename specified because that wallet was already loaded as you created it.

You should use loadwallet the second time you use Bitcoin core after your exit your current session.
And the quoted command is used when using RPC commands for a specific wallet after you've loaded it,
commands under "wallet RPC" wont work with a wallet that isn't loaded yet, you'll get an error instead:
Code:
Requested wallet does not exist or is not loaded

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

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

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

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

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

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











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











▄▄▄▄█
kbdwarrior (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 9


View Profile
December 06, 2020, 05:46:48 PM
 #5

Thanks for the answers, I now think that I just misunderstood the purpose of loadwallet/unloadwallet, there is no need to explicitly load a wallet after creation because they are all loaded automatically and selected via the
Code:
-rpcwallet="walletname"
option for a specific command. Right?

That leaves me with the question, what would be a usecase to unload and later load a wallet? Evt. making a backup while the node is running? Others?
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5581


Self-proclaimed Genius


View Profile
December 07, 2020, 02:53:17 AM
 #6

-snip- there is no need to explicitly load a wallet after creation because they are all loaded automatically and selected via the
Code:
-rpcwallet="walletname"
option for a specific command. Right?
Right, you'll need to add -rpcwallet to every wallet RPC commands if you've loaded more than one wallet, otherwise it'll return with an error:
Code:
Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).
Try adding "-rpcwallet=<filename>" option to bitcoin-cli command line.

It's not required for non-wallet-related RPC commands.

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

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

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

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

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

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











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











▄▄▄▄█
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
December 07, 2020, 11:57:46 PM
 #7

That leaves me with the question, what would be a usecase to unload and later load a wallet? Evt. making a backup while the node is running? Others?
Testing would be one use case (I just used this exact feature to grab a screenshot of the warning message that one gets if they encrypt a previously unencrypted wallet file)... It might also be useful for users who have and regularly use multiple wallets and don't want to accidentally use the wrong wallet when generating a receive address, or accidentally send from the wrong wallet...

Another use case I could think of would be a "holding" or "savings" wallet, that you don't often need to use... but may need to open occasionally to send/receive.

By "closing" or unloading a wallet that you don't want to use, you lessen the odds of using the wrong the wallet/addresses etc.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


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

Activity: 2408
Merit: 5581


Self-proclaimed Genius


View Profile
December 08, 2020, 05:17:34 AM
Merited by ABCbits (1)
 #8

That leaves me with the question, what would be a usecase to unload and later load a wallet? Evt. making a backup while the node is running? Others?
By "closing" or unloading a wallet that you don't want to use, you lessen the odds of using the wrong the wallet/addresses etc.
Those accidents might happen in the GUI with high probability but I think it's hard to make those mistakes in the command line since he need to specify
which wallet to use when using -getnewaddress or -sendtoaddress.
He's using the command line and that may be the reason he missed that and came up with that question.

To me, it's looks like he's already answered his question with his follow-up.

.
.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!