Stellar blockchain quickly became my favourite one because of its lightness, versatility and ease of use. Other than exchange Lumen, the native coin (
XLM), with Stellar it is possible to create our own tokens, use the built-in marketplace, create smart contracts and so on. On public, testing or even private blockchain.
As a big fan of the command line and Python, it is very simple for me to issue any sort of operations and transactions on Stellar directly from my keyboard.
Surely, Stellar Laboratory is a great tool to interact with Stellar blockchain. But coders will be having more fun writing some lines of code, in order to accomplish more complex tasks at the speed of light. Fortunately, interaction with Stellar Horizon is very well supported for different programming languages, including Python. Take a look at
py-stellar-base, a damn simple and useful Python library.
I’m going to post more code about Stellar with Python very soon. Meantime, in this post, I want to show you how to search for vanity wallet addresses - in other words, addresses containing a given string of characters or reflecting particular logical properties. Just using some Python code.
So I tried by myself to search for a valid address containing my name. To find a sequence of five characters in any position didn’t take too much (some minutes)2 with my
i7 laptop Linux computer. Here is the code (
Python3, download from Github - of course, you must install the above mentioned
py-stellar-base package before).
Set your favourite condition at line
10. For example, find wallets having the same character in the last five positions:
Please note that required time may explode exponentially as the complexity of the conditions increases.
For any found wallet, public address is printed out on the screen and the corresponding keypair (public address + secret seed) is appended in the local file (
As you already know, secret seeds are the passwords for the corresponding public addresses, so you must not share them with others and must keep them in a safe place! Especially if you are going to use some of those newly generated wallets.
Have you chosen your brand new vanity wallet? Well, create it on the blockchain by putting some Lumen in it - or ask for some
XLM to Friendbot if you’re working on the testnet. To do so, Stellar Laboratory is still your friend and we will see how to proceed in some other posts here.
But before going on, let’s do a last check on a keypair: is the secret seed valid for our new wallet? Check it from command line (download code):
And we are done. I wrote this post in the hope that you enjoy Stellar blockchain too.