Skip to content

Commit

Permalink
Revert "Merge master and resolve conflicts"
Browse files Browse the repository at this point in the history
This reverts commit 5c7e102, reversing
changes made to 482e9bc.
  • Loading branch information
Cryp Toon committed Apr 7, 2024
1 parent 5c7e102 commit af88501
Show file tree
Hide file tree
Showing 19 changed files with 1,115 additions and 1,027 deletions.
7 changes: 0 additions & 7 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
RELEASE 0.6.15 - Small bugfixes, documentation updates
======================================================
* Some small bugfixes
* New properties for WalletKey class for multisig wallets
* Add Bcoin documentation, add FAQ, update other documentation
* Add dockerfile for Linux Mint

RELEASE 0.6.14 - Update installation instruction, docker & bugfixes
===================================================================
* Update installation instructions
Expand Down
38 changes: 15 additions & 23 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ Python Bitcoin Library
Bitcoin cryptocurrency Library writen in Python.

Allows you to create a fully functional Bitcoin wallet with a single line of code.
Use this library to create and manage transactions, addresses/keys, wallets, mnemonic password phrases
and blocks with simple and straightforward Python code.
Use this library to create and manage transactions, addresses/keys, wallets, mnemonic password phrases and blocks with
simple and straightforward Python code.

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

The BitcoinLib connects to various service providers automatically to update wallets, transaction and
blockchain information. You can also connect to a local
`Bitcoin <https://bitcoinlib.readthedocs.io/en/latest/source/_static/manuals.setup-bitcoind-connection.html>`_ or
`Bcoin node <https://bitcoinlib.readthedocs.io/en/latest/source/_static/manuals.setup-bcoin.html>`_.

blockchain information.

.. image:: https://github.com/1200wd/bitcoinlib/actions/workflows/unittests.yaml/badge.svg
:target: https://github.com/1200wd/bitcoinlib/actions/workflows/unittests.yaml
Expand All @@ -33,7 +30,7 @@ blockchain information. You can also connect to a local
Install
-------

Install required packages on Ubuntu or related Linux systems:
Installed required packages

.. code-block:: bash
Expand All @@ -45,11 +42,9 @@ Then install using pip
$ pip install bitcoinlib
Check out the `more detailed installation instructions <https://bitcoinlib.readthedocs.io/en/latest/source/_static/manuals.install.html>`_ to read how to install on other systems or for
troubleshooting.
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

If you are using docker you can check some Dockerfiles to create images in the
`docker <https://github.com/1200wd/bitcoinlib/tree/master/docker>`_ directory.
If you are using docker you can check some Dockerfiles to create images in the docker directory.

Documentation
-------------
Expand All @@ -70,7 +65,7 @@ Example: Create wallet and generate new address (key) to receive bitcoins
>>> from bitcoinlib.wallets import Wallet
>>> w = Wallet.create('Wallet1')
>>> w.get_key().address
'bc1qk25wwkvz3am9smmm3372xct5s7cwf0hmnq8szj'
'1Fo7STj6LdRhUuD1AiEsHpH65pXzraGJ9j'
Now send a small transaction to your wallet and use the scan() method to update transactions and UTXO's

Expand All @@ -84,27 +79,23 @@ If successful a transaction ID is returned

.. code-block:: pycon
>>> t = w.send_to('bc1qemtr8ywkzg483g8m34ukz2l4pl3730776vzq54', '0.001 BTC', offline=False)
>>> t = w.send_to('1PWXhWvUH3bcDWn6Fdq3xhMRPfxRXTjAi1', '0.001 BTC', offline=False)
'b7feea5e7c79d4f6f343b5ca28fa2a1fcacfe9a2b7f44f3d2fd8d6c2d82c4078'
>>> t.info # Shows transaction information and send results
More examples
-------------

You can find many more examples in the `documentation <https://bitcoinlib.readthedocs.io/en/latest/>`_
for instance about the `Wallet.create() <https://bitcoinlib.readthedocs.io/en/latest/source/bitcoinlib.wallets.html#bitcoinlib.wallets.Wallet.create>`_ method.

There are many working examples on how to create wallets, specific transactions, encrypted databases, parse the
blockchain, connect to specific service providers in the `examples directory <https://github.com/1200wd/bitcoinlib/tree/master/examples>`_ in the source code of this library.
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

