We know that: S(Secret-Scalar) x G(Generater Point-Point(X,Y)) = Public Key
In bitcoin, what is the range of that secret can be? What can it be at most and at least? Is there a limit to it like 2^256? If yes what is the logic behind that too?
We know that: S(Secret-Scalar) x G(Generater Point-Point(X,Y)) = Public Key
In bitcoin, what is the range of that secret can be? What can it be at most and at least? Is there a limit to it like 2^256? If yes what is the logic behind that too?
The maximum and minimum private key possible is defined by ECDSA and the curve being used. In ECDSA, the private key is an integer between 1
and n - 1
, where n
is the order of the generator point G
. Bitcoin uses the secp256k1 curve whose generator has an order n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
, which is almost 2^256
.
This means that the minimum value for a private key is 1
and the maximum is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140
. If you use an integer outside of this range, taking the modulo n
of that integer will give you a value that is in the valid range (except for multiples of n
for which the modulo is zero).
n
, taking the modulus withn
will not give you a valid value (but any other integer will work). – Pieter Wuille Aug 20 '20 at 00:07