Another interesting post:
there is no risk of collision?
Correct.
I mean 2 person can generate the same btc address
And all the molecules of air can collect in the corner of the room causing everyone in the room to suffocate, but the probability is so low that we consider it impossible.
Even if risks are low, what will happen in this case?
If the users are using faulty software that does not properly generate a random number (so that multiple users end up generating the same number), then all users that generate the same number will have the ability to spend the bitcoins that are sent to the address. Whoever spends an output and gets confirmed first gets to be the "real" transaction for that output, and any transaction created by any of the others to spend the same output are rejected.
Oh, I suddenly realized that, there are 2^256 private keys available in the universe, while there is only 2^160 bitcoin addresses available. That is, there are about 2^96 (about 8*10^30) private keys pointing to a same bitcoin address?! Is that true? Then will them collide?
See
So there are 2^160 public keys but only 2^96 private keys? Ho does that add up?
Are there private keys than unlock more than one public key?
There are just under 2^256 private keys, just under 2^256 public keys, and 2^160 addresses. There are some addresses that have more than one corresponding public key and thus more than one corresponding private key.
The confusion comes in when two distinct concepts have the same name.
"private key" can mean either the raw 256 bits used to calculate the signature, or it can mean the encoded format that bitcoin stores.
Public key can also mean either the (x,y) point used to verify signatures, or it can mean the encoded version that bitcoin uses.
In the raw sense, both private keys are the same, and both public keys refer to the same (x,y) point. In the encoded sense, the compressed private key encoding implies the compressed public key encoding, and ditto for the uncompressed encodings. The addresses are hashed from the encoded forms, so there are two different addresses that technically refer to the exact same keypair.
Since bitcoin deals exclusively with encoded versions, the two formats are totally distinct different things. If you generate your own raw private key, you can create both encodings and calculate both addresses. Import the two encodings into different wallets, and neither one will have any idea about transactions sent to the other. Even though they could calculate signatures for both, they don't know to look for them.
Difference between public keys and addresses:
Your public key is your BTC address. You can go to receive then copy an address that you want to receive at/use.
This is not true.
A public key is a 256 bit number if compressed (or a 256 bit x coordinate and 256 bit y coordinate of a point if not compressed) calculated from the private key using ECDSA with the Secp256k1 curve.
A BTC address is a hash of a public key with a version number prepended, a checksum appended, and then Base58Check encoded.