Skip to content

A collection of data science and utility functions aimed at supporting Bitcoin analysis, transaction optimization, and portfolio management.

License

Notifications You must be signed in to change notification settings

ashrithssreddy/bitcoin-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin Utilities (bitcoin_utils)

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:

Overview

Bitcoin Project Status License Python Version Dependencies Contributions Welcome

  • Bitcoin transaction optimization
  • Dynamic fee calculation based on mempool data
  • Seed phrase validation (BIP-39)
  • Portfolio management with Bitcoin exposure

Key Features


  • 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.

Installation

git clone https://github.com/ashrithssreddy/bitcoin_utils.git
cd bitcoin_utils
pip install -r requirements.txt

How to Use


1. Dynamic Fee Estimation

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")

2. Seed Phrase Validation

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}")

3. Private Key Generation from Seed Phrase

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}")

Contributing

Contributions are welcome! Feel free to open a pull request or issue to propose new features or improvements.

License

This repository is licensed under the MIT License. See the LICENSE file for details.

About

A collection of data science and utility functions aimed at supporting Bitcoin analysis, transaction optimization, and portfolio management.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published