Some more specific examples can be found on the `Coineva website <https://coineva.com/category/bitcoinlib.html>`_.

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>`_
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
Expand All @@ -124,12 +115,13 @@ Implements the following Bitcoin Improvement Proposals
Future / Roadmap
----------------

- Fully support timelocks
- Support Taproot and Schnorr signatures
- 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
Expand Down
2 changes: 1 addition & 1 deletion bitcoinlib/config/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.15
0.6.14
17 changes: 8 additions & 9 deletions bitcoinlib/services/bitcoind.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,10 @@ class BitcoindClient(BaseClient):
"""

@staticmethod
@deprecated
def from_config(configfile=None, network='bitcoin', **kwargs):
def from_config(configfile=None, network='bitcoin', *args):
"""
Read settings from bitcoind config file
Obsolete: does not work anymore, passwords are not stored in bitcoin config, only hashed password.
:param configfile: Path to config file. Leave empty to look in default places
:type: str
:param network: Bitcoin mainnet or testnet. Default is bitcoin mainnet
Expand Down Expand Up @@ -116,7 +113,7 @@ def from_config(configfile=None, network='bitcoin', **kwargs):
server = _read_from_config(config, 'rpc', 'externalip', server)

url = "http://%s:%s@%s:%s" % (config.get('rpc', 'rpcuser'), config.get('rpc', 'rpcpassword'), server, port)
return BitcoindClient(network, url, **kwargs)
return BitcoindClient(network, url, *args)

def __init__(self, network='bitcoin', base_url='', denominator=100000000, *args):
"""
Expand All @@ -132,7 +129,6 @@ def __init__(self, network='bitcoin', base_url='', denominator=100000000, *args)
if isinstance(network, Network):
network = network.name
if not base_url:
_logger.warning("Please provide rpc connection url to bitcoind node")
bdc = self.from_config('', network)
base_url = bdc.base_url
network = bdc.network
Expand Down Expand Up @@ -336,9 +332,12 @@ def getinfo(self):

from pprint import pprint

# Connect by specifying connection URL
base_url = 'http://bitcoinrpc:passwd@host:8332'
bdc = BitcoindClient(base_url=base_url)
# 1. Connect by specifying connection URL
# base_url = 'http://bitcoinrpc:passwd@host:8332'
# bdc = BitcoindClient(base_url=base_url)

# 2. Or connect using default settings or settings from config file
bdc = BitcoindClient()

print("\n=== SERVERINFO ===")
pprint(bdc.proxy.getnetworkinfo())
Expand Down
10 changes: 2 additions & 8 deletions bitcoinlib/services/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Service(object):

def __init__(self, network=DEFAULT_NETWORK, min_providers=1, max_providers=1, providers=None,
timeout=TIMEOUT_REQUESTS, cache_uri=None, ignore_priority=False, exclude_providers=None,
max_errors=SERVICE_MAX_ERRORS, strict=True, wallet_name=None):
max_errors=SERVICE_MAX_ERRORS, strict=True):
"""
Create a service object for the specified network. By default, the object connect to 1 service provider, but you
can specify a list of providers or a minimum or maximum number of providers.
Expand Down Expand Up @@ -131,7 +131,6 @@ def __init__(self, network=DEFAULT_NETWORK, min_providers=1, max_providers=1, pr
self._blockcount = None
self.cache = None
self.cache_uri = cache_uri
self.wallet_name = wallet_name
try:
self.cache = Cache(self.network, db_uri=cache_uri)
except Exception as e:
Expand Down Expand Up @@ -167,13 +166,8 @@ def _provider_execute(self, method, *arguments):
continue
client = getattr(services, self.providers[sp]['provider'])
providerclient = getattr(client, self.providers[sp]['client_class'])

base_url = self.providers[sp]['url']
if 'bitcoind' in sp and self.wallet_name is not None:
base_url = f"{base_url}/wallet/{self.wallet_name}"

pc_instance = providerclient(
self.network, base_url, self.providers[sp]['denominator'],
self.network, self.providers[sp]['url'], self.providers[sp]['denominator'],
self.providers[sp]['api_key'], self.providers[sp]['provider_coin_id'],
self.providers[sp]['network_overrides'], self.timeout, self._blockcount, self.strict)
if not hasattr(pc_instance, method):
Expand Down
Loading

0 comments on commit af88501

Please sign in to comment.