Skip to content

Discover wallets via hd-wallet-derive. Test transactions using web.js on Bitcoin and ethereum testnets.

License

Notifications You must be signed in to change notification settings

Ava33343/Python_Babysitting_for_Blockchain_Wallet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Could Python Take Care of Coins in Your Crypto Wallet?

How to talk to a computer terminal, asking python to sent different crypto coins in our wallet?

Wallet

A crypto wallet is created using python in the file: wallet.py and Jupyter notebook version of wallet.py.

Get BTC testcoins and transaction details on Bitcoin Testnet

Transaction Confirmation on BTC testcoin

tx_btc

Ethereum Transaction Confirmation on Running Python in a Terminal Window Interactively eth_create_send_tx

To run wallet.py:

  • Open a terminal window on the wallet folder
code .
  • Access functions in wallet.py interactively, run on the terminal window:
from wallet import * 
Three accounts each for BTCTEST and ETH

keys

  • Run the priv_key_to_account function to connect to account information via Web3 on localhost:8545
Information on Accounts and Keys in Python Notebook

priv_key_to_account

  • Create and send transactions via create_tx and send_tx functions

Transaction View on Python Notebook create_tx_send_tx_btc

  • Outputs produced by wallet.py in the terminal include:

    • Private keys and addresses for BTCTEST and ETH coins
    • transaction details on create_tx(BTCTEST, btc_0, btc_1.address, 0.0001) in a dictionary

Terminal View of details on Accounts and BTCTEST coin transactions

"txid":"d742d8a9c7fe5b8afc5f2a1c862568bb511a61760eb03175f422c0b096722bf2"

create_tx_btc

Terminal view of signed transaction on BTCTEST coin

btc_eth_accounts_tx


Trouble-shooting Stage on Ethereum Transactions

Terminal Window:

First Attempt:

Need to set up local testnet using ./puppeth and ./geth

  • Derived information on the first couple of ethereum accounts
    • key for first ethereum account to send coins, eth_0
    • address for the second ethereum account to receive coins, eth_1.address
>>> # Initiate a transaction of 0.01 ethereum on testnet
>>> create_tx(ETH, eth_0, eth_1.address, 0.01)

Second Attempt:

>>> create_tx(ETH, '0xf0a03ce2448ac74a409a0d0f837fb993774e1aa700906d854cefd0e3150ff35e', '0xBf2CEa365Fa098bBABDd11b0ecbD9462595612e5', 0.01)

Third Attempt:

>>> create_tx(ETH, priv_key_to_account(ETH,'0xf0a03ce2448ac74a409a0d0f837fb993774e1aa700906d854cefd0e3150ff35e'), priv_key_to_account(ETH,'0x202bcf2d6ee314ca4593a0edc6f39d19a27c2d4b503c26c3d1637d2338de014c').address, 0.01)

Note: Error messages on all three attempts.

Ethereum Testcoins

Kovan kovan_eth_confirm

Ropsten ropsten_eth

1 ETH from Ropsten

ropsten_eth_confirm


Previously, it was in trouble-shooting stage. A bitcoin transaction is generated via this "get_balance" notebook file.

Screenshots of the transaction confirmation is provided here:

BTCTEST transaction

BTCTEST Transaction

BTCTEST transaction confirmation

BTCTEST Transaction Confirmation

BTCTEST transaction on testnet3

BTCTEST testnet3

For crypto transaction on localhost http://127.0.0.1:8545

Ethereum transaction confirmation

Mining is initiated on ethereum proof-of-authority testnet called txs. It is placed under zbank node in MyCrypto Wallet. Please see details below.

Mining

Mining

View in MyCrypto Wallet

MyCrypto

Wallet Folder Structure

In Mac Terminal

  • Create a wallet by mkdir wallet
  • touch wallet.py to generate a python file for crypto transaction functions
  • Install hd-wallet-derive by typing
ln -s hd-wallet-derive/hd-wallet-derive.php
Create files in wallet folder

Wallet Structure

  • Set up environment requirements in a file by
touch requirements.txt
Nano environment

requirements

  • Set up constants.py file for BTCTEST, ETH and BTC by typing
nano constants.py
Nano environment

requirements


Further exploration should there be more time

  • Trouble shooting on ethereum transactions

  • Add support for BTC.

  • Add support for LTC using the sister library, lit.

  • Add a function to track transaction status by txid.


Files

Wallet

Images

References

About

Discover wallets via hd-wallet-derive. Test transactions using web.js on Bitcoin and ethereum testnets.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published