Bitcoin Forum
May 04, 2024, 08:09:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: feedback on the position of two secp256k1 public keys  (Read 107 times)
shelby0930 (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 4


View Profile
October 16, 2023, 06:00:43 PM
 #1

Hey guys I'm trying to develop a feedback system on the position of two secp256k1 public keys. and based on what I have tried the best feedback is the ETA. for example if the time taken to reach from 100 to 1 is 5 minuets it should be 2.5 minuets for 50 to go to 1 if I get the public keys and it is true if the 100 becomes grater and the ETA changes.

Here is something that I tried but didn't work, not sure why it didn't work. I would greatly appreciate if someone could point me at the right direction if I'm on the wrong side :-)

So here is the steps I followed :

Convert Public Keys to Coordinates: The public keys you've provided are in hexadecimal format. You'll need to convert them to coordinates on the elliptic curve (x, y).

Perform Point Comparison: Compare the x-coordinates of the two public keys to determine if they represent the same point on the secp256k1 elliptic curve. If the x-coordinates are the same, it's highly likely they correspond to the same public key.

Measure Execution Time: To measure the time taken for the comparison, you can use a programming language with libraries for working with elliptic curves like Python or a specialized cryptography library like OpenSSL. You will need to use functions for secp256k1 point comparison and time measurement.

Here's a Python code example using the pycoin library for comparing two secp256k1 public keys and measuring the time it takes:


Code:
import time
from pycoin.ecdsa import generator_secp256k1
from pycoin.encoding import sec_to_public_pair

# Public keys in hexadecimal format
hex_pubkey1 = "02ed3bace23c5e17652e174c835fb72bf53ee306b3406a26890221b4cef7500f88"
hex_pubkey2 = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"

# Convert public keys to coordinates
point1 = sec_to_public_pair(bytes.fromhex(hex_pubkey1))
point2 = sec_to_public_pair(bytes.fromhex(hex_pubkey2))

# Measure execution time
start_time = time.time()

# Compare the x-coordinates of the points
if point1[0] == point2[0]:
    print("The public keys are the same.")
else:
    print("The public keys are different.")

end_time = time.time()
execution_time = end_time - start_time
print(f"Execution time: {execution_time} seconds")

This code converts the public keys to coordinates and then compare their x-coordinates. It will print whether the public keys are the same or different and also display the execution time.
1714853385
Hero Member
*
Offline Offline

Posts: 1714853385

View Profile Personal Message (Offline)

Ignore
1714853385
Reply with quote  #2

1714853385
Report to moderator
No Gods or Kings. Only Bitcoin
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714853385
Hero Member
*
Offline Offline

Posts: 1714853385

View Profile Personal Message (Offline)

Ignore
1714853385
Reply with quote  #2

1714853385
Report to moderator
digaran
Copper Member
Hero Member
*****
Offline Offline

Activity: 1330
Merit: 899

🖤😏


View Profile
October 16, 2023, 08:11:31 PM
Merited by NotATether (1)
 #2

Time is irrelevant in ECC, it's based on implementation, hardware etc, and the time displayed on tools such as kangaroo are estimation based on the range and speed, meaning if for example you have a speed of 1 key per second, a range between 2^65 and 2^66, then it will show you a time around 2^65 seconds, but you could hit your target after 2^20 seconds, the tool doesn't know where the key is, it just shows some values based on input.

That being said, what you are trying to achieve is not the correct answer you were hoping to get. Let me explain:

You either have 2 unknown keys without knowing the distance between them, or you know the distance, so if you know it already then you can simply calculate how many times you have to add or subtract from each of them to reach the other, And if you don't know their distance,You have to start adding 1G at a time and continue to reach the second key. 

Of course there are ways to make it faster, like keep adding 1B Gs at each step to your first key until you reach your second key or +1B of the second key, problem is the size of the key range, but it's possible.

🖤😏
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6728


bitcoincleanup.com / bitmixlist.org


View Profile WWW
October 17, 2023, 12:24:18 PM
 #3

Like @diagran said, the timing for the feedback system is going to be heavily dependent on the CPU clock speed, but not cores since you don't use multiple threads. At the very least, modify the script to get the clock speed of the CPU (OS-dependent) in Hertz or possibly a larger unit, and divide the timing by this amount to get a normalized statistic that can be compared across different hardware.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!