Litecoin-Java / bitcoin-wallet

Bitcoin Wallet app for your Android device. Standalone Bitcoin node, no centralized backend required.
https://play.google.com/store/apps/details?id=de.schildbach.wallet
31 stars 42 forks source link

Scanning private keys doesn't work yet #11

Open hank opened 10 years ago

hank commented 10 years ago

I'd like to be able to scan private keys and put them in the wallet from sites like liteaddress.

hank commented 10 years ago
else if (PATTERN_PRIVATE_KEY.matcher(input).matches())
{
    try
    {
        final ECKey key = new DumpedPrivateKey(Constants.NETWORK_PARAMETERS, input).getKey();
        final Address address = new Address(Constants.NETWORK_PARAMETERS, key.getPubKeyHash());

        bitcoinRequest(address, null, null, null);
    }
    // ...
}

Current behavior is to just derive the address from the private key and start a new sendrequest. This is rather useless since you'd just scan the QR of the address to do that, not the private key. Scanning private either implies an import of the address to the wallet or a sweep. We should probably ask which they want to do, and then execute it. Sweeping might require a fair bit of code because we need to:

This should probably be done in a rather automated way. Importing the keys would be easier, and I think is a more realistic near-term goal. Next release seems appropriate for that, and we can revisit sweeps.

hank commented 10 years ago

@wtogami and I agree that this should be tabled for now. It looks like SendCoinsFragment and Activity could be easily modified to take an ephemeral wallet object as a parameter to an intent to make this work. Then an arbitrary send could happen. The main issue is the blockchain rescan required to derive the balance. More thought needs to be put into it.

hank commented 10 years ago

I just had an idea that applies to this ticket as well as #21 - what if paper wallets were HD wallets. For instance:

By chaining in this way, the sync time is simply the time between now and the last transaction, which isn't all that bad really - it doesn't get perpetually longer like it does with traditional paper wallets. Also, by encrypting the seeds with a passphrase, the paper wallets themselves could be secured.