Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: whanau on April 20, 2023, 02:33:24 AM



Title: How to find the adjacent public key?
Post by: whanau on April 20, 2023, 02:33:24 AM
There was a post a few days ago which has since disappeared, where someone said 'give me a random public key and I'll tell you the one adjacent to it.

So,  I generated a random private key, and posted the public key (only) on the forum.

I got a reply which I briefly checked (as it was late) and sure enough the returned public key was my private +1

Neither private keys were divulged but of course as I knew what I had generated I could confirm it was correct.

How was it done??


Title: Re: How to find the adjacent public key?
Post by: pooya87 on April 20, 2023, 03:53:31 AM
Each public key on an elliptic curve is a point that is the result of multiplication of k and G (the generator point) and multiplication can be defined as how many times you add G to itself. In other words k*G is adding G to itself k times and (k+1)*G is adding G to itself (k+1) times or if you already have added G to itself k times (the result of k*G) you just have to add one more G to it.

To put simply if you want to find the "adjacent" public key you just compute public key + G!

It is a pointless thing to do though. It is like telling you to give them a random number so that they can tell you the adjacent numbers, you say 564132127 and they tell you the next number is 564132128 :D


Title: Re: How to find the adjacent public key?
Post by: whanau on April 20, 2023, 04:34:28 AM
Each public key on an elliptic curve is a point that is the result of multiplication of k and G (the generator point) and multiplication can be defined as how many times you add G to itself. In other words k*G is adding G to itself k times and (k+1)*G is adding G to itself (k+1) times or if you already have added G to itself k times (the result of k*G) you just have to add one more G to it.

To put simply if you want to find the "adjacent" public key you just compute public key + G!

It is a pointless thing to do though. It is like telling you to give them a random number so that they can tell you the adjacent numbers, you say 564132127 and they tell you the next number is 564132128 :D
Thank you.
I thought it was probably 'smoke & mirrors ' but it was still quite impressive to see. I'll have a go at coding it in python..


Title: Re: How to find the adjacent public key?
Post by: ABCbits on April 23, 2023, 11:52:34 AM
3. To identify the neighboring public key, change the private key by adding or removing a certain value. The "tweak" value is usually a random 256-bit number.

Stop spreading wrong technical information, it's impossible to perform mapping public and private key. And when you say "random 256-bit number", it means brute-force until you find "similar" private/public key pair.


Title: Re: How to find the adjacent public key?
Post by: whanau on May 04, 2023, 06:19:05 PM
Pooya87 is correct. I have tested it.
Generating the adjacent public key takes a fraction of a second.
The private key however, takes MUCH longer as we all know.

Each public key on an elliptic curve is a point that is the result of multiplication of k and G (the generator point) and multiplication can be defined as how many times you add G to itself. In other words k*G is adding G to itself k times and (k+1)*G is adding G to itself (k+1) times or if you already have added G to itself k times (the result of k*G) you just have to add one more G to it.

To put simply if you want to find the "adjacent" public key you just compute public key + G!

It is a pointless thing to do though. It is like telling you to give them a random number so that they can tell you the adjacent numbers, you say 564132127 and they tell you the next number is 564132128 :D


Title: Re: How to find the adjacent public key?
Post by: DannyHamilton on May 05, 2023, 09:28:44 PM
Generating the adjacent public key takes a fraction of a second.

This is how vanity address generation services work.


  • The person that wants a vanity address generates a private and public key and supplies ONLY the PUBLIC key to the service.
  • The service doesn't know the private key, but they can generate random public keys (and therefore addresses) that are X steps away from the provided public key.
  • The service generates MANY, MANY addresses until they stumble on one that matches the vanity request.
  • The service provides the size of the step away from the originally provided public key.
  • The person that wants a vanity address can add this step size to the private key that they originally generated and they now have the vanity address private key without the service ever knowing what either the original private key, or this new vanity address private key is.