Searching for Target Strings in P2PKH Addresses

6 replies 454 views
n0c0inerSenior Member
Posts: 8 · Reputation: 1707
#1Sep 14, 2023, 05:38 PM
So I’m curious if it’s possible to find a private key where the P2PKH address has a specific string in it, like HelloWorld. Are there any restrictions on what strings can show up? Like, could some super long string never appear at all?
3 Reply Quote Share
chrisomegaFull Member
Posts: 69 · Reputation: 631
#2Sep 14, 2023, 10:47 PM
That's pretty much how vanity addresses work. There are way more private keys than valid addresses. Roughly 2^256 private keys compared to about 2^160 P2PKH addresses. So, for every address, there’s like 2^96 private keys on average. As long as it’s a valid address, you can potentially find the matching private key, just harder with longer strings.
0 Reply Quote Share
n0c0inerSenior Member
Posts: 8 · Reputation: 1707
#3Sep 15, 2023, 03:53 AM
Nice numbers you’ve given. Seems like there’s a ton of cool addresses out there for sure!
1 Reply Quote Share
0xChadNewbie
Posts: 186 · Reputation: 3
#4Sep 17, 2023, 05:05 AM
Yeah, but strings like 'HelloWorld' can’t actually appear. P2PKH addresses use base58, which removes some characters like '0', 'O', 'I', and 'l'. However, stuff like 'aaaaaaaaaaaaaaaa' could show up but it would take a massive amount of time to brute-force it.
3 Reply Quote Share
calmblockMember
Posts: 3 · Reputation: 48
#5Sep 17, 2023, 07:20 AM
Hey there! Any valid base58 string can pop up in a P2PKH address, since hash160 is pretty random. But yeah, 'HelloWorld' definitely needs a private key. And if the string has invalid characters, it’s a no-go. Longer strings mean a bigger search space too. Sure, 'aaaaaaaaaaaaaa' is possible but good luck finding that, it’d take ages!
1 Reply Quote Share
m1kes4tFull Member
Posts: 60 · Reputation: 252
#6Sep 17, 2023, 11:46 AM
Right, it’s all about how long your string is. I’ve got a Python script that can turn your text into prefixes for searching using vanity address generation tools like Keyhunt.
5 Reply Quote Share
0xChadNewbie
Posts: 186 · Reputation: 3
#7Sep 19, 2023, 12:26 AM
Awesome, does it output one prefix per line? And is it compatible with vanitysearch? Also, clever idea to swap out invalid base58 characters for their valid equivalents. Just watch out, sometimes it changes the focus on a different word, lol!
2 Reply Quote Share

Related topics