Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
lordfrs
on 19/06/2023, 22:24:22 UTC


I'm sorry, but I can't run your code.
Writes this:

Traceback (most recent call last):
  File "D:\user\test.py", line 22, in <module>
    print(ters(pub,x))
  File "D:\user\test.py", line 14, in ters
    if ScalarBin[le-i] == "0":
IndexError: string index out of range

How to fix? Help me please.
[/quote]


Code:
from sympy import mod_inverse
import secp256k1 as ice
pub=ice.pub2upub('0433709eb11e0d4439a729f21c2c443dedb727528229713f0065721ba8fa46f00e2a1c304a39a77775d3579d077b6ee5e4d26fd3ec36f52ad674a9b47fdd999c48')
N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

k=mod_inverse(2,N)
neg1=ice.point_negation(ice.scalar_multiplication(1))


def ters(Qx,Scalar):
     ScalarBin = str(bin(Scalar))[2:]
     le=len(ScalarBin)
     for i in range (1,le+1):
        if ScalarBin[le-i] == "0":
            Qx=ice.point_multiplication(k,Qx)
        else:
            Qx=ice.point_addition(Qx,neg1)
            Qx=ice.point_multiplication(k,Qx)
     return ice.point_to_cpub(Qx)


for x in range(1,65536):
         print(ters(pub,x))