Add dumpwallet and importwallet RPC commands #2592

pull sipa wants to merge 3 commits into bitcoin:master from sipa:dumpwallet changing 8 files +295 −18
  1. sipa commented at 9:33 PM on April 29, 2013: member

    These commands dump/import (all) wallet keys in a human-readable format that is intended to be compatible with Bitcoin Wallet for Android and Multibit.

    It infers safe lower bounds on the birth time of keys based on wallet transactions, and only rescans the relevant part of the chain after importing.

    It supports keypool/change/unlabelled/labelled addresses, and restores those correctly. When inferring birth times, it takes crediting into account via pay-to-pubkey, pay-to-pubkeyhash, multisig (even when not all keys are available) and P2SH. P2SH scripts in the wallet are not yet dumped to the file. I'll need to talk to the other client authors about that first.

    I think we should encourage entire-wallet export/import above fiddling with individual keys, so something like this makes that easier and more transparent.

    Note: this is intended for 0.9 or later.

  2. BitcoinPullTester commented at 10:36 PM on April 29, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/44ace9892812b59c9a0070bea270a95536cf2193 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  3. laanwj commented at 12:29 PM on May 5, 2013: member

    A very useful feature to have, which removes the need for external scripts such as pywallet in many cases.

    I've played with this a bit and I wonder: would it make sense to add a way to output the dump over http/json as well, in addition to exporting to a file on the server?

    This would make it possible to pipe the output of dumpwallet to something else without making a temporary file, ie

    bitcoind dumpwallet | pgp -e | mail my@walletbackup.org
    

    (vice versa with importwallet)

  4. soundasleep commented at 10:36 PM on May 19, 2013: none

    Is there any ETA on when this may be included? I'm looking for a way to export all of my public addresses, both created normally and those in the keypool, without having to parse wallet.dat manually. It would be fantastic if the dumpwallet command had an argument to suppress output of private keys.

  5. luke-jr commented at 4:55 AM on May 22, 2013: member

    Hopefully 0.9 will be replacing bdb with a new append-only format. It makes sense to use the same format for dumps/imports, IMO.

  6. sipa commented at 5:05 AM on May 22, 2013: member

    @luke-jr I disagree. For a wallet format you mainly want strong consistency guarantees and easy updating. An export/import format is write-once anyway, and is preferably compatible with other clients and transparent.

  7. laanwj commented at 8:20 AM on May 30, 2013: member

    ACK

  8. jgarzik commented at 2:49 PM on May 30, 2013: contributor

    ACK. How does this intersect with #1863 ? Should #1863 be merged first, or this?

  9. sipa commented at 5:13 PM on May 30, 2013: member

    Rebased. I don't think this will conflict (much) with #1863, they will only interact via future functionality building on both (use GetKeyBirthTimes to fill in unknown birthdates, use known birthdates when dumping, ...).

  10. BitcoinPullTester commented at 12:51 PM on June 2, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/313318dc304e63827bf245307da5aeed065627c7 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  11. Add ExtractAffectedKeys to script
    This function finds all keys affected by a particular output script,
    supporting everything ExtractDestinations supports (pay-to-pubkey,
    pay-to-pubkeyhash, multisig) and recurses into subscripts (P2SH).
    acc775c554
  12. Add GetKeyBirthTimes to wallet
    Compute safe lower bounds on the birth times of all wallet keys. For
    pool keys or keys with metadata, the actually stored birth time is
    used. For all others, the birth times are inferred from the wallet
    transactions.
    434e4273b9
  13. Add dumpwallet and importwallet RPCs
    dumpwallet: produce a dump of all keys in a wallet, in a format
    compatible with Bitcoin Wallet for Android and Multibit.
    
    importwallet: import such a dump
    4e534aa9d8
  14. sipa commented at 3:36 PM on June 22, 2013: member

    Rebased after merging #1863/#2781: dumpwallet now dumps creation times (from key metadata), and importwallet restores it.

  15. sipa commented at 3:47 PM on June 22, 2013: member

    @soundasleep I don't think that functionality belongs in this command, as it exports to an already-defined format designed for key backups. I would have no problems with a separate command that just lists all wallet keys, though.

  16. sipa referenced this in commit ee4949794b on Jun 23, 2013
  17. sipa merged this on Jun 23, 2013
  18. sipa closed this on Jun 23, 2013

  19. DrahtBot locked this on Sep 8, 2021

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: 2026-04-19 09:15 UTC

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