I'm currently working on a little program for backing up your Bitcoin Core wallet. I am using BitcoinLib v1.15.0 in C#.

IBitcoinService bitcoinService = new BitcoinService("http://127.0.0.1:8332", "test", "test", "", 60);
bitcoinService.BackupWallet("C:\\Users\\dominik\\OneDrive\\Desktop\\backup");

When I run this code I get following error message Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path). I am a bit confused, because the BitcoinService.backupwallet(string destination) function has only one input parameter which I assume describes the path where it should generate the backup file (or at least that's the way this command works in Bitcoin Core's terminal).

Is there anyone with experience with BitcoinLib or similar problem. I am open to any suggestions. The error is related to multiple wallets open at once in Bitcoin Core.

5

There are 5 best solutions below

1
On BEST ANSWER

It worked after I've added /wallet/<wallet_name> to the RPC URL

0
On

For me the error was the bitcoin config file. Check the wallet name property wallet=<your_wallet_name> at bitcoin.conf is correct.

0
On

I got exactly the same error message, only because too much wallets where loaded in the same time.

With the latest client (Bitcoin Core 23.0), this can be solved using these API calls (in a kind of Python pseudo-code):

wallets_list = listwallets()
for w in wallets_list:
    unloadwallet(w)
loadwallet("my_wallet")
0
On

This is just a guess at this stage but you have not specified the file extension in this path "C:\Users\dominik\OneDrive\Desktop\backup" so it does not know exactly which file to look for. In other words the filename is incorrect as it is missing the extension of ".something". Otherwise something else is wrong with your path because maybe it has to have /wallet/ then the uri path but your path does not have that. Please let me know how you go.

0
On

If you willing to backup a wallet:

  1. Make sure your bitcoin node up and running
  2. Check used username & password (config file on Windows placed at %APPDATA%\bitcoin\bitcoin.conf)
  3. Use a path with slashes instead of backslashes, ie. c:/users/username/backup/bitcoin/ or c:/users/username/backup/bitcoin/wallet_backup.dat or ../backup/wallet_backup.dat