We know that bitcoin adresses are generated with a 256 bit number(the amount of multiplication that is used on secp256k1 curve). So there can be 2^256 addresses at most where all the bitcoin sits on. Can we say that if one can somehow get all the bitcoin addresses(I know it is not doable), you get all the bitcoins that is generated/mined ?
1 Answer
First of all, since a single key can be represented by tons of different address types, let's assume what you meant to ask is about private keys. As @dave_thompson_085 points out, most addresses are actually limited to a 2^160 space by a RIPEMD hash. So that number may be closer to the actual amount of keys you'd need to sweep "all" the bitcoin.
But you are basically correct, the security of ECDSA is based on really big, really random numbers that are so big and so random no one will ever generate the same number as you.
A few details though, from my understanding:
The order of the curve is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
So there is a slightly lower number of possible private keys than just 2^256
Also, not all Bitcoin outputs require a single key for spending. There are multisig scripts and more complicated spending policies. Assuming you had "all" the private keys and could look them up in a practical way, I suppose you could assemble multisigs where necessary. But that's not all - plenty of transactions are HTLCs which require the pre-image to a hash in addition to a valid signature to spend.
Another thing is that some Bitcoin addresses really are black holes (burn addresses). If an address represents a point that is not on the secp256k1 curve, then there is literally no private key.
Some Bitcoin may also have been sent to unrecoverable scripts like OP_RETURN or scripts that require finding a hash collision.
-
2Privatekeys are slightly under 2^256, but addresses (for txn types that use them, as you note), are 2^160. Which is still more than can be stored in the universe.dave_thompson_085– dave_thompson_0852020-08-14 08:16:35 +00:00Commented Aug 14, 2020 at 8:16
-