Creating crypto hd wallet in Termux !

in #wallet6 years ago (edited)

As a linux user , I always like to do all of my jobs on that OS and here in termux, I am feeling as same as that and I like to do most of things in termux instead of main android and by this , in my idea it will be like the Watch dogs game. Any way I like that. And today I discovered a way to create cryptocurrencies HD wallet.

What is hd wallet?
An HD Wallet, or Hierarchical Deterministic wallet, is a new-age digital wallet that automatically generates a hierarchical tree-like structure of private/public addresses (or keys), thereby addressing the problem of the user having to generate them on his own
#found on google

Ok let's start and don't waste time. As you know termux is like the linux and all linux has python on them. Yeah we are going to code a python program that generates HD wallets of BTC, BTG, BCH, LTC, DASH, USDT, QTUM and DOGE.

Ok , in this program , we will generate a hd wallet and the program will show us the information of the wallet like the private key , address , xprivate key and ... .

Now the requirements :
1-the termux app on android
2-python 2 and 3 (I think it is installed from first time you run termux)
3-at least 3g internet connection for downloading a python pip

We are going to use a python pip as I said. It's name is pywallet.Connect to internet and Go to termux and enter this command:

sudo pip install pywallet

It will take a little time.
When it finsished we must start to code our wallet generator.

For coding in termux we need a text editor. I am using "nano" in my termux. I didn't use any commands to install it , I think it is installed by termux from first time. Ok for using nano enter "nano" in termux and the text editor will appear.
If didn't work , take little look in google. It will be installed by a command. Or say in comments.
Enter the code below in your note pad:

create_btc_wallet.py

from pywallet import wallet

generate 12 word mnemonic seed

seed = wallet.generate_mnemonic()

create bitcoin wallet

w = wallet.create_wallet(network="BTC", seed=seed, children=1)

print(w)

Don't enter * in your code!
Ok if you are using nano now , press
CTRL + x (the ctrl is available in new termux update)
Then press "y"
And now enter a name for it with ".py" format. For example enter "btcwallet.py".

Now we must run our code. Cause it's written in python , we must use python command. Then our command will be like this:

python3 yourfilename.py

For examplefor me was like this:

python3 btcwallet.py

Then it shows a long text that includes the information of your btc wallet. It is a text like this :
coin': 'BTC', 'seed': 'menu only indicate saddle narrow hub fringe honey dune economy damp decade', 'private_key': '2d632ae96538493d94c43f09c57cf44aad8a00232a0ad4751de3e067d3d98cba', 'public_key': '04f1e1fff9747cedbabb5da858c9e3bb3e8684679c26299563ce723eeac776e474e2b67db7375e4aa5f74d8ce8cc315cf795c9576ad118c3b38dcca339fe54de92', 'xprivate_key': 'xprv9s21ZrQH143K3TsquxL8TY5y4qtuNfjApPRZeHWhURnNodQgzvJeqEi9NZkqV3bFQmgpQed7kdt8dXuk5Y4uMHGMehWRdxEgRDmoxjBoxAN', 'xpublic_key': 'xpub661MyMwAqRbcFwxK1ys8pg2hcsjPn8T2BcMASfvK2mKMgRjqYTcuP32dDrH98zfA6ASpZ6M6SoeupLvD6Ux7U5fmaWUvQ2sLNznbsRznUTf', 'address': '1PpaKvkmmzu5EUu7GJnbizT7EqTYcarDx7', 'wif': b'KxjwMhahxQaJW3d5wr2M1WBHPRBr4WxghWUzEnxJbqC3nzej2U5o', 'children': [{'xpublic_key': 'xpub69jDGQiP4UhzBT1DZdrbd9FvoVWf3xPJsnT1nmWDjCG9ieu8BhSp7vLKFQw9kayA7TGGzqAK2tDRPGK8gp9Wzd6rtGGRvPZwRXEMFrH5EQp', 'address': '1KzfJAyMNCJmcLs6aHHRa8j72v1M1kKbFH', 'path': 'm/0', 'bip32_path': "m/44'/0'/0'/0"}], 'xpublic_key_prime': 'xpub69jDGQiXQ9ExLNBCqJzkzYzhsxMwqHMo1pdkaXQHefNHyjgFPSbggif8i5aZs93SL3skwGNQ2R3N9RcDYdUpU9XKbie51kkqLZW1cw1hW3q'

It includes address,seed,private key and...
You can use this info to make a paper wallet too.

Ok it was for just btc , what about other?
Just enter their symbols instead of btc in code. For example it is eth code:

from pywallet import wallet

seed = wallet.generate_mnemonic()
w = wallet.create_wallet(network="ETH", seed=seed, children=1)

print(w)

It was all for termux ! Now keep those info safe and receive by your address.
Also I am going to code a simple program that makes the job easier. It will be available in github for downloading on termux and linux and other platforms and it will ask the user which wallet for which currency the user wants.

Thank you very much for reading!
Support by a upvote!
I will share a new post about that program too!
#python #hdwallet #termux #linux #bitcoin #dogecoin #dash #ethereum #bitcoincash #wallet #generating_wallet #paperwallet