9

A question was asked on reddit over here which I gave a reply: https://www.reddit.com/r/Bitcoin/comments/3khrvm/how_do_i_use_private_keys_to_receive_bitcoin/

However, luke-jr replies with:

Don't do this. You compromise your wallet's security to import a private key that others know.

without further elaboration. Can someone explain what he's talking about?

2 Answers 2

5

The problem is rather subtle and results from a combination of behaviors.

First of all, it is perfectly safe to use someone else's private key, at least in a standalone sense. Suppose the private key is P and the public address is A, and suppose you want to spend their money. Then you scan the blockchain for transactions outputs that are addressed to A. When you see one, you create a new transaction to some desired output address B (whether you're paying yourself or paying someone else), and sign it with the private key P. No problems here.

The problem starts when we're talking about wallet software. If you "import" a private key P into your wallet, then it gets added to your personal pool of private keys (and their associated public addresses). Whenever you make an outgoing transaction, some amount will almost always be sent back to yourself as change. If the change goes to address A (with associated private key P), then other people who know the private key P can also spend this money. Ultimately this means that if you import someone else's private key, you might lose control of your own money in some circumstances.

As other people have mentioned, the safe way to handle this situation is to "sweep" the coins associated with address A (using private key P) into addresses that you have exclusive control over. In other words, use that private key to pay yourself, but never use the address as an output for change.


As an analogy: Suppose you're in a hall with numbered lockers. It's always possible to deposit money into any locker (only need the address, not the private key). Locker #0 can be opened by both your friend and yourself. Locker #1 and #2 are only openable by you.

If you have cash in lockers #1 and #2, this belongs to you and you alone. Now when you make a transaction, you take cash out of one or both of these lockers, then return some as change. You can also take cash out of locker #0, no problem. But if you return some change into locker #0, then you lose your exclusive control over that cash. So you must only return change to your own lockers #1 and #2, not the shared locker #0.

5

If Eve gives you a private key that contains Bitcoins in exchange for a pile of gold coins, she still has a copy of the private key, and can take the Bitcoins back, leaving her with both the gold coins and the Bitcoins.

Instead, tell Eve to send Bitcoins to your address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.