1

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?

Efe
  • 407
  • 2
  • 16

1 Answers1

4

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).

Murch
  • 75,206
  • 34
  • 186
  • 622
Ava Chow
  • 70,382
  • 5
  • 81
  • 161
  • 1
    Pedantic nit: if you use an integer that is a multiple of n, taking the modulus with n will not give you a valid value (but any other integer will work). – Pieter Wuille Aug 20 '20 at 00:07