creating a valid address from a specific string

15 replies 112 views
omega2009Member
Posts: 27 · Reputation: 127
#1Jul 5, 2025, 02:40 AM
So besides looking for those fancy vanity addresses, is there a way to generate a valid address using a specific string, without needing the private or public keys? I’m thinking about placing a permanent address on the blockchain by sending some leftover coins there. I’m talking about doing this with Python 3, maybe using some kind of brute-force approach?
6 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#2Jul 5, 2025, 06:57 AM
Yes. Do this (no brute force necessary): 1. Avoid invalid characters (0OIl) in the string you are using 2. Your string has to be small enough to not exceed the standard address length (160 bit hash when decoded) 3. Convert your string to bytes and pad it with zeros until it is 160 bits (20 bytes) 4. Encode the result using Base58check (feed the 160-bit result to the encoder as if you are feeding the RIPEMD160 hash of a public key, it should add the address version byte to it and compute and append the checksum as well) Please don't, you would be creating an unspendable UTXO that will remain in the UTXO set forever. Use OP_RETURN if you want to insert an arbitrary message into the chain...
2 Reply Quote Share
omega2009Member
Posts: 27 · Reputation: 127
#3Jul 5, 2025, 10:46 AM
I need the result address to have the string, not the bytes before base58check encoding.
2 Reply Quote Share
paul2017Senior Member
Posts: 218 · Reputation: 1426
#4Jul 5, 2025, 11:30 AM
An address cannot be an arbitrary string because the address itself is not stored in the block chain. Block chain explorers and wallets analyze a transaction to construct the address. As @pooya87 described, a legacy address is constructed from a 160-bit hash, plus a version and a checksum. The version and checksum are mostly out of your control. The best you can do is an address like 1BitcoinEaterAddressDontSendf59kuE. Also, segwit and taproot addresses have similar limitations.
0 Reply Quote Share
omega2009Member
Posts: 27 · Reputation: 127
#5Jul 5, 2025, 02:32 PM
You just given example of arbitrary string in blockchain as an address. Yes, that is what I want to do. My own string in address. I don't need pvk nor pubkey. Let's say I have "MyString" and I need to see it in address. Starting characters and ending can be any. So, for example, I base58decode_check("MyStringChecksum"), I am getting bytes, add some at the end for proper length and checksum, and at the end base58encode_check the bytes giving me what I want. I just don't know how to code that (mostly in Python 3). I know the theory, I need working example of conversion.
0 Reply Quote Share
eric.maxiMember
Posts: 35 · Reputation: 232
#6Jul 5, 2025, 07:56 PM
I think you are simply looking for something like this. Result : If the String is bigger you will get a list of address output. Otherwise it will be just 1 address. Example Is that what you want ?
2 Reply Quote Share
omega2009Member
Posts: 27 · Reputation: 127
#7Jul 6, 2025, 08:55 AM
Seems like yes, is there any python code to do that? This library does not provide this function...
2 Reply Quote Share
omega2009Member
Posts: 27 · Reputation: 127
#8Jul 6, 2025, 01:04 PM
And how it is supposed to answer the question?
1 Reply Quote Share
L0neDegenSenior Member
Posts: 331 · Reputation: 1464
#9Jul 6, 2025, 01:23 PM
You don't have to brute force anything, since you only build a valid (burn) address, no key. I've used a tool like that in the past, but I've accessed it as an online page where you wrote like "1Whatever" and it was creating an address starting with this. Maybe searching the net for creating a burn address for bitcoin would give you results. Or maybe you can check out what I've found via web search and I didn't check (I'm not familiar with python): * https://gist.github.com/dancodery/e26890a60cd676ca8ca3af8c247d0bb8 * https://gist.github.com/spaceexpanse/b9b7ab1f88b85cc5b3e1509ec1c7441e
4 Reply Quote Share
sage_moonSenior Member
Posts: 273 · Reputation: 1371
#10Jul 6, 2025, 05:45 PM
In a post from some time ago I shared this script, I think, but I couldn't find the link. You just have to respect the structure and not include characters that aren't in base58. I did it as a mini brute force to cover the bytes destined for the checksum so I could include more vanity characters.
4 Reply Quote Share
omega2009Member
Posts: 27 · Reputation: 127
#11Jul 8, 2025, 12:23 AM
Seems like exactly what I am looking for. Will merit once I verify the script. What to put in goal/prefix variables? EDIT: it didn't found for me for few minutes (that's also too long). But this script works [ https://gist.github.com/dancodery/e26890a60cd676ca8ca3af8c247d0bb8 ]:
0 Reply Quote Share
eric.maxiMember
Posts: 35 · Reputation: 232
#12Jul 10, 2025, 10:30 AM
Why you said it. The library has already the wrapper defined for this purpose. You just need 2 lines of code in python3 for your purpose, nothing else. If you want to know the inside implementation of how it is done, then here is the defined function from the file secp256k1.py which is responsible.
0 Reply Quote Share
sage_moonSenior Member
Posts: 273 · Reputation: 1371
#13Jul 10, 2025, 03:58 PM
goal = "1bitcointaLkforumburnLegacyaddress" prefix = "1BitcoinTALKforumBurnLegacyaddr" Basically, the prefix represents the minimum number of characters in the search target. And goal represents the ideal target. If it takes a while to find a string, your burnaddress probably covers too much space in the checksum, which will make it take longer to find the ideal checksum to complete your address. The normal thing to do is to leave a little space for the checksum by reducing the length of the prefix string to find it quickly.
4 Reply Quote Share
omega2009Member
Posts: 27 · Reputation: 127
#14Jul 12, 2025, 01:35 PM
I am getting: Tried the same way you have posted here.
4 Reply Quote Share
eric.maxiMember
Posts: 35 · Reputation: 232
#15Jul 12, 2025, 03:49 PM
Steps: 1. Git clone or download this to any Folder in your pc. https://github.com/iceland2k14/secp256k1 2. cd to same folder and then run python commands or scripts you desire. That will work. The reason for failure is that you might have another library with the same name secp256k1 from some other repo.
1 Reply Quote Share
omega2009Member
Posts: 27 · Reputation: 127
#16Jul 15, 2025, 12:10 AM
Yep! It works! Thank you very much!
2 Reply Quote Share

Related topics