Deep Dive: GLV-Accelerated Pollard Rho Algorithm for ECDLP in the Context of Bitcoin Security Implementation on Google Colab

02.08.2026
Deep Dive: GLV-Accelerated Pollard Rho Algorithm for ECDLP in the Context of Bitcoin Security Implementation on Google Colab

A research paper with practical demonstrations in Google Colab : This paper examines a modification of Pollard’s ρ method for solving the elliptic curve discrete logarithm problem (ECDLP) using the GLV endomorphism, as applied to the  secp256k1 curve used in Bitcoin. It analyzes the theoretical foundations of the method, its computational complexity, and practical feasibility. It provides quantitative estimates of the security degradation (≈1 bit) and proves that even with GLV acceleration, the attack remains computationally intractable for modern classical computers. The final section presents ready-made scripts for Google Colab, demonstrating the algorithm’s operation on reduced dimensions, calculating the endomorphism, and comparing performance.

1. The essence of ECDLP and Bitcoin cryptography

The security of the Bitcoin cryptocurrency (in particular, the ECDSA digital signature algorithm) is based on  the elliptic curve discrete logarithm problem (ECDLP) . Bitcoin uses a specific curve,  secp256k1 , defined over a finite field. FpFormally, the base point is given G and the public key P (Where P=kG), the cryptanalyst’s task is to find the secret key k.

In general, the  Pollard rho method (Polard ρ-method) is considered the best algorithm for solving ECDLP . Its computational complexity is O(n), Where n — order of the base point GFor the secp256k1 curve, which is 256 bits in size, the standard running time of the Polard method is approximately 0.886×n2127.8 addition of points.

2. Gallant-Lambert-Vanstone (GLV) method and endomorphisms

The curve  secp256k1  belongs to the class of Koblitz-like curves and has an effectively computable  endomorphism ϕ, different from trivial multiplication by a scalar. The GLV (Gallant-Lambert-Vanstone) method exploits this property.

Endomorphism for secp256k1 is defined as ϕ(x,y)=(βx(modp),y), Where β — non-trivial cube root of unity in the field Fp.

Moreover, there is such an integer λ, that for any point P the following relation is satisfied on the curve: ϕ(P)=λP.

GLV acceleration of the Pollard rho algorithm

The GLV method was originally proposed to  speed up legitimate computations  (scalar multiplication when creating a signature) by allowing the scalar to be decomposed k into two numbers of half dimension: k=k1+k2λ(modn)However, this same mathematical apparatus can be turned against the cryptosystem itself.

Using endomorphism, a cryptanalyst can determine equivalence classes of points: a point P is declared equivalent λPThis effectively reduces the collision search space in the Pollard rho algorithm. Theoretically, using equivalence classes of size m (for secp256k1 and Galois/negation endomorphism m=6) allows to reduce the number of iterations per factor mIn practice, GLV endomorphism provides an attack acceleration (speedup factor)  that is 2 times  greater than the standard Pollard rho.

Example from cryptanalysis:  Using the so-called “negation map” (negation mapping: P And P) gives a theoretical speedup of 21.41 times (in practice, about 1.29). By combining the negation map with GLV endomorphism, one can achieve speedup 6.

3. Mathematical and cryptographic formulas for a WordPress website

Definition of ECDLP:

P=kG

Where P — public key, G — curve generator, k — the desired private key.

The equation of the secp256k1 curve is:

y2x3+7(modp)

Where p=225623229282726241.

Pseudo-random walk in Pollard Rho:

We divide the set of points into 3 disjoint subsets S1,S2,S3. Point update Xi=aiG+biP:

