dumpwallet behavior #9564

issue unsystemizer openend this issue on January 15, 2017
  1. unsystemizer commented at 8:55 pm on January 15, 2017: contributor

    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.

    0Arguments:
    11. "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.

  2. fanquake added the label RPC/REST/ZMQ on Jan 16, 2017
  3. fanquake added the label Wallet on Jan 16, 2017
  4. jonasschnelli added the label Easy to implement on Jan 16, 2017
  5. jonasschnelli commented at 12:39 pm on January 16, 2017: 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: https://github.com/bitcoin/bitcoin/pull/9330
  6. aideca referenced this in commit bd648cbe96 on Feb 10, 2017
  7. aideca referenced this in commit 060a9a0c78 on Feb 10, 2017
  8. aideca referenced this in commit 192af7b34f on Feb 11, 2017
  9. aideca referenced this in commit 9f82134779 on Apr 13, 2017
  10. luke-jr referenced this in commit 46b45bf3cd on Apr 21, 2017
  11. laanwj referenced this in commit 9fec4da0be on Jun 5, 2017
  12. cdecker commented at 6:42 pm on September 3, 2017: contributor
    It appears that this was addressed in #9740, so this can be closed.
  13. MarcoFalke closed this on Sep 5, 2017

  14. unsystemizer commented at 6:34 am on December 9, 2017: contributor

    @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”

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

    Trying to use /tmp/Downloads:

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

    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
  15. d-rams commented at 4:41 am on February 20, 2018: none

    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)

  16. d-rams commented at 4:42 am on February 20, 2018: none

    The current help on OSX is

    0
    1Arguments:
    21. "filename"    (string, required) The filename
    3
    4Examples:
    5> bitcoin-cli dumpwallet "test"
    6> 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/
    7 (code -1)```
    
  17. d-rams commented at 4:43 am on February 20, 2018: none
    bitcoin-cli doesn’t even come with bitcoin-Qt on OSX.
  18. jonasschnelli commented at 8:59 am on February 20, 2018: 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.

  19. MarcoFalke commented at 6:58 pm on February 20, 2018: member

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

  20. MarcoFalke reopened this on Feb 20, 2018

  21. d-rams commented at 5:00 pm on February 21, 2018: none
    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.
  22. HashUnlimited referenced this in commit fe7fbd6ec8 on Mar 2, 2018
  23. dancju commented at 2:21 pm on May 26, 2018: none

    @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:

    0> btc dumpwallet test
    1{
    2  "filename": "/tmp/test"
    3}
    

    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?

  24. MarcoFalke commented at 0:24 am on April 27, 2020: member
    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.
  25. MarcoFalke closed this on Apr 27, 2020

  26. MarcoFalke referenced this in commit 8bdb2134fc on Apr 27, 2020
  27. sidhujag referenced this in commit 78553b6d93 on Apr 28, 2020
  28. PastaPastaPasta referenced this in commit 7e83ca1c43 on Jun 13, 2020
  29. PastaPastaPasta referenced this in commit 0d9b1da368 on Jun 13, 2020
  30. PastaPastaPasta referenced this in commit 6600551e2a on Jun 17, 2020
  31. PastaPastaPasta referenced this in commit 7a33600dcd on Jun 18, 2020
  32. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-22 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me