A bot for creating crypto wallets. We're writing our own generator in Python for Bitcoin and Ethereum.

WILD

Administrator
Staff member
ADMIN
SELLER
SUPREME
MEMBER
Joined
Jan 21, 2025
Messages
220
Reaction score
631
Deposit
0$
I think many of you are familiar with this real-life situation. You need to generate a bunch of wallets for some project, for distribution, for testing, or just for the sake of it. Creating them manually each time through some website is time-consuming and tedious. And entering private keys through web forms isn't even an option—you never know who remembers them.

I went through this myself when I needed to create about fifty wallets for a single experiment. I thought I'd find a service that would generate them in bulk, but it was either paid, suspicious, or didn't work at all. I had to figure it out and write my own bot. Now I'll explain how to do it so you don't have to worry about it.

What is a crypto wallet and how is it created?

Before we dive into the code, we need to understand what we're generating. A crypto wallet isn't some file sitting on your disk. It's simply a pair of keys: a private key and a public key.

Your private key is your secret. Whoever knows it can control your coins. You need to keep it hidden.

Your public key and wallet address are what you can show others so they can send you money. The address is derived from the public key using various cryptographic transformations.

Essentially, creating a wallet is simply generating a random number (the private key) and calculating everything else from it. Bitcoin uses the ECDSA algorithm, while Ethereum uses a similar, but slightly different, algorithm.

What we'll need to create the bot

We'll be writing in Python because it's simple and there are a ton of ready-made libraries for it. If you don't know Python but want to follow along, just Google it as we go; it's not that complicated.

Libraries to install:

bitcoinlib — for working with Bitcoin and its derivatives.

web3.py — for Ethereum and EVM-compatible networks.
· mnemonic — for generating mnemonic phrases (the same 12-24 words used to restore wallets).

Everything is installed with one command:

```
pip install bitcoinlib web3 mnemonic
```

If you get errors, you may need to install something else, but usually there are no problems.

How to generate Bitcoin wallets

Let's start with Bitcoin, because it's a classic. Here's an example function that creates a single wallet:

```python
from bitcoinlib.keys import Key
from bitcoinlib.mnemonic import Mnemonic

def create_bitcoin_wallet():
# Generate a 12-word mnemonic seed
mnemo = Mnemonic()
seed_phrase = mnemo.generate()

# Create a key from this seed
key = Key.from_mnemonic(seed_phrase)

# Get the private key in WIF format
private_key_wif = key.as_WIF()

# Get the wallet address
address = key.address()

print(f"Mnemonic seed: {seed_phrase}")
print(f"Private key (WIF): {private_key_wif}")
print(f"Bitcoin address: {address}")

return {
"seed_phrase": seed_phrase,
"private_key_wif": private_key_wif,
"address": address
}
```

What's happening here:

· Mnemonic().generate() creates a random 12-word phrase. This can be used to restore the wallet in any normal application.
· Key.from_mnemonic(seed_phrase) converts this phrase into keys.
· key.as_WIF() produces a private key in WIF (Wallet Import Format). This key can be imported into most wallets.
· key.address() is the address you give people so they can send you bitcoins.

How to generate Ethereum wallets

With Ethereum, things are a little different, but still not difficult.
```python
from eth_account import Account
from eth_account.signers.local import LocalAccount

def create_ethereum_wallet():
# Enable HD wallet support
Account.enable_unaudited_hdwallet_features()

# Generate a mnemonic phrase and create an account
account, mnemonic_phrase = Account.from_mnemonic(
mnemonic=Account.generate_mnemonic(),
account_path="m/44'/60'/0'/0/0"
)

# Get the private key in hexadecimal format
private_key = account.key.hex()

# Get the Ethereum address
address = account.address

print(f"Mnemonic phrase: {mnemonic_phrase}")
print(f"Private key (HEX): {private_key}")
print(f"Ethereum Address: {address}")

return {
"seed_phrase": mnemonic_phrase,
"private_key": private_key,
"address": address
}
```

Here are some nuances:

· Account.enable_unaudited_hdwallet_features() — enables experimental features. It's better to delve deeper into this in production, but it's fine for home use.
· account_path — is the BIP-44 path for Ethereum. It's needed to generate multiple addresses from a single mnemonic phrase.
· The private key here is in HEX format, not WIF, like Bitcoin.

Putting it all together in one bot

Now that we have the functions for generating individual wallets, we can create a full-fledged bot that will create them in batches and save them to a file.

```python
import json
from bitcoinlib.keys import Key
from bitcoinlib.mnemonic import Mnemonic
from eth_account import Account

def create_bitcoin_wallet():
mnemo = Mnemonic()
seed_phrase = mnemo.generate()
key = Key.from_mnemonic(seed_phrase)
private_key_wif = key.as_WIF()
address = key.address()
return {"type": "bitcoin", "seed_phrase": seed_phrase, "private_key": private_key_wif, "address": address}

def create_ethereum_wallet():
Account.enable_unaudited_hdwallet_features()
account, mnemonic_phrase = Account.from_mnemonic(
mnemonic=Account.generate_mnemonic(),
account_path="m/44'/60'/0'/0/0"
)
private_key = account.key.hex()
address = account.address
return {"type": "ethereum", "seed_phrase": mnemonic_phrase, "private_key": private_key, "address": address}

def generate_wallets(num_bitcoin=1, num_ethereum=1, output_file="wallets.json"):
all_wallets = []

print(f"Генерирую {num_bitcoin} Bitcoin кошельков...")
for i in range(num_bitcoin):
wallet = create_bitcoin_wallet()
all_wallets.append(wallet)
print(f" {i+1}. BTC: {wallet['address']}")

print(f"\nГенерирую {num_ethereum} Ethereum кошельков...")
for i in range(num_ethereum):
wallet = create_ethereum_wallet()
all_wallets.append(wallet)
print(f" {i+1}. ETH: {wallet['address']}")

# Сохраняем в JSON
with open(output_file, 'w') as f:
json.dump(all_wallets, f, indent=4)

print(f"\nГотово! Кошельки сохранены в файл {output_file}")

if __name__ == "__main__":
print("=== Генератор криптокошельков ===\n")

try:
btc_count = int(input("Сколько Bitcoin кошельков нужно? "))
eth_count = int(input("Сколько Ethereum кошельков нужно? "))
filename = input("Имя файла для сохранения (по умолчанию wallets.json): ") or "wallets.json"

generate_wallets(num_bitcoin=btc_count, num_ethereum=eth_count, output_file=filename)

except ValueError:
print("Ошибка: нужно вводить числа, а не буквы")
except Exception as e:
print(f"Что-то пошло не так: {e}")
```
It's easy to use.

Save the code to a file, for example, wallet_bot.py. Run it in the terminal:

```
python wallet_bot.py
```

The program will then ask how many Bitcoin wallets to generate, how many Ethereum wallets, and which file to save the result to.

After running, a JSON file will appear with contents similar to the following:

```json
[
{
"type": "bitcoin",
"seed_phrase": "abandon abandon apple banana ...",
"private_key": "L1HKjfajsdf...",
"address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
},
{
"type": "ethereum",
"seed_phrase": "another twelve words here ...",
"private_key": "0x1234abcd...",
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
}
]
```

What else can be added

This bot is a base. It can be expanded to suit your needs.

Password-based generation. You can configure wallets to be created deterministically (based on a password) rather than randomly. This is convenient if you need to restore all wallets from a single master key.

Support for other coins: TRON, Solana, and various ERC-20 tokens. Each network has its own libraries.

Encryption of the results file. Instead of simple JSON, you can save everything encrypted so that private keys aren't exposed in plaintext.

Database integration. If you have a lot of wallets, it's more convenient to store them in SQLite or PostgreSQL rather than in a file.

My pitfalls

I made a big mistake, so I'm telling you so you don't repeat them.

Pitfall 1: The first time I ran the script, I forgot that the private keys were output to the console. I was showing it to a friend, and he, a keen eye, said, "Why are you displaying the private keys all over the screen?" I had to redo it.

Problem 2. I thought the mnemonic phrase wasn't that important, the private key was. Then I learned that using the phrase, you can restore all the keys in the same chain. Now I store the phrase too.

Problem 3. I saved the results to an unstructured text file. Parsing those logs was a pain. I switched to JSON.

Problem 4. I forgot that Ethereum's private key is in HEX format and tried importing it into a Bitcoin wallet. Naturally, nothing worked.

Problem 5. I generated wallets on a virtual machine, then deleted the virtual machine. Along with all the keys. Good thing they were test keys.

Important Security Notes

A few things you should always remember.

Never store private keys in plain text. On a disk, in the cloud, or in your phone's notes. If someone else gets hold of the wallet file, you'll lose everything.

Never enter private keys on websites, even if the website looks like an official wallet. Copy them and immediately delete them from the clipboard.

Never generate keys on computers that might be infected. If there's a Trojan, it can steal everything you create.

Always make backups. A flash drive, a piece of paper, and an encrypted file in the cloud.

Briefly on the topic

Writing your own bot for generating crypto wallets isn't as difficult as it seems. Ready-made libraries do all the dirty work; all you have to do is put them together.

For Bitcoin, use bitcoinlib, and for Ethereum, eth_account. Add mnemonic phrase generation, pack them into loops, and save them as JSON.

The main thing is to remember security. Your keys are your money. Treat them accordingly.
 
Top Bottom