{"id":19345200,"url":"https://github.com/mkbeh/aiobitcoin","last_synced_at":"2025-04-23T04:36:26.026Z","repository":{"id":34861705,"uuid":"185234495","full_name":"mkbeh/aiobitcoin","owner":"mkbeh","description":"Async Bitcoin/forks JSON-RPC library","archived":false,"fork":false,"pushed_at":"2023-07-20T15:09:24.000Z","size":213,"stargazers_count":1,"open_issues_count":2,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-02T08:22:06.864Z","etag":null,"topics":["async-bitcoin","bip32","bitcoin","mnemonic-passwords"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkbeh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-06T16:36:30.000Z","updated_at":"2023-11-14T10:26:34.000Z","dependencies_parsed_at":"2022-09-15T07:21:50.880Z","dependency_job_id":null,"html_url":"https://github.com/mkbeh/aiobitcoin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Faiobitcoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Faiobitcoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Faiobitcoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkbeh%2Faiobitcoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkbeh","download_url":"https://codeload.github.com/mkbeh/aiobitcoin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372462,"owners_count":21419719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-bitcoin","bip32","bitcoin","mnemonic-passwords"],"created_at":"2024-11-10T04:05:20.373Z","updated_at":"2025-04-23T04:36:25.101Z","avatar_url":"https://github.com/mkbeh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aiobitcoin\n\n![](https://img.shields.io/pypi/v/aiobitcoin.svg?style=flat)\n[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)\n[![Documentation Status](https://readthedocs.org/projects/aiobitcoin/badge/?version=latest)](http://aiobitcoin.readthedocs.io/?badge=latest)\n[![GitHub issues](https://img.shields.io/github/issues/Naereen/StrapDown.js.svg)](https://GitHub.com/Naereen/StrapDown.js/issues/)\n\nThis is a library that provides methods for working \nwith Bitcoin/forks daemon JSON-RPC.\n\nAlso there are tools for working with bip32 hierarchical \ndeterministic wallets in this library . These tools were taken \nfrom three different libraries such as \n[bitcoinlib](https://github.com/1200wd/bitcoinlib), \n[btclib](https://github.com/fametrano/btclib) and\n[pycoin](https://github.com/richardkiss/pycoin) ,\nbecause I had problems while importing keys and addresses \nto the Bitcoin Core when working with each of them separately.\n\n[Examples](https://aiobitcoin.readthedocs.io/en/latest/examples.html)\n\n[Documentation](https://aiobitcoin.readthedocs.io/en/latest/)\n\n`NOTE #0: this lib works successful with Bitcoin Core 0.17.1 , \nother wallet versions not tested.`\n\n`NOTE #1: At the moment, not all available methods are \nimplemented in the library , only the most common.`\n\n**Donate me if you like it :)**\n```bash\nBitshares account -\u003e mkbehforever007\nbitcoin -\u003e bc1qqkr72aemz59aawxf74gytrwuw4m9mj20t7e7df\nethereum -\u003e 0xB3e5b643cFB9e2565a3456eC7c7A73491A32e31F\n```\n\n## Supports\n* **Basic methods for asynchronous work with Bitcoin/forks\nJSON-RPC**\n* **Mnemonic key generation**\n* **BIP32 hierarchical deterministic wallets**\n\n## Installation\n```bash\nsudo apt install python-dev python3-dev\nsudo apt install libssl-dev\npip3 install aiobitcoin\n```\n\n## Quickstart\n**Simple usage:**\n```python\n    import asyncio\n    from aiobitcoin.blockchain import Blockchain\n\n\n    async def foo():\n        blockchain = Blockchain(url='http://alice:bob@127.0.0.1:18332')\n        difficulty = await blockchain.get_difficulty()\n        block_count = await blockchain.get_block_count()\n        print(difficulty)\n        print(block_count)\n        await blockchain.close_session()\n\n    ioloop = asyncio.get_event_loop()\n    ioloop.run_until_complete(foo())\n```\n\n**or use the same with context manager:**\n```python\n    import asyncio\n    from aiobitcoin.blockchain import Blockchain\n\n\n    async def foo():\n        async with Blockchain(url='http://alice:bob@127.0.0.1:18332') as blockchain:\n            difficulty = await blockchain.get_difficulty()\n            block_count = await blockchain.get_block_count()\n            print(difficulty)\n            print(block_count)\n\n\n    ioloop = asyncio.get_event_loop()\n    ioloop.run_until_complete(foo())\n```\n    \n\n**Working with bip32**\n\n`All keys can be imported without problems to Bitcoin Core.`\n\n```python\n    from aiobitcoin.tools import bip32\n    from aiobitcoin.tools.bip32 import MAINNET_PRV, TESTNET_PRV\n    from aiobitcoin.tools.key.Key import Key\n    from aiobitcoin.mnemonic import Mnemonic\n\n    # -- Generate mnemonic phrase --\n    ceed = Mnemonic().generate(encoding=False)\n\n    # ... Output: rebel swear tomorrow burger cave giraffe ...\n\n    # -- Generate master keys from ceed for BTC mainnet and testnet --\n    testnet_mxpriv = bip32.xmprv_from_seed(ceed, TESTNET_PRV)\n    # ... Output: tprv8ZgxMBicQKsPe6tqMpq6qyzFoFSr3cgh...\n\n    mainnet_mxpriv = bip32.xmprv_from_seed(ceed, MAINNET_PRV)\n    # ... Output: xprv9s21ZrQH143K4Q9MazKYy5Kuck31yFeT...\n\n    # -- Generate master public keys from master private key --\n    testnet_mxpub = bip32.xpub_from_xprv(testnet_mxpriv)\n    mainnet_mxpub = bip32.xpub_from_xprv(mainnet_mxpriv)\n\n    # ... Output: tpubD6NzVbkrYhZ4X5ghC8mzzsGuMQCxEmnh5Y...\n    # ... Output: xpub661MyMwAqRbcFHVqjwnunwwY2H7JFPHdXv...\n\n    # -- Transform master private key to WIF format and getting address of master key --\n    key = Key.from_text(mainnet_mxpriv)\n\n    wif = key.wif()\n    # ... Output: L4PEssMfRgHvmpyEGxHJkFVcNWeQvZiySNMAa...\n\n    addr = key.address()\n    # ... Output: 1BGLari4SCxGXoJib27C8pAL6Ef3pFqswD\n\n    # -- Create sub key by custom derive path --\n    subkey = key.subkey_for_path('1/0/{}'.format(11))\n\n    addr = subkey.address(use_uncompressed=False)\n    wif = subkey.wif()\n```\n\n## Roadmap\n* Add all available methods to work with Bitcoin/forks JSON-RPC\n* Rewrite to async `Key` tool\n* Add DASH, LTC supporting\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkbeh%2Faiobitcoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkbeh%2Faiobitcoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkbeh%2Faiobitcoin/lists"}