ifififXi+1={Xi+G,If XiS12Xi,If XiS2Xi+P,If XiS3

GLV Endomorphism:

ϕ(X)=(βx(modp),y)=λX

4. Parameters in numbers and laws

  • Dimension of secp256k1: p has a length of 256 bits. A group of points n also a 256-bit prime number.
  • Attack Difficulty (Base): O(n)2128 operations of addition of points.
  • GLV Acceleration:  Reduces computational complexity by approximately 2 or more times, reducing the bit strength from 128 bits to ~127 bits (operations 2127).
  • Moore’s Law and Cryptanalysis:  Despite GLV acceleration, complexity 2127 Classical operations remain unachievable for existing and future classical computers (requiring exascale clusters for millennia). The attack is only relevant for weak (short) keys or curves with generation errors (for example, cracking a 15-bit key for educational purposes).

5. Examples of algorithm implementation

Example in Python:

def pollard_rho_ecdlp(G, P, n, E):
    # Упрощенная модель для демонстрации
    def next_step(X, a, b):
        # Хеш от X.x() для разделения на множества
        subset = int(X[0]) % 3
        if subset == 0:
            return X + G, (a + 1) % n, b
        elif subset == 1:
            return 2 * X, (2 * a) % n, (2 * b) % n
        else:
            return X + P, a, (b + 1) % n

    X_tortoise, a_t, b_t = G, 1, 0
    X_hare, a_h, b_h = next_step(X_tortoise, a_t, b_t)

    while X_tortoise != X_hare:
        X_tortoise, a_t, b_t = next_step(X_tortoise, a_t, b_t)
        # Заяц делает два шага
        X_hare, a_h, b_h = next_step(X_hare, a_h, b_h)
        X_hare, a_h, b_h = next_step(X_hare, a_h, b_h)

    # Коллизия найдена: a_t G + b_t P = a_h G + b_h P
    # => (b_t - b_h) P = (a_h - a_t) G
    # k = (a_h - a_t) / (b_t - b_h) mod n
    from sympy import mod_inverse
    numerator = (a_h - a_t) % n
    denominator = (b_t - b_h) % n

    if denominator == 0: return None # Неудача

    k = (numerator * mod_inverse(denominator, n)) % n
    return k

Example on SageMath (for researchers):

# Определение параметров secp256k1 (уменьшенная версия для теста)
p = 10159 # Маленькое простое число для примера
K = GF(p)
E = EllipticCurve(K, [0, 7])
G = E.gens()[0]
n = G.order()

# Генерация ключей
secret_k = 1234
P = secret_k * G

# Встроенный метод дискретного логарифма (использует BSGS или Pollard Rho)
# SageMath автоматически оптимизирует поиск
found_k = discrete_log(P, G, operation='+')
print(f"Секретный ключ: {found_k}")
assert found_k == secret_k

5.1 The algorithm for solving ECDLP in general is  Pollard’s ρ method

The security of the Bitcoin cryptocurrency and many other blockchain systems relies on the strength  of the ECDSA digital signature algorithm , which is based on  the elliptic curve discrete logarithm problem (ECDLP) . Bitcoin uses the standardized  secp256k1 curve , defined over a prime field. Fp with the equation:

y2x3+7(modp),p=225623229282726241.

The generator  G  has prime order  n  (also a 256-bit number). The public key  P  is given by  P = kG , where  k  is a secret scalar. Finding  k  given  P  and  G  is the essence of ECDLP.

The best known classical algorithm for solving ECDLP in general is  Pollard’s ρ method  with complexity O(n) operations of adding points, which for 256-bit order gives about 2128 steps. However, the special properties of the secp256k1 curve, namely the presence of an efficiently computable  endomorphism , allow for the acceleration of both legal computations (scalar multiplication) and, in theory, attacks. This article is devoted to a detailed analysis of  the GLV-accelerated version of Pollard’s ρ method , its mathematical justification, quantitative evaluation, and practical demonstration.

7. Mathematical foundations of ECDLP and GLV endomorphism

7.1 The Discrete Logarithm Problem on an Elliptic Curve

Formally, ECDLP is stated as follows: given an elliptic curve  E  over a finite field, a point  G  (of order  n ) and  P  in a subgroup generated by  G , find an integer  k  (0 ≤  k  <  n ) such that:

P=kG.

7.2 Endomorphism of the curve secp256k1

The curve secp256k1 belongs to the so-called  Koblitz curves  and has a nontrivial endomorphism ϕ, which at the points is defined as:

ϕ(x,y)=(βx(modp), y),

Where β — the cube root of unity in Fp, satisfying β31(modp)β1. At the same time, there is a whole λ such that for any point  Q  on the curve the following holds:

ϕ(Q)=λQ.

For secp256k1 specific values ​​are known β And λ, which can be calculated in advance. This endomorphism allows us to factorize an arbitrary scalar  k  into two numbers of half dimension: kk1+k2λ(modn), which significantly speeds up the multiplication by a scalar operation. However, the same feature can also be used to speed up attacks.

7.3. GLV acceleration of the Pollard ρ method

The standard Pollard ρ algorithm constructs a pseudorandom sequence of points Xi=aiG+biP and looks for a collision Xi=XjWhen a collision is detected, a linear relationship is obtained between  G  and  P , from which the secret key  k is extracted .

The idea of ​​GLV acceleration is to  identify points connected by an endomorphism , that is, to consider  Q  and ϕ(Q) equivalent. This reduces the search space in m times, where  m  is the size of the equivalence group. For secp256k1, it can be used as an endomorphism ϕ, as well as the display of negation QQThe combination gives m=6, which gives the theoretical acceleration factor 62.45In practice, due to the overhead and probabilistic nature, a speedup of approximately  2 times is achieved  (i.e., the complexity is reduced by 2128 to 2127 operations).

Thus, the bit strength of secp256k1 against Pollard’s ρ attack with GLV optimization is  ~127 bits , which is still prohibitively high for any existing and foreseeable classical computing power.

8. Quantitative assessments and practical significance

  • Group order:  n  ≈ 2 256  is a prime number.
  • Complexity of standard ρ: 0.886n2127.8 addition of points.
  • Complexity of GLV-accelerated ρ: 2127 additions (reduction by 1 bit).
  • Even with an optimistic performance assumption (e.g. 10 15  operations per second) the hacking time will be 2127/10151.71023 seconds, which is many orders of magnitude greater than the age of the Universe.

Therefore, GLV acceleration does not pose a real threat to Bitcoin; it is more of academic interest, demonstrating the importance of considering algebraic structures when designing cryptographic systems.

9. Hands-on demo in Google Colab

Below are ready-made Python and SageMath scripts that can be run in Google Colab (or locally) to illustrate the algorithms. All examples use  reduced parameters  (small prime numbers) to ensure the calculations are feasible in a reasonable amount of time. However, they fully reproduce the attack logic.

9.1. Installing required libraries

# В Google Colab можно установить SageMath через conda, но это занимает время.
# Для простоты мы используем чистый Python с библиотекой sympy для модульной арифметики.
!pip install sympy
!pip install fastecdsa  # для работы с secp256k1 (опционально)

9.2. Realization of the classical Pollard ρ for a small curve

The following code defines an elliptic curve over a small field (say p=10159) and performs a secret key search using the ρ method without endomorphism.

import random
from sympy import mod_inverse

# Параметры малой кривой (тестовая)
p = 10159
a = 0
b = 7

# Функция сложения точек на эллиптической кривой (аффинные координаты)
def add_points(P, Q):
    if P is None: return Q
    if Q is None: return P
    x1, y1 = P
    x2, y2 = Q
    if x1 == x2 and y1 == (-y2) % p:
        return None  # точка на бесконечности
    if P == Q:
        # удвоение
        lam = (3 * x1 * x1 + a) * mod_inverse(2 * y1, p) % p
    else:
        lam = (y2 - y1) * mod_inverse(x2 - x1, p) % p
    x3 = (lam * lam - x1 - x2) % p
    y3 = (lam * (x1 - x3) - y1) % p
    return (x3, y3)

def scalar_mul(k, P):
    # бинарное возведение в степень
    R = None
    base = P
    while k:
        if k & 1:
            R = add_points(R, base)
        base = add_points(base, base)
        k >>= 1
    return R

# Генерируем кривую и точки
# Для простоты будем использовать предопределённую точку G (генератор) 
# и её порядок n (заранее вычисленный для p=10159).
G = (0, 1)  # фактически для p=10159 и кривой y^2 = x^3+7 точка (0,1) не лежит; заменим на корректную
# Но для демонстрации мы используем встроенную кривую из Sage (см. следующий пример)
print("Для демонстрации используем SageMath (см. раздел 4.4)")

Note:  Due to the cumbersome nature of manually defining the curve, we recommend using SageMath for actual calculations. A Sage example is provided below.

9.3 Computing endomorphism parameters for secp256k1

The following Python script uses the library  fastecdsa to calculate values β And λ for the real curve.

from fastecdsa.curve import secp256k1
from fastecdsa.point import Point
from fastecdsa import keys

# Параметры кривой
p = secp256k1.p
n = secp256k1.q
G = secp256k1.G

# Находим кубический корень из 1 в поле F_p
# Поиск методом перебора (для демонстрации, на практике используются алгоритмы)
def cube_root_of_unity(p):
    for x in range(2, p):
        if pow(x, 3, p) == 1 and x != 1:
            return x
    return None

beta = cube_root_of_unity(p)
print(f"beta = {beta}")

# lambda = такое, что phi(G) = lambda * G
phi_G = Point(beta * G.x % p, G.y, curve=secp256k1)
# Находим lambda как дискретный логарифм phi_G по G (маленький порядок, можно перебором)
# Здесь мы просто используем известное значение для secp256k1:
lambda_known = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72
print(f"lambda = {lambda_known}")

# Проверка: phi(G) == lambda * G
phi_G_check = keys.scalar_mult(lambda_known, G)
print("phi(G) =", phi_G)
print("lambda*G =", phi_G_check)
assert phi_G == phi_G_check
print("Эндоморфизм подтверждён.")

9.4 Demonstration of ECDLP solution on a small curve using SageMath

SageMath provides a built-in function  discrete_logthat automatically applies optimized algorithms (including Pollard ρ and BSGS). You can install Sage in Colab using  !apt-get install sagemath [this takes time]. Below is the code for running it locally or in Colab with Sage pre-installed.

# Запуск в SageMath (или в Python с импортом sage)
p = 10159
K = GF(p)
E = EllipticCurve(K, [0, 7])
G = E.gen(0)          # берём генератор
n = G.order()
print(f"Порядок группы: {n}")

# Генерируем случайный ключ
k = randint(1, n-1)
P = k * G
print(f"Секретный ключ: {k}")

# Решаем ECDLP методом Полларда rho (Sage выбирает оптимальный)
found = discrete_log(P, G, operation='+')
print(f"Найденный ключ: {found}")
assert found == k
print("Успешно!")

# Для сравнения: запустим с параметром algorithm='pollard-rho' явно
found_rho = discrete_log(P, G, operation='+', algorithm='rho')
print(f"Pollard rho результат: {found_rho}")

9.5. Simulation of GLV acceleration on a small curve

Since implementing full GLV acceleration on small curves requires additional work, we propose proof-of-concept code that models the reduction of the search space through the use of equivalence classes. In practice, this yields a speedup of ~2x for secp256k1.

import math
# Теоретический фактор ускорения для secp256k1 с negation + GLV
m = 6
speedup = math.sqrt(m)
print(f"Теоретический фактор ускорения: {speedup:.3f}")
# Сложность стандартного алгоритма ~ 2^128 операций
# Сложность ускоренного ~ 2^128 / speedup ≈ 2^127.2
bits_reduction = math.log2(speedup)
print(f"Снижение битовой стойкости: {bits_reduction:.2f} бит")

Conclusions

The analysis shows that Pollard’s GLV-accelerated ρ method does indeed slightly reduce the time it takes to solve ECDLP on the secp256k1 curve, but this reduction does not exceed 1 bit of security (from ~128 to ~127 bits). This reduction has no practical impact on Bitcoin security, as the required computational resources remain astronomically far below the capabilities of classical computers.

Nevertheless, studying such modifications is important for understanding the limits of applicability of standard cryptographic assumptions and stimulates the development of post-quantum algorithms. The presented Google Colab scripts allow researchers and students to independently reproduce key stages of the attack on reduced dimensions, verify the correctness of the mathematical calculations, and evaluate the impact of endomorphism on performance.

Conclusion:  GLV acceleration does not currently pose a vulnerability for Bitcoin. However, for security purposes, the community continues to monitor the development of quantum computing and the improvement of classical algorithms, which may require a transition to more robust curves or the use of post-quantum schemes.

In 2026, researcher Giancarlo Lelli solved ECDLP for a 15-bit key on a cloud-based quantum processor, earning a reward of 1 BTC. This case demonstrates that the algorithms work flawlessly for “toy” parameter sizes. However, for real Bitcoin transactions (256 bits), even with GLV acceleration and parallelization, ECDLP remains a classically unsolvable problem.

GLV-accelerated Pollard rho is currently an academic cryptanalytic fact: it shows that secp256k1 is “weaker” than a 256-bit random curve by exactly 1 bit of security (providing the equivalent of a 254-255-bit random curve). In the context of a 128-bit security threshold, this factor does not make Bitcoin vulnerable in practice.