How to use a computer to quickly create 150 wallets with 24-digit Seed Phrase and export the private key

This article is machine translated
Show original

Creating a large number of wallets and exporting private keys requires some programming knowledge. The following is an example of using Python, mnemonic and eth_account libraries to create a wallet with 150 24- Seed Phrase and export the private key. This example is for an Ethereum wallet, but can be adapted for other blockchains as needed.

First, you need to install the required libraries. Run the following command at the command line:

pip install mnemonic eth-account

Next, create a Python script (eg: create_wallets.py ) and enter the following code:

 import os from mnemonic import Mnemonic from eth_account import Account def generate_wallets(num_wallets, words_num):    wallets = []    for _ in range(num_wallets):        # 生成 24 位助记词        mnemo = Mnemonic("english")        mnemonic_words = mnemo.generate(strength=words_num * 32 // 3)        # 从助记词中生成私钥        seed = mnemo.to_seed(mnemonic_words)        private_key = Account.from_key(seed).key        wallets.append({"mnemonic": mnemonic_words, "private_key": private_key.hex()})    return wallets def main():    num_wallets = 150    words_num = 24    wallets = generate_wallets(num_wallets, words_num)    # 输出助记词和私钥    for idx, wallet in enumerate(wallets, 1):        print(f"Wallet {idx}:")        print(f"Mnemonic: {wallet['mnemonic']}")        print(f"Private Key: {wallet['private_key']}")        print("=======================================") if __name__ == "__main__":    main()

Save and run the script: python create_wallets.py

This will output Seed Phrase and private keys for 150 wallets to the console.

WARNING : Handle private keys with care. Anyone with access to the private key can control the corresponding wallet and assets. Do not generate or store private keys in an insecure environment. This example is for illustration purposes only, make sure to follow security best practices when doing it.

Mirror
Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
Like
Add to Favorites
4
Comments