Skip to content

Instantly share code, notes, and snippets.

@yuzujin99
Last active October 22, 2024 11:47
Show Gist options
  • Save yuzujin99/f3913d7b3f3aa694b0a83c4e9e85c96e to your computer and use it in GitHub Desktop.
Save yuzujin99/f3913d7b3f3aa694b0a83c4e9e85c96e to your computer and use it in GitHub Desktop.
Generate seed of specific ending of ETH address
# pip install mnemonic bip44
from mnemonic import Mnemonic
from bip44 import Wallet
from bip44.utils import get_eth_addr
import multiprocessing
# Numbers and letters from A to F only
target = "8964"
target_len = len(target)
def gen_phrases():
mnemo = Mnemonic("english")
return mnemo.generate(strength=256) # 128 for 12 words seed
def get_address(phrases):
wallet = Wallet(phrases)
_, public_key = wallet.derive_account("eth", account=0)
return get_eth_addr(public_key)
def generate_phrases_and_addresses():
while True:
phrases = gen_phrases()
eth_address = get_address(phrases)
return phrases, eth_address
def check_address(address_pair):
phrases, eth_address = address_pair
if eth_address[-target_len:] == target:
return phrases, eth_address
if __name__ == '__main__':
with multiprocessing.Pool(processes=multiprocessing.cpu_count()) as pool:
while True:
result = pool.map(check_address, [generate_phrases_and_addresses()])
if result[0]:
print(result[0])
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment