Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Tanagi on September 10, 2021, 10:08:41 AM



Title: Vanitygen search
Post by: Tanagi on September 10, 2021, 10:08:41 AM
Hey guys,

Looking to see if anyone can tell me how to modify the Vanitygen code so that it will start searching at the same point every time and not jump around to another random search position.

Thanks in advance :o)


Title: Re: Vanitygen search
Post by: a.a on September 10, 2021, 10:57:42 AM
Link to the sourcecode plz


Title: Re: Vanitygen search
Post by: a.a on September 10, 2021, 12:09:50 PM
Is it not enough to set the seed with the -s command parameter?


Title: Re: Vanitygen search
Post by: WanderingPhilospher on September 11, 2021, 03:03:13 AM
No I tried that.

What I want it to do is return the same results for the exact same search every time.

So it would need to start at the same point and search in a linear rather than random way.
What are you trying to accomplish via starting at same point every time?
I ask because I may know of other code that would do what you are wanting.


Title: Re: Vanitygen search
Post by: ymgve2 on September 11, 2021, 08:21:42 AM
Linear search is MUCH faster than random since with linear search you just do a single ECC addition for each new address instead of computing a full ECC private-> public multiplication for random search.


Title: Re: Vanitygen search
Post by: pooya87 on September 11, 2021, 08:32:22 AM
Linear search is MUCH faster than random since with linear search you just do a single ECC addition for each new address instead of computing a full ECC private-> public multiplication for random search.
I don't think any of them work like that. That would be a silly implementation.
The starting point is always random, from that point the next try will increment the initially random private key (private key +=1 that is public key + G).

There isn't much to be "researched" if the starting point is always the same since we are talking about a completely random and unpredictable result (ie. hash) and setting a fixed starting point creates bias in the result. For example the key you chose may already start with the character(s) you are looking for in the address without needing to increment so your test will give you 0 tries to get the address which is a false conclusion.


