Skip to content

Instantly share code, notes, and snippets.

@lumunge
Created June 6, 2022 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lumunge/5fa87b5f51524dad597bb38e37859f52 to your computer and use it in GitHub Desktop.
Save lumunge/5fa87b5f51524dad597bb38e37859f52 to your computer and use it in GitHub Desktop.
import requests
import json
address = input('Paste Wallet Address: ')
response = requests.get(f'https://blockchain.info/unspent?active={address}')
# utxo list
utxo_list = json.loads(response.text)["unspent_outputs"]
total = 0
for utxo in utxo_list:
print(f"BTC: {utxo['tx_hash'], utxo['tx_output_n'], float(utxo['value']) / 100000000}")
total += utxo['value'] + 0
print(f"Total Spendable BTC: {float(total) / 100000000}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment