How Do You Use Python to Retrieve Information about Bitcoin Transactions?

Problem scenario
You want to use Python to get data from BTC transactions. You do not want to use "import requests". What do you do?

Solution
Prerequisite

This assumes you have installed the Bitcoin pypi package: pip install bitcoin
If you need assistance installing pip, see this posting for Ubuntu or this posting for a Red Hat derivative. (You may need to use pip3 instead of pip.)

Procedures

  1. Enter the Python command line (with running the "python" or "python3" command).
  2. Run these two commands (but substitute the "3N8PfUXqXZzzFDxoPPgRiaiepziXpvYrpb" with the Bitcoin address of your choice**):
from bitcoin import *
history("3N8PfUXqXZzzFDxoPPgRiaiepziXpvYrpb")

** To find more Bitcoin addresses, go here and look for hyperlinks of similar alphanumeric strings:
https://www.blockchain.com/btc/address/3N8PfUXqXZzzFDxoPPgRiaiepziXpvYrpb

Leave a comment

Your email address will not be published. Required fields are marked *