Generating Wallets
In this section we’re going to learn how to generate Keystores for your wallets. A Keystore is a file that contains the information for your public/private key, encrypted by a secret aka password. By using Keystores you will avoid keeping your private key in plaintext.
I’ve provided a “generate-wallets.py” script that makes this section quick and gets you straight into botting.
5. Pick a secret phrase to encrypt your wallets
Rename “sample.env” to “.env”. Edit it and choose a long and unique/random string.
This acts like a password for your wallets. Don’t lose or let anyone else see it!
6. Create 3 new wallets
You only need one of these commands for now. Pick A if you are not adding your new wallets to Rabby/Metamask yet.
Type these commands into the Terminal of PyCharm.
You will need 3 wallets to complete this tutorial
a) Type this to create a wallet. This will create 3 wallets and show you the public keys.
Example Result:
b) To create wallets and immediately show their private keys too
Example Result:
c) If you just want to view the private key of an existing wallet
Example Result:
All created wallets will be stored at such paths:
7. Import the private keys to Rabby/Metamask (optional)
You can skip this step if you want. It’s solely to help with manual intervention and debugging if you want to do something quick with your wallets outside of Python.
Note that handling your private key this way is typically not secure but it’s the only way to import it into a browser wallet. Please don’t have any keyloggers running if you can help it 🥴
8. Edit your “.env” file
Fill in wallet A/B/C with the 3 public keys you generated above.
Now we’re ready to automate our workflow. Let’s create the bot logic next.
Last updated