Note: This is all just for educational / fun purposes. Do not use this code to generate a real seed that you intend to store real value on!!
Create a python3 virtualenv and install the one dependency:
pip install embit
Grid for a target seed fingerprint, with option to supply the first n words of the mnemonic.
Note: Again, DO NOT USE THESE SEEDS TO SECURE REAL VALUE!!!
from grind import grind_mnemonic
grind_mnemonic(target="decaf", prepend_mnemonic="coffee power remove".split())
It'll keep returning candidate matches until you CTRL-C.
So you can follow along, my mnemonic was:
coffee power remove satoshi tunnel ice either nose action fancy truck exist
fingerprint: decaf1ab
When you find a vanity fingerprint you like, move on to:
This is the most resource-intensive step!
from grind import grind_address
grind_address(mnemonic, target="decaf", start=0, account=0)
This is a linear search that increments the address derivation path:
m/49'/0'/{account}'/0/{start + i}
And prints out each case-insensitive matching address that is found.
Because this is a linear search, if you interrupt the process, use the start
param to pick up where you left off.
Run this in multiple processes over different account
values in parallel to speed up the odds of landing a match.
Here's my result:
m/49'/0'/4'/0/53499628 3DecafHwmLTN7xShDtjcTZj8MfMnpbVQLS
With your mnemonic and vanity address in hand, fund the address with enough sats to cover the OP_RETURN tx we'll be creating next.
The OP_RETURN data will be appended with a random hex string which we keep changing so that each iteration hashes to a different txid until the vanity target is found.
Set up your params and start grinding. This step will be a bit quicker as we're back in the hexadecimal domain, though each iteration does require some heavier calculations since we have to construct and sign a proposed tx in order to get to the final txid that would appear onchain.
from grind_txid import grind_txid
kwargs = dict(
mnemonic = "<your mnemonic here>",
input_txid = "<your txid that funded your vanity addr>",
input_vout = 0, # the output number from the above tx that went to your vanity addr
input_amount = 7639, # total sats sent to your vanity addr via that funding tx
cur_block_height = 830_009, # update to be at least equal to the block that contains the funding tx
vanity_target = "decaf", # The hexadecimal string you'd like your OP_RETURN tx to start with
op_return_msg = "gist.github.com/kdmukai/2b78776814786c9dc36094e3967bc2c2",
derivation_account = 4, # From the results of the vanity addr derivation path
derivation_index = 53499628, # From the results of the vanity addr derivation path
)
grind_txid(**kwargs)
The resulting transaction can be directly pasted into Sparrow (or any other software coordinator) and immediately broadcast since it will already be signed.
My run yielded:
decaf5911733de701cbf1ab76050d5531ffa15e4feaed18dc62a7aef8a766bd5
0200000000010134e675fb1623fb78e82fe67471729f5428d815e72e9a788527667327bd3de2670000000017160014009deaf737d9bc1c058bdfaaba8248d608451d16ffffffff010000000000000000466a4c43676973742e6769746875622e636f6d2f6b646d756b61692f3262373837373638313437383663396463333630393465333936376263326332207c20613061336163373702473044022057d1d1561396c65b330da1cfbe65b7814d635c329957451fd334ce019257c5ff02206964aaccde963187d728efa4166955df036bddb62057f0ba96532d846c9feb670121026e539670b341de8c263dce3627f339a5fee799dfaf81305643aee126090746013baa0c00
And here it is onchain: https://mempool.space/tx/decaf5911733de701cbf1ab76050d5531ffa15e4feaed18dc62a7aef8a766bd5