Title: Re: Vanitygen search
Post by: NotATether on September 11, 2021, 12:11:37 PM
Just remove the EC_KEY_generate_key function at line 129 (https://github.com/exploitagency/vanitygen-plus/blob/master/vanitygen.c#L129) and increment the private key, and then use something like BN_set_word to increment the private key int manually and then run EC_POINT_mul to multiply it by G.

Disclaimer: The linear search will probably be faster, I suspect that the key generation method is slow.


Title: Re: Vanitygen search
Post by: LoyceV on September 12, 2021, 08:25:22 AM
I would like to know if it's possible for Vanitygen to show both the privkey AND the privkeypart for the found address when performing piecewise key generation. The system must know the privkey for the address to generate it, right?
Vanitygen creates a PrivkeyPart if you use a Public Key with your search. That means you'll need the Private Key that belongs to the Public Key to convert the PrivkeyPart to the Private Key that beloings to the vanity address. Vanitygen doesn't know both parts (otherwise split key wouldn't be secure).
Maybe this helps:
Some people have a hard time figuring out the steps under Vanity Wallet on bitaddress.org (https://www.bitaddress.org).

I'll give an example. If something goes wrong, try to reproduce these steps:

From bitaddress.org, under Vanity Wallet:
Step 1 Public Key (this is what you give to me)
042B340ACEDBB68F0B556CEB98DD7AF5948433729EC67B6352FFF02B4786FAE6EDC2C55CBC7C2DD 75F121621205CCE54A8D75C876B45E5171BFB30969CE1FD96F6  [do not use this key!]

Step 1 Private Key (this is what you keep a secret and store in a safe place)
CD7A2E75421CD5759F06AC2F15434866B8A2EE757521A2E8C072259EB9B47FC8 [do not use this private key!]

Now make a Vanity address (this is what I give to you):
Address: 1testk68KLEEPXegwfBdfKeRga3egnuB3 [do not use this address!]
PrivkeyPart: 5JjHAypWFAY4Nc4mLCuGrYKUdgLAM4jXgcXKZLFEiXQXUyAfi4T [do not use this key!]

Back to bitaddress.org, Vanity Wallet Step 2:
I enter CD7A2E75421CD5759F06AC2F15434866B8A2EE757521A2E8C072259EB9B47FC8
I enter 5JjHAypWFAY4Nc4mLCuGrYKUdgLAM4jXgcXKZLFEiXQXUyAfi4T

It shows this:
Vanity Bitcoin Address: 1testk68KLEEPXegwfBdfKeRga3egnuB3 [do not use this address!]
Vanity Private Key (WIF): 5JM2dw6JaG768CcexgdqW4j2VkTYPpympNpoSBziaPcERJGLBd8 [do not use this private key!]


Title: Re: Vanitygen search
Post by: LoyceV on September 12, 2021, 01:51:29 PM
Vanitygen must know the privkey in order to calculate the address and the privkeypart, right?
No, when using split key, vanitygen doesn't know the final private key. The exact details of how it's done are lost on me though.


Title: Re: Vanitygen search
Post by: n0nce on September 12, 2021, 10:04:54 PM
Vanitygen must know the privkey in order to calculate the address and the privkeypart, right?
No, when using split key, vanitygen doesn't know the final private key. The exact details of how it's done are lost on me though.
It's called split-key vanity address, short answer in the first sentence:

Everybody can use this public key to find the complementary public key leading to a vanity address. The user can than merge his private key with the complementary private key, leading to the private key of the vanity address. The security of such solution is guaranteed by the properties of the Elliptic Curve Cryptography


Title: Re: Vanitygen search
Post by: WanderingPhilospher on September 12, 2021, 10:34:17 PM
Just remove the EC_KEY_generate_key function at line 129 (https://github.com/exploitagency/vanitygen-plus/blob/master/vanitygen.c#L129) and increment the private key, and then use something like BN_set_word to increment the private key int manually and then run EC_POINT_mul to multiply it by G.

Disclaimer: The linear search will probably be faster, I suspect that the key generation method is slow.
The other thing to keep in mind, you can edit code to make it start at same point/key, each and every time, but when using a GPU, normally the code works like this:

take GPU x and y grid size; let's say our is 10x10

then the program takes your range/keyspace, let's say we have a range of 1000000

now the program divides the range by the grid size, in our example:
grid is 10x10 = 100
range size = 1000000
so the program spreads out each GPU thread every 10000 keys/points, and then works incrementally.

Same is true for CPU threads as well. Now you can control this via only using 1 CPU thread and that 1 thread will count incrementally.

But if you plan on using GPU, you will need to edit the code more or just know that while it will start from same point, it will be same point plus grid/range.
Also, if you have nothing to tell the program that x amount of keys have been reached/searched, then your GPU threads will be redoing the keys already ran by other GPU threads. So you have to put in a "nextkey" function that basically says, take grid, take range, take speed, calculate those things, and jump all threads forward by the calculation, once the calculation has been met.


Title: Re: Vanitygen search
Post by: Meitzi on November 15, 2021, 12:28:36 PM
Hey guys,

Looking to see if anyone can tell me how to modify the Vanitygen code so that it will start searching at the same point every time and not jump around to another random search position.

Thanks in advance :o)
Are you trying to remove randomness or only like save / resume function?
If you are removing randomness, then it means, I will get also your private key if I run same code with same starting pattern.


Title: Re: Vanitygen search
Post by: Tanagi on September 12, 2022, 05:51:58 AM
Just remove the EC_KEY_generate_key function at line 129 (https://github.com/exploitagency/vanitygen-plus/blob/master/vanitygen.c#L129) and increment the private key, and then use something like BN_set_word to increment the private key int manually and then run EC_POINT_mul to multiply it by G.

Disclaimer: The linear search will probably be faster, I suspect that the key generation method is slow.
The other thing to keep in mind, you can edit code to make it start at same point/key, each and every time, but when using a GPU, normally the code works like this:

take GPU x and y grid size; let's say our is 10x10

then the program takes your range/keyspace, let's say we have a range of 1000000

now the program divides the range by the grid size, in our example:
grid is 10x10 = 100
range size = 1000000
so the program spreads out each GPU thread every 10000 keys/points, and then works incrementally.

Same is true for CPU threads as well. Now you can control this via only using 1 CPU thread and that 1 thread will count incrementally.

But if you plan on using GPU, you will need to edit the code more or just know that while it will start from same point, it will be same point plus grid/range.
Also, if you have nothing to tell the program that x amount of keys have been reached/searched, then your GPU threads will be redoing the keys already ran by other GPU threads. So you have to put in a "nextkey" function that basically says, take grid, take range, take speed, calculate those things, and jump all threads forward by the calculation, once the calculation has been met.

Thanks so much for this...

I am only using CPU, but would obviously like to use all threads to work on the search.

Do you think you could provide the code I need to make it work incrementally? I would really appreciate it.

Thanks in advance.


Title: Re: Vanitygen search
Post by: nc50lc on September 12, 2022, 07:01:48 AM
The other thing to keep in mind, you can edit code to make it start at same point/key, each and every time, but when using a GPU, normally the code works like this:
-snip-
-snip-
Do you think you could provide the code I need to make it work incrementally? I would really appreciate it.
WanderingPhilospher already made a Vanitysearch/Bitcrack fork that can do exactly that: https://github.com/WanderingPhilosopher/VanBitCrakcenS/releases (https://github.com/WanderingPhilosopher/VanBitCrakcenS/releases)
The source code is only available in the 'releases' page.

It also has a command line argument --continue that'll save the position where you left off.


Title: Re: Vanitygen search
Post by: Tanagi on September 13, 2022, 01:25:34 AM
Quote
WanderingPhilospher already made a Vanitysearch/Bitcrack fork that can do exactly that: https://github.com/WanderingPhilosopher/VanBitCrakcenS/releases (https://github.com/WanderingPhilosopher/VanBitCrakcenS/releases)
The source code is only available in the 'releases' page.

It also has a command line argument --continue that'll save the position where you left off.

Thanks, but there is only an .exe and no source code to look at unfortunately, only the readme inside the zip.


Title: Re: Vanitygen search
Post by: NotATether on September 14, 2022, 02:13:04 AM
Thanks, but there is only an .exe and no source code to look at unfortunately, only the readme inside the zip.

It's closed-source I believe, so it only works for Windows. Were you looking to run it on Linux?

If you're just running CPU search, WINE is going to be super slow but it should work under it correctly.


Title: Re: Vanitygen search
Post by: Tanagi on September 14, 2022, 03:05:23 AM
Thanks, but there is only an .exe and no source code to look at unfortunately, only the readme inside the zip.

It's closed-source I believe, so it only works for Windows. Were you looking to run it on Linux?

If you're just running CPU search, WINE is going to be super slow but it should work under it correctly.



Ok, thanks.

Yeah, running on Ubuntu 20.04.


Title: Re: Vanitygen search
Post by: BHWallet on September 14, 2022, 01:26:59 PM
Thanks, but there is only an .exe and no source code to look at unfortunately, only the readme inside the zip.

It's closed-source I believe, so it only works for Windows. Were you looking to run it on Linux?

If you're just running CPU search, WINE is going to be super slow but it should work under it correctly.



Ok, thanks.

Yeah, running on Ubuntu 20.04.

Even without the --continue option you can use the last found key position as starting range on your next search.
Just look for shorter pattern so the software will dump keys every 20-30min, that way you will always know "where you are".


Title: Re: Vanitygen search
Post by: Tanagi on October 05, 2022, 11:16:53 PM
If anyone is willing and has the skills to help me with this, I am more than happy to pay for the help.

Please dm me for the full details if interested.

Thanks.


Title: Re: Vanitygen search
Post by: PawGo on October 06, 2022, 06:56:31 AM
If anyone is willing and has the skills to help me with this, I am more than happy to pay for the help.

Please dm me for the full details if interested.

Thanks.

If you talk about project https://github.com/JeanLucPons/VanitySearch/, then take a look at file
https://github.com/JeanLucPons/VanitySearch/blob/master/Vanity.cpp
There in line 306 the process of setting initial key starts. If you ignore the next like (sha256), and set your desired key, it should work. Ah, and of course do not use 'rekey' option.


Title: Re: Vanitygen search
Post by: Tanagi on October 07, 2022, 05:54:06 AM
If anyone is willing and has the skills to help me with this, I am more than happy to pay for the help.

Please dm me for the full details if interested.

Thanks.

If you talk about project https://github.com/JeanLucPons/VanitySearch/, then take a look at file
https://github.com/JeanLucPons/VanitySearch/blob/master/Vanity.cpp
There in line 306 the process of setting initial key starts. If you ignore the next like (sha256), and set your desired key, it should work. Ah, and of course do not use 'rekey' option.


Thanks, I'll take a look.
I'm no programmer though, so I'd still like to find someone who could do this for me.


Title: Re: Vanitygen search
Post by: PawGo on October 07, 2022, 12:48:27 PM
Thanks, I'll take a look.
I'm no programmer though, so I'd still like to find someone who could do this for me.

I will try to prepare a version when you may pass that desired startKey as a parameter, maybe today, maybe tomorrow. I will let you know.


Title: Re: Vanitygen search
Post by: dextronomous on October 07, 2022, 10:14:12 PM
Thanks, I'll take a look.
I'm no programmer though, so I'd still like to find someone who could do this for me.

I will try to prepare a version when you may pass that desired startKey as a parameter, maybe today, maybe tomorrow. I will let you know.
Pawgo,

hi there,, could you make next one go random, still *backwards but full speed but cuda, guess now opencl. thanks

https://github.com/ndv/vanitygen

https://github.com/ndv/vanitygen/archive/refs/heads/master.zip

would be great, thanks a lot.


Title: Re: Vanitygen search
Post by: PawGo on October 08, 2022, 08:57:05 PM
Thanks, I'll take a look.
I'm no programmer though, so I'd still like to find someone who could do this for me.

I have prepared a simple patch under https://github.com/PawelGorny/VanitySearch
There is a new parameter --startPriv where you may specify the private key which should be used as a base key for the program. Honestly speaking I do not know why one would like to use it, as program does not work sequentially (operations on public keys create private keys in different ranges), so it cannot be used as a replacement for tools like "BitCrack". But I suppose it could be one of ways to "remember" how to restore a given vanity address - if you know how you specified initial key, you may know how to restore it.
For example, search for 1o1ag9U may be very demanding, but if you know you started search from a given key, it could be instant (BTW, it gives nice hit, no?)

Code:
VanitySearch.exe -stop --startPriv abcdef1234567890987654321fedcba 1o1ag9U