Skip to content

Instantly share code, notes, and snippets.

@ongrid
Last active January 1, 2025 20:23
Show Gist options
  • Save ongrid/687da0ee5a0bc57094a1f880885a8a27 to your computer and use it in GitHub Desktop.
Save ongrid/687da0ee5a0bc57094a1f880885a8a27 to your computer and use it in GitHub Desktop.
BIP-44 mnemonic generator
# This snippet generates BIP-39 mnemonic (seed phrase)
# then derives 10 Ethereum private keys from it (with their addresses)
# The same algorithm and paths are used in Metamask, Trust Wallet, Ganache, hardhat
# and other popular wallets and tools.
from bip44 import Wallet
from bip44.utils import get_eth_addr
from mnemonic import Mnemonic
mnemo = Mnemonic("english")
words = mnemo.generate()
w = Wallet(words)
print(f"Mnemonic: {words}")
print("Addresses and private keys:")
for i in range(10):
sk, pk = w.derive_account("eth", address_index=i)
print(f"{i} {get_eth_addr(pk)} {sk.hex()}")
# Insecure phrases bruteforcer
f = open("venv/lib/python3.9/site-packages/mnemonic/wordlist/english.txt", "r")
wordlist = f.read().splitlines()
phrase_start = "test test test test test test test test test test test "
for word in wordlist:
candidate_phrase = phrase_start + word
if mnemo.check(candidate_phrase):
print(candidate_phrase)
@ongrid
Copy link
Author

ongrid commented Jan 4, 2022

## well known phrase
MNEMONIC="test test test test test test test test test test test junk"

0 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
1 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
2 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC 5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
3 0x90F79bf6EB2c4f870365E785982E1f101E93b906 7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6
4 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
5 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc 8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba
6 0x976EA74026E726554dB657fA54763abd0C3a0aa9 92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e
7 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356
8 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f dbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
9 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6

@ongrid
Copy link
Author

ongrid commented Jan 21, 2022

export MNEMONIC="test test test test test test test test test test test waste"

0 0x5fCb8f7149E8aD03544157C90E6f81b26933d3a2 0a348125238dd90539cefdd5577b781a6ffbcdc4b2208ca9947872ddad9d614e
1 0x031A55b6156A5FCad6732fa10A6D58092413B6C6 ac8a80455a454fab19dc2ecd181ab6ab77edd745915b806ac69c1061f507fa96
2 0xA6A207aceD8bEcfD40D1d0340B0D30306b474E58 950bd52c8d71f2ced2905673256ed6f193fee83912bb5b7fa7c3d562608a2318
3 0x013CCa7490Df1803B030515561A4E99B66d010c7 944b5d1057fd03e542f9126ca4c4e758f14265d63d68dc751a02b4394469b5f9
4 0x250fd12F3C285116F1AcD41fcB054756938f1AF9 e13f48b01b568ada7e7d7080ea3346331d0abc947b568845d8a156bc9b821923
5 0x7D93575849B079FD923f85eB355ECe4e640F61ac 015c4b3a27268f93142865d5c833a0696d2a643dc730413820f2fc1b54910e7a
6 0x1B1a9B14E5cD635C48D34c891f6D8Ac59E81fb62 bba936f30d40c275950a0d1a57c2f36147397d8c950e59d63db079f200f5956a
7 0x63460D767EdD9ADe0B8771c1B59D6F4a2a61a5d9 958c953baaf2efe585f9c5bf98bc73f3fa33502d6639f55d574230fc45f45f23
8 0x89d25F2166dC68Be17C8aA8ecb711B1a9e96eb74 2ec7c4507f76f8008c1c9a4b906b7943936a890b13b5d160b6cd3b4a82e26b43
9 0xC215B6c5936119c603Df21C9a89d9423775670D3 d66bfe07fccebf5b9d92f2107a9126bece3a009d974d1896a93b9d493ffc6264
10 0x00fe7C821d66368bfC78753Baf9B7639D708F662 861c237ac886d905a59413bd86bf63dc6fce62746c055228940b5aad6b323419
11 0x8889Fc00799C3255bF6162917D62acaC9a37F920 f39718cd06540b41384579f9879be86487cac4f90fd0ad49a83beb643515bdac
12 0x297Df83B933eE82ff1FfF4004fCcF7bC50e5e18D c0afbb925e8a3d8ca8d45b2ea171a5075865e33383f5aadfb4be5fab1c0ee679
13 0x1179d39f73080d9dDB22812223614428AB1633b5 a078fdb94ce6fe9a0f4980c6e04869040edd09fb05dd45def6819fb41a5634de
14 0x97F19E982A457A327f58602F5d48f5B63bf6159a 707b17c8a587c4698c7708fb5c8ae821a4682543e8982b9bc27567af078d3410
15 0x2Cd371c8Dbf0a9F69cf9d0f8b15881f5D524cC80 260d811fd7956cca92bb04900a6bcf70c4db704f60c71ae3ad6df579ba062873
16 0xCd0b77C3bF1254f1731f9862a1Fb26a2496e9349 a9acc6ef1f8fff35b8058d12a398d2fda91f2a0be1d38c6bf1a6377b40e53be6
17 0xAEAdFD5e27C1F849fbaE88fE6B9E461eb2631693 406c7d9ea8dbb73c6a8183d872b029f22d732a4aa1d2ac9ec89aea100a103269
18 0xb8F349361A73086C7C4cAE184552624DEeE75938 f5b90f241cbbb1789a0ade82f6e5f9c2237f31d5096d5b00831c0d668a145d15
19 0xf7B22daA51E543Bec4CC5866A2B622Eea82E573A 4765dcec974841f6c52e98df85e80f850076eee9f293098c0b5563bdf7048b7e

