can anyone kindly provide an example of public key subtraction code in python ?
Try this one.
import secp256k1 as ice
target_public_key = "032f3342152eff6aca5e7314db6d3301a28d6a90ddcfd189f96babadc2a053d392"
target = ice.pub2upub(target_public_key)
num = 1000 # number of times.
subtract = 1 # amount to subtract each time.
# Define the new generator point coordinates
new_generator = (new_x_coordinate, new_y_coordinate) # Replace with actual coordinates
sustract_pub_new = ice.scalar_multiplication(subtract, new_generator)
res = ice.point_loop_subtraction(num, target, subtract_pub_new)
for t in range(num + 1):
h = (res[t * 65:t * 65 + 65]).hex()
hc = ice.to_cpub(h)
data = open("data-base.txt", "a")
data.write(str(hc) + "\n")
data.close()
This will subtract 1G 1000 times from target, meaning if target is 2000, it will give you 1999, 1998, 1997... etc.