This repository serves as a comprehensive suite of data science utilities and tools tailored to the Bitcoin ecosystem. It is designed for developers, quantitative analysts, and crypto enthusiasts who seek advanced solutions for:
- Bitcoin transaction optimization
- Dynamic fee calculation based on mempool data
- Seed phrase validation (BIP-39)
- Portfolio management with Bitcoin exposure
-
Dynamic Bitcoin Transaction Fee Estimator: Leverages mempool data to provide accurate fee estimations, enabling users to optimize transaction costs based on current network conditions. Supports priority-based fee calculations (e.g., low, medium, high priority).
-
BIP-39 Seed Phrase Validator: Implements a manual validation method for BIP-39 seed phrases, ensuring both word validity and checksum accuracy. This goes beyond standard validation, offering transparency into how BIP-39 works under the hood.
-
Private Key Generator: Converts BIP-39 seed phrases into Bitcoin private keys (WIF format) while enforcing strict validation for wordlists and checksum integrity. It supports optional passphrase encryption, adding another layer of security.
-
Live Bitcoin Price Fetcher: Retrieves real-time Bitcoin prices in any supported fiat currency, offering flexibility for multi-currency Bitcoin valuation.
git clone https://github.com/ashrithssreddy/bitcoin_utils.git
cd bitcoin_utils
pip install -r requirements.txt
This tool calculates dynamic transaction fees based on the current mempool state, allowing for optimal fee selection.
from utils.dynamic_transaction_fee import calculate_dynamic_transaction_fee
transaction_size = 250 # Transaction size in bytes
priority = 'medium' # Options: 'low', 'medium', 'high'
fee = calculate_dynamic_transaction_fee(transaction_size, priority)
print(f"Estimated Fee: {fee} satoshis")
Validate a BIP-39 seed phrase, ensuring it follows the entropy-checksum structure and contains only valid BIP-39 words.
from utils.bip39_validator import validate_bip39_checksum
seed_phrase = "abandon ability able about above absent absorb abstract absurd abuse access accident"
valid = validate_bip39_checksum(seed_phrase)
print(f"Seed Phrase Valid: {valid}")
Convert a validated seed phrase into a private key (WIF format), with optional passphrase support for enhanced security.
from utils.generate_private_key import generate_private_key_from_seed
seed_phrase = "abandon ability able about above absent absorb abstract absurd abuse access accident"
private_key_wif = generate_private_key_from_seed(seed_phrase)
print(f"Private Key (WIF): {private_key_wif}")
Contributions are welcome! Feel free to open a pull request or issue to propose new features or improvements.
This repository is licensed under the MIT License. See the LICENSE file for details.