Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dumpwallet behavior #9564

Closed
unsystemizer opened this issue Jan 15, 2017 · 11 comments
Closed

dumpwallet behavior #9564

unsystemizer opened this issue Jan 15, 2017 · 11 comments

Comments

@unsystemizer
Copy link
Contributor

unsystemizer commented Jan 15, 2017

In v0.13: dumpwallet "dumps all wallet keys in a human-readable format." (according to console help).

First, it's hard to tell where it dumps them.

Arguments:
1. "filename"    (string, required) The filename

I executed the action and couldn't find the file. Another way to look at this is "I executed the action and nothing happened".
Well, it turns out it did work, but the file ended up in the Bitcoin "root" directory (for me, c:\Bitcoin).
I bet some users would think that the command simply didn't work and you can see where it goes from there.

Second, the action behavior isn't particularly intuitive.
For example, I'm in E:\backup and I run
c:\bitcoin\bin\bitcoin-cli.exe dumpwallet wallet.txt
I think this shouldn't dump the wallet to c:\bitcoin\wallet.txt.

dumpwallet e:\backup\wallet.txtworks as expected (both from debug console and from the CLI).

This could be classified as a doco bug (e.g. change "The filename" to "The full path and filename"), or it could be improved in the code.

OS: English Windows 10 x64.

@jonasschnelli
Copy link
Contributor

More documentation is always good. Hence the fact that the Console/RPC interface if for experience users and (maybe) most of them are aware that a dump-to-filename command better gets supplied with a full absolute path.
Related: #9330

aideca added a commit to aideca/bitcoin that referenced this issue Feb 11, 2017
aideca added a commit to aideca/bitcoin that referenced this issue Apr 13, 2017
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this issue Apr 21, 2017
laanwj added a commit that referenced this issue Jun 5, 2017
164019d Add dumpwallet output test (aideca)
9f82134 Add friendly output to dumpwallet refs #9564 (aideca)

Tree-SHA512: 913fcf18d42eebe34173f1f2519973494b1ad2d86d125ff4bf566d6c64aa501c02f8831e6f44812cd87a46916f61c6f510146af406865b31856d8336c173569f
@cdecker
Copy link
Contributor

cdecker commented Sep 3, 2017

It appears that this was addressed in #9740, so this can be closed.

@maflcko maflcko closed this as completed Sep 5, 2017
@unsystemizer
Copy link
Contributor Author

@MarcoFalke it seems this should be reopened as doesn't seem fixed (at last not on Linux; originally I reported this with 0.13.2 for Windows).

Current help:

"1. \"filename\" (string, required) The filename with path (either absolute or relative to bitcoind)\n"
https://github.com/bitcoin/bitcoin/blob/v0.15.1/src/wallet/rpcdump.cpp#L600

Below we can see that relative path isn't relative to bitcoind, but to "user's home directory"

$ /home/user/Downloads/bitcoin-0.15.1/bin/bitcoin-cli dumpwallet github.txt
{
  "filename": "/home/user/github.txt"
}

Trying to use /tmp/Downloads:

$ cd /tmp
$ /home/user/Downloads/bitcoin-0.15.1/bin/bitcoin-cli dumpwallet Downloads/github.txt
{
  "filename": "/home/user/Downloads/github.txt"
}

In my case:

  • Bitcoin 0.15.1 (binary from BitcoinCore.org)
  • bitcoin.conf: /home/user/.bitcoin/bitcoin.conf
  • bitcoind location: /home/user/Downloads/bitcoin-0.15.1/bin/bitcoind

@d-rams
Copy link

d-rams commented Feb 20, 2018

I'm on OSX and I can't get dumpwallet to work in any sense

If I try a home-relative path, an absolute path, just a filename, in quotes, not in quotes etc. Absolutely nothing results in anything but Cannot open wallet dump file (code -8)

@d-rams
Copy link

d-rams commented Feb 20, 2018

The current help on OSX is


Arguments:
1. "filename"    (string, required) The filename

