Skip to main content

A Python package to check Bitcoin address balances using Blockchain.info API

Project description

blockcheck is a high-performance Python package designed to give you quick and reliable access to essential Bitcoin blockchain data. Leveraging the speed and efficiency of Rust under the hood, blockcheck allows you to effortlessly query Bitcoin addresses for their balances, transaction counts, and total received amounts, all powered by the robust bitcoin blockchain

Whether you're building a cryptocurrency wallet, a blockchain analytics tool, or simply need to track specific Bitcoin addresses, blockcheck provides a fast and easy-to-use solution without the overhead typically associated with raw API interactions.

Key Features Blazing Fast Performance: Written in Rust, blockcheck compiles to native code, offering superior speed and memory efficiency compared to pure Python implementations, especially for data-intensive operations. Simple & Intuitive API: Interact with the bitcoin blockchain API through a clean and Pythonic interface. No need to worry about HTTP requests or JSON parsing – blockcheck handles it all. Essential Bitcoin Metrics: Easily retrieve: Current Balance: The spendable balance of a given Bitcoin address (in satoshis). Transaction Count: The total number of transactions associated with the address. Total Received: The cumulative amount of Bitcoin ever received by the address (in satoshis). Reliable Data Source: Utilizes the widely recognized and trusted bitcoin blockchain API for accurate and up-to-date information. Installation Getting blockcheck up and running is straightforward. Simply use pip:

Bash

pip install blockcheck Note: As blockcheck contains Rust extensions, a Rust toolchain will be required on your system for successful installation if pre-compiled wheels are not available for your specific environment. Most users, however, will find the installation seamless.

Usage Interacting with blockcheck is designed to be as simple as possible. After installation, you can import the blockcheck module and use its primary function, get_balance.

Python

import blockcheck

A well-known Bitcoin address (Satoshi Nakamoto's Genesis Block address)

address = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"

try: # Retrieve balance, transaction count, and total received balance, n_tx, total_received = blockcheck.get_balance(address)

print(f"--- Bitcoin Address Details ---")
print(f"Address: {address}")
print(f"Current Balance: {balance} satoshis")
print(f"Total Transactions: {n_tx}")
print(f"Total Received: {total_received} satoshis")
print(f"-----------------------------")

# You can also convert satoshis to BTC for readability
balance_btc = balance / 10**8
total_received_btc = total_received / 10**8
print(f"\nIn BTC:")
print(f"Current Balance: {balance_btc} BTC")
print(f"Total Received: {total_received_btc} BTC")

except Exception as e: print(f"An error occurred: {e}") print("Please check the address or your internet connection.")

Error Handling blockcheck aims to provide clear error messages for common issues, such as an invalid Bitcoin address or network problems. It's always a good practice to wrap your blockcheck calls in try...except blocks to gracefully handle potential API errors or connectivity issues.

Contribution & Support blockcheck is an open-source project, and contributions are welcome! If you encounter issues, have feature requests, or would like to contribute code, please visit the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blockcheck-0.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blockcheck-0.1.0-cp312-cp312-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.12Windows x86-64

File details

Details for the file blockcheck-0.1.0.tar.gz.

File metadata

  • Download URL: blockcheck-0.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.6

File hashes

Hashes for blockcheck-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1b891e6a568bb4bbaacc37bb16f172a7344a59f2137b57cd07911686d4701999
MD5 fbfc8c1a0af40e639c1c8c2b4120d291
BLAKE2b-256 860c9d7a84ab65d1fa14726d7591f84c9ffad439d8aa579242b8aa8e137f1f2d

See more details on using hashes here.

File details

Details for the file blockcheck-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for blockcheck-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 868f6a756292af69dd7a556504b7de27d2e26e1fbe76864c391d6713d7b163a6
MD5 1e86d6353928791af04481aabcac324a
BLAKE2b-256 e57fe669f20b7a626ebbd66e109145801f69cf97b3c74cf4c0a838767771bea1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page