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

Ethereum Transaction Confirmation on Running Python in a Terminal Window Interactively

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

- 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

- Create and send transactions via
create_tx and send_tx functions
Transaction View on Python Notebook

Terminal View of details on Accounts and BTCTEST coin transactions
"txid":"d742d8a9c7fe5b8afc5f2a1c862568bb511a61760eb03175f422c0b096722bf2"

Terminal view of signed transaction on BTCTEST coin

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

Ropsten

1 ETH from Ropsten

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 confirmation

BTCTEST transaction on 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

View in MyCrypto Wallet

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

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

nano constants.py
Nano environment

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
评论