0

I created a paper wallet on coinbase and wanted to import it to coinbase.com. It allowed me to import it by specifying private key only. I was surprised that I didn't have to specify public key as well... is it secure?

I am surely missing here something but the analogy that comes to my mind is ability to log in into someone's gmail account by providing only password and not email. I mean, if that would be possible we could specify "P@ssword" and I'm sure someones has this kind of password to their email, that would let us log in to that account.

Similarily, I could specify some random private key and hope that it's associated with some public address...

Could you please clarify why my reasoning is not correct and why importing bitcoins by specifying private key only is safe?

Thanks!

  • 1
    *Similarily, I could specify some random private key and hope that it's associated with some public address...* Sure, but an attack based on hope isn't particularly useful. I could guess an account and password and hope it's yours. – David Schwartz Nov 12 '14 at 9:50
1

The analogy that you suggest isn't quite accurate because a private/public key pair have a very exact mathematical relation, whereas a username/password have no real relation (except maybe an entry in a database somewhere).

A private key is essentially a 256 bit number. Using this private key, and an Elliptic Curve library that supports the use of the secp256k1 curve, you can deterministically calculate what the associated public key is. Since a bitcoin address is a hash of the public key, all you really need is the private key and you can calculate everything else to be able to see what transactions resulted in the address being credited/debited coins. That's why coinbase only has you give your private key.

  • Thanks for explaination, but I still don't see what stops me from trying random 256bit sentences when importing private keys to my wallet and finally I should be able to find one with some money on it... Is it only considered secure because number of currently used wallets is much smaller than number of valid private keys and thus probability that I will find private key with money on it is relatively small? – Bart Nov 12 '14 at 4:22
  • There are 2^256-1 valid private keys. The system is secure because doing exactly what you described, trying private keys until you get one that has some money on it, would take so long you are pretty much guaranteed to never find it. Read up more on Elliptic Curve Cryptography if you're interested, it's pretty fascinating stuff. – morsecoder Nov 12 '14 at 4:31
  • There are actually better attacks on the system than doing what you described, but even those would still take years even on extremely fast and parallel computers. – morsecoder Nov 12 '14 at 4:32
  • 2
    @Bart: "Relatively small" is a tremendous understatement. – Nate Eldredge Nov 12 '14 at 4:46
  • 3
    @Bart: In other words, there are 115792089237316195423570985008687907853269984665640564039457584007913129639935 possible private keys. If there are a trillion keys with coins in them (actually there are less), you'd need to try about 116 vigintillion keys to find one. If you try a trillion keys per second, it will take you 4 quattuordecillion years, which is 257 decillion times the age of the universe. So it's not going to happen. – Meni Rosenfeld Nov 12 '14 at 8:00
1

The short answer is like many other common encryption systems you can create the public key from the private key (and therefore gain access to the contents) but you cant create the private from the public. Therefore you don't need to input the public key because it can be generated from the private key.

As other comments have said, the chances of you guessing/generating a valid private key are essentially nil.

1

Unlike email accounts and passwords, in Bitcoin no two public keys can share the same private key because the public key is derived from the private key mathematically.

It's true you could generate private keys at random and check their corresponding public addresses for unspent bitcoins. And if you found any, you could spend them since you'd have the private key. If it was at all feasible to find and spend other users' bitcoins this way, the Bitcoin ledger would be useless. So the set of possible keys was made intentionally enormous as to make such random searching infeasible and pointless even if extremely powerful computers were used to perform these searches for centuries.

Here's a great video on this topic:

http://youtu.be/ZloHVKk7DHk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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