Can I make a Bitcoin address with a specific string? I don't wanna deal with private or public keys, just something unique to put on the blockchain. Thinking of using Python 3 and maybe brute-forcing it.
Creating a Custom Bitcoin Address
17 replies 97 views
You don't need to brute force it. Just follow these steps:
1. Avoid invalid characters like 0OIl.
2. Keep your string short to fit the address length (160-bit hash when decoded).
3. Convert your string to bytes and pad it with zeros to make it 160 bits.
4. Use Base58check encoding on the result. It'll handle checksums and version bytes for you.
I want the final address to literally have my string in it, not just the bytes before encoding.
wizard_2016Full Member
Posts: 127 · Reputation: 575
#4May 15, 2020, 11:16 AM
Addresses aren't just random strings; they aren't stored directly in the blockchain. Block explorers and wallets reconstruct them from transactions. As mentioned by @pooya87, a legacy address comes from a 160-bit hash, plus a version and checksum that you can't control much.
But you just gave an example of a string in a blockchain address. That's exactly what I'm after! I want my string in the address without needing keys.
rocket_2019Member
Posts: 23 · Reputation: 204
#6May 17, 2020, 07:31 PM
If you have "MyString" and want it on the address, you could base58decode_check("MyStringChecksum"), tweak the bytes for length and checksum, then base58encode_check those bytes to get your address. I just need to see how to code that in Python 3.
Sounds like you want something specific.
Here's the output: if your string is too long, you'll get multiple addresses, otherwise just one. That what you mean?
Yes, is there Python code for this? I can't find anything like that in the libraries.
How's that supposed to help? You need a way to generate it.
There's no need for brute force; you're just making a burn address without a key. I once used a web tool that let you enter something like "1Whatever" and it generated an address starting with that. Searching online for creating burn addresses might be helpful.
I think I shared a script before but lost the link. Just remember to stick to valid base58 characters. I did some mini brute force to get the checksum in check.
rocket_2019Member
Posts: 23 · Reputation: 204
#12May 20, 2020, 12:52 PM
That's exactly what I need! I'll give it a run once I verify the script. What should I use for the goal/prefix variables?
Why say that? The library has a wrapper ready for this. Just two lines of Python should do it.
goal = "1bitcointaLkforumburnLegacyaddress"
prefix = "1BitcoinTALKforumBurnLegacyaddr"
The prefix shows how many characters you want to match. If it's taking too long, you might be using too much space for the checksum.
rocket_2019Member
Posts: 23 · Reputation: 204
#15May 22, 2020, 08:36 PM
Trying what you posted and getting results.
Steps:
1. Clone or download the repo to your PC.
2. deal with to that folder and run your Python scripts. That's it.
ben.matrixNewbie
Posts: 3523 · Reputation: 35
#17May 23, 2020, 01:40 AM
Maybe your secp256k1 library is clashing with another one from a different source.
ben.matrixNewbie
Posts: 3523 · Reputation: 35
#18May 23, 2020, 04:36 AM
It worked! Thanks a ton!