Seems like yes, is there any python code to do that?
This library does not provide this function...
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.
>>> import secp256k1 as ice
>>> ice.create_burn_address('pbies', 'x')
'1pbiesxxxxxxxxxxxxxxxxxxxxxyWyYH7'
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.
def create_burn_address(vanity = 'iceLand', filler = 'x'):
# create_burn_address('ADayWiLLcomeWheniceLandisGoingToSoLvebitCoinPuzzLe', 'X')
out = []
bs58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
for i in vanity:
if i not in bs58:
return "invalid char found in vanity --> : " + i
vanity = [vanity[i:i+25] for i in range(0,len(vanity),25)] # For longer text make many address
for t in vanity:
s = t.ljust(30, filler) if t[0] == '1' else ('1'+t).ljust(30, filler) + '111'
h = address_to_h160(s)
out.append(hash_to_address(0, True, bytes.fromhex(h)))
if len(out) == 1: return out[0]
else: return out