@ongrid
Copy link
Author

ongrid commented Nov 10, 2022

Mnemonic: test test test test test test test test test test test wheel
Addresses and private keys:

0 0x6beC61340fA6781cac9Cd039964E2067F4c1f468 32b00521bac1f7c45c3a02e93ab13314a41d5267a3b47607f643cfa8fd69279f
1 0xE6CE5994C668bA5e73de9a149bA81D6f4BCF37ad f5354423b57ba4306d64f0b91f1ae61e0a2dd00f3544422824d9e533b07c5cf8
2 0x48FAA859a4949c976799Db5ed34AA75EFA99e26d ff706e1df42625e991f21643a8dfaa7c68c3d73825b63cfe5040c8bb72a81c0a
3 0xA35c8D81424Fd57De38850d06D19cDcd58ABab38 1a48cecf7b552b09fe506c36b1d0daac2b4bc9a004e605d44e33a327636265fe
4 0xeE48f7c9c7D81F0f8dBB757E205Be8d16D5cb14a c904c9ba7b81320184072d4d290081c78e51bed814493f5b50a87dcf40b1e449
5 0x1Fba6e8ed3eE8A43E4dD71F1a91889266b6Cc6AB 9564c1e8128ef6179d12dfe8f986ee75b4a9ab0e39f6df68eaba0cc1cac7df86
6 0xA3cFd1A0d83Cf9ab29b5598bFA68ee32aF6d10cb e0e3865146f14b0f82197b50a3087be117d6124a5fcd686f538086645fe1fe3e
7 0x728167dE4a628771E39C0067de67493e86EA9d8c 7007217f7475a63ee6f2f937a021485966576e178b7753e020a244752bc608f6
8 0x8f9e9B5D61d01e3AbBceB0299d897a14995166C8 2cd3c15c14d8c4ecb62f575d66b276eaa0be6be382484d71c26b49650c8d5300
9 0x8993AC1f856d02e552b7D6De81097F9DF932aDC1 1b650174bcfaa99a6dddedc5aad6cfdcd811d6e9016fc212f1dd423daf6a62c5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment