Skip to content

Akabbott0303/Multi-Blockchain-Wallet-Python

Repository files navigation

Multi-Blockchain Wallet in Python

This project includes code and instructions for building and using a cryptocurrency hot wallet in Python. The code contained in the file wallet.py imports the required libraries and environment variable and creates functions to create the wallet, convert privates keys to wallet addresses, and create and send transactions. The coins used are Ethereum (ETH) and Bitcoin testnet (BTCTEST). Additional coins can be added to this wallet.

Installations

Use the Requirements text file to install the dependencies needed to run the code to create the HD wallet.

Install PHP and Apache Web Server for Windows operating systems. Windows users might also need to install Microsoft Visual C++ Build Tools.

To install the hd-wallet-derive tool, open up a terminal window as Administrator. Run the following code:

hd-wallet-derive-install-code

This will create a new folder called hd-wallet-derive. You will run the Pyhon code in the folder containing the hd-wallet-derive folder. To create a shorcut (symlink) to make it easier to run the code, open a terminal as Administrator and change directory to your project folder, which should contain the hd-wallet-derive folder. Run the following commands:

  1. export MSYS=winsymlinks:nativestrict
  2. ln -s hd-wallet-derive/hd-wallet-derive.php derive

To test that you can run the ./derive script properly, run the following command:

./derive --key=xprv9zbB6Xchu2zRkf6jSEnH9vuy7tpBuq2njDRr9efSGBXSYr1QtN8QHRur28QLQvKRqFThCxopdS1UD61a5q6jGyuJPGLDV9XfYHQto72DAE8 --cols=path,address --coin=ZEC --numderive=3 -g

The output should look similar to this:

symlink_creation_output

Now you can start creating your own multi-blockchain wallet!

Setting up the Wallet and Sending Transactions

Thy Python code in the file wallet.py first imports all libraries and loads an environment variable to set the mnemonic phrase that will be used to generate the keys and addresses. The code also imports a constants file to set the coin variables. You'll need to add to these if you want to use the wallet to hold additional coin types.

The derive_wallets function uses the mnemonic phrase to generate wallet private keys and addresses for each coin type. A dictionary called coins is established to hold the keys. The priv_key_to_account function creates an account object from a private key.

The create_tx function creates a raw, unsigned transaction that contains the metadata required to run a transaction. The send_tx signs the transaction and sends it to the designated network.

Sending a BTCTEST Transaction

Send_BTC_Code BTC_Send_Transaction_Confirmation

Sending an ETH Transaction

Send-ETH-Code ETH_Send_Transaction_Confirmation_1 ETH_Send_Transaction_Confirmation_2

About

Cryptocurrency wallet using Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published