Programmatically Create an Ethereum Wallet With Python and Infura

Programmatically Create an Ethereum Wallet With Python and Infura

If you’re a Python developer, you’ve probably noticed that there’s a lack of straightforward tutorials on how to create a wallet for Ethereum—especially ones that don’t assume you’re a blockchain expert. I ran into the same problem. So I rolled up my sleeves, figured it out, and now I’m sharing the

Rizwan Qaiser·July 5, 2022·3 min read

If you’re a Python developer, you’ve probably noticed that there’s a lack of straightforward tutorials on how to create a wallet for Ethereum—especially ones that don’t assume you’re a blockchain expert. I ran into the same problem. So I rolled up my sleeves, figured it out, and now I’m sharing the entire process with you.

This guide walks you through how to create an Ethereum wallet using Python in just ten lines of code. It’s fast, clean, and works with any EVM-compatible blockchain.

We will use:

Note: You can use any provider, like Moralis or Alchemy to achieve the same. Just swap it out with Infura.

Prerequisites Before You Create an Ethereum Wallet

Before we dive into the code, you’ll need to create a free account on Infura.io. Once you verify your email, you’ll get access to your API keys and Ethereum endpoint. Don’t worry—we’ll use this later in our script.

Step-by-Step: How to Create a Wallet for Ethereum in Python

This tutorial outlines the quickest way to Ethereum create wallet functionality using Python.


Let’s install the mnemonic and web3.py libraries. The above libraries install the dependencies you need to generate a mnemonic word list which is used to generate your Private Key using the BIP-39 standard. You will also need the web3.py library to interact with the blockchain.

1. Create a new file and import the required libraries.

These are the core dependencies to help you generate a secure seed phrase and communicate with the Ethereum blockchain

2. Initialize the mnemonic class:


Let’s take a second to understand the code. First, we initialize the mnemo class. Then, we generate our phrase using mnemo.generate(strength=256).Finally, we generate seed using the words we generated in the previous step. You can choose to provide an extra passphrase of your choice for extra security. You have now generated a unique private key for the Ethereum chain. Now let’s generate our public address from the above key. This is the foundation of any Ethereum create wallet function.  

3. Initialize web3.py:

Get your endpoint URL from Infura and set it to MAIN_NET_HTTP_ENDPOINT above. Then, initialize a class named w3 with the endpoint.

4. Initialize the account class:


We use seed[:32] above as we only need to use the 32-bit string of the seed as our private key.    

5. Get your public and private keys:

And that’s it — you’re done! You’ve just created a functional Python Ethereum wallet from scratch.

And yes, it is that simple. Don’t believe me? You can print private_key and import it using metamask. You can also print words and use it to recover your account.

Final Thoughts: Ethereum Wallets, Python, and Simplicity

Creating a wallet doesn’t have to be complicated. Whether you’re exploring how to create an Ethereum wallet for development, testing, or learning blockchain tech, this approach is fast, reliable, and beginner-friendly.

By following this guide, you now know how to create a wallet for Ethereum using Python—and you’ve built a simple, functional script that you can adapt and expand in your own blockchain projects.

Here’s the code all together so it’s easier for you to copy:

From the intelligence suite

What's slowing your marketing performance?

AnalyticsAudit diagnoses your tracking setup, attribution blind spots, and measurement gaps — free, no strings attached.

Run a free check
Continue reading
A graphic of an interconnected web of nodes, similar to a neural network, set against a blue background. The nodes represent different data points or systems, and the lines connecting them symbolize APIs as a seamless, organized network for communication and data flow. Surrounding the web are abstra

Engineering & Operations

Hyper-automation with APIs: The CEO’s guide to automation

If your tools are not talking to each other, your team is busy working. Hyperautomation with APIs fixes that. It connects your systems, lets AI agents act on live data, and removes manual steps that slow you down. The goal is not to replace people. The goal is to clear the queue so your team […]

Eisha FaisalSep 24, 2025
5 min read
Illustration of a tangled ball of lines transforming into a neat circle, symbolizing turning complex automation jargon (API, JSON, triggers) into simple workflows using n8n.

Engineering & Operations

n8n Automation Without Coding: A True Story

I never thought two days could feel like an entire season of highs, lows, and plot twists. But that’s exactly what our hackathon at Autonomous turned out to be.​ Stepping into day one I felt equal parts excitement and dread. Excitement because we live and breathe automation as a company, and dread b

Musfirah AslamSep 18, 2025
5 min read