Skip to main content

Bitcoin and Other cryptocurrency Library

Project description

Bitcoin Crypto Currency Library for Python.

Includes a fully functional wallet, with multi signature, multi currency and multiple accounts. Use this library to create and manage transactions, addresses/keys, wallets, mnemonic password phrases and blocks with simple and straightforward Python code.

You this library at a high level and create and manage wallets for the command line or at a low level and create your own custom made transactions, keys or wallets.

The BitcoinLib connects to various service providers automatically to update wallets, transactions and blockchain information.

Unittests PyPi RTD Coveralls

Install

Installed required packages

$ sudo apt install build-essential python3-dev libgmp3-dev

Then install using pip

$ pip install bitcoinlib

For more detailed installation instructions, how to install on other systems or troubleshooting please read https://bitcoinlib.readthedocs.io/en/latest/source/_static/manuals.install.html

Documentation

Read the full documentation at: http://bitcoinlib.readthedocs.io/

Example

The bitcoin library contains a wallet implementation using SQLAlchemy and SQLite3 to import, create and manage keys in a Hierarchical Deterministic way.

Example: Create wallet and generate new address (key) to receive bitcoins

>>> from bitcoinlib.wallets import Wallet
>>> w = Wallet.create('Wallet1')
>>> w.get_key().address
'1Fo7STj6LdRhUuD1AiEsHpH65pXzraGJ9j'

Now send a small transaction to your wallet and use the scan() method to update transactions and UTXO’s

>>> w.scan()
>>> w.info()  # Shows wallet information, keys, transactions and UTXO's

When your wallet received a payment and has unspent transaction outputs, you can send bitcoins easily. If successful a transaction ID is returned

>>> t = w.send_to('1PWXhWvUH3bcDWn6Fdq3xhMRPfxRXTjAi1', '0.001 BTC', offline=False)
'b7feea5e7c79d4f6f343b5ca28fa2a1fcacfe9a2b7f44f3d2fd8d6c2d82c4078'
>>> t.info  # Shows transaction information and send results

More examples

Checkout the documentation page https://bitcoinlib.readthedocs.io/en/latest/ or take a look at some more examples at https://github.com/1200wd/bitcoinlib/tree/master/examples

Contact

If you have any questions, encounter a problem or want to share an idea, please use Github Discussions https://github.com/1200wd/bitcoinlib/discussions

Implements the following Bitcoin Improvement Proposals

  • Hierarchical Deterministic Wallets (BIP0032)

  • Passphrase-protected private key (BIP0038)

  • Mnemonic code for generating deterministic keys (BIP0039)

  • Purpose Field for Deterministic Wallets (BIP0043)

  • Multi-Account Hierarchy for Deterministic Wallets (BIP0044)

  • Structure for Deterministic P2SH Multisignature Wallets (BIP0045)

  • Bech32/base32 address format for native v0-16 witness outputs (BIP0173)

  • Native and P2SH nested Segregated Witness transactions (BIP0141 and BIP0143)

  • Bech32m format for v1+ witness addresses (BIP0350)

  • and many more…

Future / Roadmap

  • Support advanced scripts

  • Fully support timelocks

  • Support for lightning network

  • Support for Trezor wallet or other hardware wallets

  • Allow to scan full blockchain

  • Integrate simple SPV client

  • Support Schnorr signatures

Disclaimer

This library is still in development, please use at your own risk and test sufficiently before using it in a production environment.

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

bitcoinlib-0.6.11.tar.gz (4.2 MB view details)

Uploaded Source

Built Distribution

bitcoinlib-0.6.11-py3-none-any.whl (325.3 kB view details)

Uploaded Python 3

File details

Details for the file bitcoinlib-0.6.11.tar.gz.

File metadata

  • Download URL: bitcoinlib-0.6.11.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.11

File hashes

Hashes for bitcoinlib-0.6.11.tar.gz
Algorithm Hash digest
SHA256 a100cbab3708727bdb34515ea5ace1e31070bf874f5d19ae41508dd2cb65c491
MD5 5386c4e35f67fddc49a565954ebb48ca
BLAKE2b-256 564c435b8114bf6158d89ce763ec42b37da79f310993aee5d977438ef98ecf69

See more details on using hashes here.

File details

Details for the file bitcoinlib-0.6.11-py3-none-any.whl.

File metadata

  • Download URL: bitcoinlib-0.6.11-py3-none-any.whl
  • Upload date:
  • Size: 325.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.11

File hashes

Hashes for bitcoinlib-0.6.11-py3-none-any.whl
Algorithm Hash digest
SHA256 c068b1c27e44e166b2886c6a50eb63c133fe4e969dd683b57b300489b30b42a8
MD5 9df694a6e7d7e2115ee0266e08fc66a0
BLAKE2b-256 abea59e54d38ffb6276c27d8e6d4fb104ec1f4934bfd52b81700704e0409f70a

See more details on using hashes here.

Supported by

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