bitcoin/bitcoin — pull request #2592 by sipa (2013-04-29 21:33:12+00:00)
Title: Add dumpwallet and importwallet RPC commands

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.