Examples:
> bitcoin-cli dumpwallet "test"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "dumpwallet", "params": ["test"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
 (code -1)```

@d-rams
Copy link

d-rams commented Feb 20, 2018

bitcoin-cli doesn't even come with bitcoin-Qt on OSX.

@jonasschnelli
Copy link
Contributor

If I try a home-relative path, an absolute path, just a filename, in quotes, not in quotes etc. Absolutely nothing results in anything but Cannot open wallet dump file (code -8)

Works for me on OSX.
Something like dumpwalet /Users/myuser/Desktop/wallet.dump.
Do you have special chars in your absolute path? Maybe a whitespace in your username?

bitcoin-cli doesn't even come with bitcoin-Qt on OSX.

Bitcoin-cli is not directly necessary when using bitcoin-Qt, because there is the internal QT based console.

@maflcko
Copy link
Member

maflcko commented Feb 20, 2018

@unsystemizer I think you'd have to start bitcoind from /tmp/ to make it the cwd.

In light of this, the path should either be normalized with a base path of the data dir (wallet dir) or the call should just reject all non-absolute paths.

@maflcko maflcko reopened this Feb 20, 2018
@d-rams
Copy link

d-rams commented Feb 21, 2018

Ok, I got past the error I was getting by running as root. Not sure why that should be necessary. I also ran the command to unlock my wallet first. However, since the wallet is unencryted this shouldn't be necessary. In any case I confirmed that it worked finally, so probably no issues on OSX other than documentation perhaps. Thanks for the help.

HashUnlimited pushed a commit to chaincoin/chaincoin that referenced this issue Mar 2, 2018
@dancju
Copy link

dancju commented May 26, 2018

@MarcoFalke
I was also facing this Cannot open wallet dump file (code -8) error.
After the working directory changed to /tmp, it seems work now:

> btc dumpwallet test
{
  "filename": "/tmp/test"
}

But I no such file /tmp/test could be found. I guess it is because the file was deleted automatically after the bitcoin-cli process exited.

My bitcoind daemon was launched through https://github.com/bitcoin/bitcoin/blob/master/contrib/init/bitcoind.service. The owner of bitcoind process was bitcoin user, which does have writing permission for most directories.

Am I always supposed to save the dump file into datadir?

@maflcko
Copy link
Member

maflcko commented Apr 27, 2020

Please just use absolute paths if relatives paths don't work for you. I don't think we can fix relative paths in a way to make everyone happy.

@maflcko maflcko closed this as completed Apr 27, 2020
maflcko pushed a commit that referenced this issue Apr 27, 2020
fa50170 wallet: Recommned absolute path for dumpwallet (MarcoFalke)

Pull request description:

  Avoids misunderstandings such as #9564

ACKs for top commit:
  kristapsk:
    utACK fa50170

Tree-SHA512: f675ef607992857ffeb556a2945b5436a70b39c5d83f05a8be15a6fccc84cbe9d03e52f8239e28d159e41ed7c6f119b7a38e8ab327029f04609f63c559c12c49
sidhujag pushed a commit to syscoin/syscoin that referenced this issue Apr 28, 2020
fa50170 wallet: Recommned absolute path for dumpwallet (MarcoFalke)

Pull request description:

  Avoids misunderstandings such as bitcoin#9564

ACKs for top commit:
  kristapsk:
    utACK fa50170

Tree-SHA512: f675ef607992857ffeb556a2945b5436a70b39c5d83f05a8be15a6fccc84cbe9d03e52f8239e28d159e41ed7c6f119b7a38e8ab327029f04609f63c559c12c49
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Jun 13, 2020
164019d Add dumpwallet output test (aideca)
9f82134 Add friendly output to dumpwallet refs bitcoin#9564 (aideca)

Tree-SHA512: 913fcf18d42eebe34173f1f2519973494b1ad2d86d125ff4bf566d6c64aa501c02f8831e6f44812cd87a46916f61c6f510146af406865b31856d8336c173569f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Jun 13, 2020
164019d Add dumpwallet output test (aideca)
9f82134 Add friendly output to dumpwallet refs bitcoin#9564 (aideca)

Tree-SHA512: 913fcf18d42eebe34173f1f2519973494b1ad2d86d125ff4bf566d6c64aa501c02f8831e6f44812cd87a46916f61c6f510146af406865b31856d8336c173569f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Jun 17, 2020
164019d Add dumpwallet output test (aideca)
9f82134 Add friendly output to dumpwallet refs bitcoin#9564 (aideca)

Tree-SHA512: 913fcf18d42eebe34173f1f2519973494b1ad2d86d125ff4bf566d6c64aa501c02f8831e6f44812cd87a46916f61c6f510146af406865b31856d8336c173569f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this issue Jun 18, 2020
164019d Add dumpwallet output test (aideca)
9f82134 Add friendly output to dumpwallet refs bitcoin#9564 (aideca)

Tree-SHA512: 913fcf18d42eebe34173f1f2519973494b1ad2d86d125ff4bf566d6c64aa501c02f8831e6f44812cd87a46916f61c6f510146af406865b31856d8336c173569f
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants