Jun 22, 2026

Elliptic-Curve Generator Order, Private-Key Limits, and the Point at Infinity

A Bitcoin private key begins as a securely generated random integer k. Its public key is the elliptic-curve point:

K = kG

G is a fixed public generator point. The generator's order n tells us how many additions of G complete one full cycle:

nG = π’ͺ

π’ͺ is the identity element, called the point at infinity.

That one equation explains all of these Bitcoin rules:

valid private keys: 1 ≀ k < n
0G = π’ͺ
nG = π’ͺ
(n + 1)G = G
(k + n)G = kG

The details become much easier if we build the idea from small examples before using secp256k1's 256-bit numbers.

The Four Objects to Keep Separate

SymbolMeaningControls
pPrime defining the coordinate fieldArithmetic on point coordinates x and y
GPublic generator pointStarting point for public-key multiplication
nOrder of GScalar cycle and valid private-key range
π’ͺPoint at infinityIdentity element of the point group

The most common confusion is treating p and n as the same limit. They are different numbers with different jobs.

Building Block 1: A Five-Position Clock

Start with ordinary addition modulo 5. Use 1 as the generator:

AdditionsResult modulo 5
0 Γ— 10
1 Γ— 11
2 Γ— 12
3 Γ— 13
4 Γ— 14
5 Γ— 10
6 Γ— 11

After five additions, the sequence returns to zero. The generator 1 therefore has order 5 in this group:

5 Γ— 1 = 0 mod 5

Adding another full cycle does not change the result:

(k + 5) Γ— 1 = k Γ— 1 mod 5

Elliptic-curve scalar multiplication uses the same cycle idea. Replace the number 1 with a point G, replace ordinary modular addition with elliptic-curve point addition, and replace zero with π’ͺ.

Building Block 2: The Identity Point

Every group needs an identity element: a value that changes nothing when added.

For integers under addition, the identity is zero:

a + 0 = a

For elliptic-curve points, the identity is the point at infinity:

P + π’ͺ = P
π’ͺ + P = P

The point at infinity is not a distant affine coordinate and it is not (0, 0). It is a special group value with no ordinary affine x,y coordinates.

RepresentationCommon encoding of π’ͺ
Affine teaching codenull, None, or a dedicated identity object
Projective/Jacobian coordinatesA representation with Z = 0
Serialized public keysNormally rejected; infinity is not a valid Bitcoin public key

Building Block 3: Inverse Points

Every finite point P has an inverse -P:

P + (-P) = π’ͺ

On a short Weierstrass curve over a field modulo p, negation keeps x and reflects y:

P  = (x, y)
-P = (x, -y mod p)

Geometrically, the points are vertical reflections of one another. When a point-addition line is vertical, the sum is defined as π’ͺ.

If a curve contains a point with y = 0, that point equals its own inverse, so P + P = π’ͺ. Such a point has order 2. Bitcoin's selected secp256k1 subgroup has prime order and cofactor 1, so it contains no non-identity order-2 point.

Building Block 4: A Small Elliptic-Curve Cycle

Use the toy curve:

yΒ² = xΒ³ + 7 mod 223
G = (47, 71)

This G has order 21. A few multiples show the complete boundary behavior:

ScalarPoint
0Gπ’ͺ
1G(47, 71)
2G(36, 111)
3G(15, 137)
19G(36, 112) = -(2G)
20G(47, 152) = -G
21Gπ’ͺ
22G(47, 71) = G

Notice the boundary:

(n - 1)G = -G
nG       = π’ͺ
(n + 1)G = G

This toy order is composite, which makes it good for visual teaching but different from secp256k1. The secp256k1 generator has a very large prime order.

Interactive building blocks

Watch an order create a cycle and the point at infinity.

Start with a five-position clock, then use a real toy elliptic curve, and finally test the boundary values around secp256k1's order.

Building block 1

A finite group behaves like a clock

Repeatedly add 1 modulo 5. After 5additions, the value returns to the identity 0.

0
1
2
3
4
Repeated addition7 Γ— 1
Reduce by the order7 mod 5 = 2
Cycle law5 Γ— 1 = 0 mod 5
Building block 2

Replace the clock value with an elliptic-curve point

This exact toy curve is yΒ² = xΒ³ + 7 mod 223. Its selected generator G = (47, 71) has order n = 21.

π’ͺ1234567891011121314151617181920k mod n20
Scalar reduction20 mod 21 = 20
Result kG(47, 152)
Order law21G = π’ͺ
Repeat law(20 + 21)G = 20G
Building block 3

The point at infinity is the identity, not a coordinate

A point and its vertical reflection cancel. On this curve,-(x, y) = (x, 223 - y) modulo 223.

Identity lawP + π’ͺ = P

Adding the identity changes nothing.

Inverse lawP + (-P) = π’ͺ

Vertical opposites cancel.

Zero scalar0G = π’ͺ

Adding no copies of G gives the identity.

Selected P = kG(47, 152)
Inverse -P(47, 71)
P + (-P)π’ͺ (point at infinity)
Importantπ’ͺ is not (0, 0) and has no affine x,y coordinates
Building block 4

Apply the same cycle rules to secp256k1

Select boundary scalars. Public-key multiplication depends on the scalar modulo n, while a valid private key must be the unreduced integer from 1 through n - 1.

Chosen integer k115792089237316195423570985008687907852837564279074904382605163141518161494337
k mod n0
Public resultπ’ͺ (point at infinity)
Valid private key?No
Cycle rule(k + n)G = kG

What β€œOrder of G” Means

The order of G is the smallest positive integer n for which:

nG = π’ͺ

β€œSmallest” matters. If 21G = π’ͺ, then 42G, 63G, and every other multiple of 21 also equal π’ͺ. The order is still 21 because that is the first positive return to the identity.

The points generated by G form a cyclic subgroup:

<G> = {π’ͺ, G, 2G, 3G, ..., (n - 1)G}

Every scalar is interpreted modulo n during multiplication:

kG = (k mod n)G

Therefore:

(k + n)G
= kG + nG
= kG + π’ͺ
= kG

The repetition is a normal property of every finite cyclic group. It is not a defect in elliptic-curve cryptography.

The Actual secp256k1 Constants

Bitcoin uses the curve:

yΒ² = xΒ³ + 7 mod p

Its field prime is:

p = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F

In base 10:

p = 115792089237316195423570985008687907853269984665640564039457584007908834671663

The standard generator has coordinates:

Gx = 79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
Gy = 483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8

Its order is:

n = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

In base 10:

n = 115792089237316195423570985008687907852837564279074904382605163141518161494337

These values are close, but not equal:

p - n = 432420386565659656852420866390673177326

p Controls Coordinates

Point coordinates live in the finite field F_p. Curve equations, slopes, inverses, additions, and doublings reduce coordinate values modulo p:

x coordinate arithmetic mod p
y coordinate arithmetic mod p

That is why a negated point is written:

-(x, y) = (x, p - y) mod p

n Controls Scalars

Private keys and signature scalars operate in the scalar field modulo n:

scalar arithmetic mod n
public-key cycle length n
valid private key 1 ≀ k < n

So n, not p, is the private-key upper limit.

Why Zero and n Are Invalid Private Keys

The public key for private scalar k is K = kG.

If k = 0 or k = n, the public result is infinity:

0G = π’ͺ
nG = π’ͺ

Infinity is not a valid ordinary public key, so neither scalar is a valid Bitcoin private key. The valid range is exactly:

1, 2, 3, ..., n - 1

Values larger than n can produce familiar group points after reduction, but they are not accepted as canonical private keys:

Input integerReduced scalarPublic resultValid private key input?
00π’ͺNo
11GYes
n - 1n - 1-GYes
n0π’ͺNo
n + 11GNo
2n + 777GNo

The last two rows demonstrate group equivalence, not valid private-key serialization.

Why the secp256k1 Generator Covers the Whole Group

The cofactor is:

h = number of curve points / generator order

For secp256k1, h = 1. Therefore the curve group has n points including π’ͺ, and the standard generator spans the full group.

Some other curves use a subgroup whose order is smaller than the full curve group. Protocols on those curves must handle subgroup membership carefully.

Even with cofactor 1, implementations must validate that an imported public key:

  1. has a valid SEC encoding;
  2. has coordinates in the field;
  3. satisfies the curve equation;
  4. is not the point at infinity.

How a Secure Random Number Becomes a Private Key

Conceptually, key generation chooses uniformly from:

{1, 2, ..., n - 1}

A robust implementation generally uses rejection sampling:

repeat:
    candidate = 32 bytes from a cryptographically secure random generator
    k = integer(candidate)
until 1 ≀ k < n

Do not use Math.random(), timestamps, human-chosen phrases, short PINs, or predictable counters. The private key is secure only when an attacker cannot guess the original scalar.

Because n is very close to 2^256, almost every uniformly random 256-bit candidate is valid. Rejection sampling still matters because it produces the exact required distribution without modulo bias.

Hierarchical deterministic wallets generate many private keys from one seed. Those child keys are deterministic, but their security still begins with sufficient entropy in the original wallet seed.

What Actually Hides the Random Scalar

Given k, calculating K = kG is efficient. Given only G and K, recovering k is the elliptic-curve discrete logarithm problem.

The public key does not encrypt the private scalar. Scalar multiplication is computationally one-way with known classical algorithms:

easy: k and G -> K
hard: G and K -> k

The group has roughly 2^256 scalar positions. Generic attacks such as Pollard's rho take on the order of the square root of the group size, giving approximately 2^128 work.

The order being public does not reveal the private key. It defines the public cycle in which the hard discrete-log problem lives.

Public Keys, Hashes, and Addresses Come Later

Generator order belongs to the private-key-to-public-key step:

private scalar k
    -> scalar multiplication K = kG
    -> serialize public point K
    -> hash serialized public key
    -> encode a Bitcoin address

SHA-256, RIPEMD-160, Base58Check, Bech32, and network prefixes do not change the order of G. They operate after the public point has already been derived.

Open the Bitcoin key and address explorer

Common Mistakes

MistakeCorrection
β€œn is the largest x or y coordinate.”Coordinates are bounded by p; scalars cycle modulo n.
β€œThe point at infinity is (0, 0).”π’ͺ is a special identity with no affine coordinates.
β€œnG = 0 means the point has zero coordinates.”It means the group result is the identity π’ͺ.
β€œn + 1 is another encoding of private key 1.”It gives the same group point after reduction but is outside the valid private-key range.
β€œScalar multiplication multiplies x and y by k.”It means repeated point addition, implemented efficiently with double-and-add methods.
β€œAny random-looking number is a safe key.”It must come from a cryptographically secure, uniformly distributed source.
β€œA public-key hash controls the private-key limit.”Generator order n determines the range before hashing.

A Compact Mental Model

p: coordinate arithmetic wraps
n: scalar multiplication wraps
G: public starting point
π’ͺ: identity point
k: secret scalar, valid when 1 ≀ k < n
K: public point kG

Then the boundary cases become predictable:

0G       = π’ͺ
1G       = G
(n - 1)G = -G
nG       = π’ͺ
(n + 1)G = G
(k + n)G = kG

That is what the generator's order means: it is the length of the point cycle, the modulus of scalar multiplication, and the reason Bitcoin private keys stop at n - 1.


Thanks for reading! If you want to see future content, you can follow me on Twitter or get connected over at LinkedIn.


Support My Content

If you find my content helpful, consider supporting a humanitarian cause (building homes for elderly people in rural Terai region of Nepal) that I am planning with your donation:

Ethereum (ETH)

0xB62409A5B227D2aE7D8C66fdaA5EEf4eB4E37959

Thank you for your support!