Skip to content

Commit

Permalink
Merge branch 'master' into add-blockbook-docu
Browse files Browse the repository at this point in the history
  • Loading branch information
mccwdev authored Nov 15, 2024
2 parents 3ea7463 + f8e7d2b commit 3a134d5
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 36 deletions.
4 changes: 2 additions & 2 deletions docs/_static/manuals.add-provider.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Add a new Service Provider
==========================

The Service class connects to providers such as Blockchain.info or Blockchair.com to retreive transaction,
The Service class connects to providers such as Blockchain.info or Blockchair.com to retrieve transaction,
network, block, address information, etc

The Service class automatically selects a provider which has requested method available and selects another
Expand Down Expand Up @@ -70,7 +70,7 @@ Example:
* Remove install.log file in bitcoinlib's log directory, this will copy all provider settings next time you run
the bitcoin library. See 'initialize_lib' method in main.py
* Specify new provider and create service class object to test your new class and it's method
* Specify new provider and create service class object to test your new class and its method

.. code-block:: python
Expand Down
8 changes: 4 additions & 4 deletions docs/_static/manuals.caching.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Caching
=======

Results from queries to service providers are store in a cache database. Once transactions are confirmed and stored
Results from queries to service providers are stored in a cache database. Once transactions are confirmed and stored
on the blockchain they are immutable, so they can be stored in a local cache for an indefinite time.

What is cached?
Expand Down Expand Up @@ -43,12 +43,12 @@ Nothing is cached, what is the problem?
- If the min_providers parameter is set to 2 or more caching will be disabled.
- If a service providers returns an incomplete result no cache will be stored.
- If the after_txid parameter is used in gettransactions() or getutxos() no cache will be stored if this
the 'after_txid' transaction is not found in the cache. Because the transaction cache has to start from the first
'after_txid' transaction is not found in the cache. Because the transaction cache has to start from the first
transaction for a certain address and no gaps can occur.

I get incomplete or incorrect results!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Please post an issues in the Github issue-tracker so we can take a look.
- Please post an issue in the Github issue-tracker so we can take a look.
- You can delete the database in ~/.bitcoinlib/databases/bitcoinlib_cache.sqlite for an easy fix, or disable caching
if that really doesn't work out.
if that really doesn't work out.
12 changes: 6 additions & 6 deletions docs/_static/manuals.command-line-wallet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The Command Line wallet Script can be found in the tools directory. If you call
arguments it will show all available wallets.

Specify a wallet name or wallet ID to show more information about a wallet. If you specify a wallet
which doesn't exists the script will ask you if you want to create a new wallet.
which doesn't exist the script will ask you if you want to create a new wallet.


Create wallet
Expand Down Expand Up @@ -99,7 +99,7 @@ Encrypt private key fields
--------------------------

Bitcoinlib has build in functionality to encrypt private key fields in the database. If you provide a password in
the runtime environment the data is encrypted at low level in de database module. You can provide a 32 byte key
the runtime environment the data is encrypted at low level in the database module. You can provide a 32 byte key
in the DB_FIELD_ENCRYPTION_KEY variable or a password in the DB_FIELD_ENCRYPTION_PASSWORD variable.

.. code-block:: bash
Expand Down Expand Up @@ -285,7 +285,7 @@ We now have some utxo's in our wallet so we can create a transaction
Copy the contents of the dictionary and save it as 3b96f493d189667565271041abbc0efbd8631bb54d76decb90e144bb145fa613.tx
The transaction has been created, but cannot be verified because the wallet contains only 1 private key. So we need to
create another wallet with the other private key, in real life situations this would be on another (offiline) machine.
create another wallet with the other private key, in real life situations this would be on another (offline) machine.
Below we create a new wallet, generate a receive address and update the utxo's. Finally we can import the transaction
dictionary which we be signed once imported. And as you can see the transaction has been verified now!
Expand Down Expand Up @@ -355,7 +355,7 @@ options:
--witness-type WITNESS_TYPE, -j WITNESS_TYPE
Witness type of wallet: legacy, p2sh-segwit or segwit (default)
--yes, -y Non-interactive mode, does not prompt for confirmation
--quiet, -q Quiet mode, no output writen to console
--quiet, -q Quiet mode, no output written to console
Wallet Actions:
--wallet-remove Name or ID of wallet to remove, all keys and transactions will be deleted
Expand All @@ -367,7 +367,7 @@ Wallet Actions:
empty wallet again to restore your wallet.
--receive, -r Show unused address to receive funds.
--cosigner-id COSIGNER_ID, -o COSIGNER_ID
Set this if wallet contains only public keys, more then one private key or if you would like to create keys for other cosigners.
Set this if wallet contains only public keys, more than one private key or if you would like to create keys for other cosigners.
--export-private, -e Export private key for this wallet and exit
--import-private IMPORT_PRIVATE, -v IMPORT_PRIVATE
Import private key in this wallet
Expand Down Expand Up @@ -422,6 +422,6 @@ options:
URI of the database to use
--receive, -r Show unused address to receive funds.
--yes, -y Non-interactive mode, does not prompt for confirmation
--quiet, -q Quiet mode, no output writen to console
--quiet, -q Quiet mode, no output written to console
4 changes: 2 additions & 2 deletions docs/_static/manuals.databases.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Using MySQL or PostgreSQL databases
===================================

Bitcoinlib uses the SQLite database by default, because it easy to use and requires no installation.
Bitcoinlib uses the SQLite database by default, because it is easy to use and requires no installation.

But you can also use other databases. At this moment Bitcoinlib is tested with MySQL and PostgreSQL.

Expand All @@ -16,7 +16,7 @@ We assume you have a MySQL server at localhost. Unlike with the SQLite database
mysql> create database bitcoinlib;
Now create a user for your application and grant this user access. And off course replace the password 'secret' with
Now create a user for your application and grant this user access. And of course replace the password 'secret' with
a better password.

.. code-block:: mysql
Expand Down
9 changes: 5 additions & 4 deletions docs/_static/manuals.faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ I run into an error 'x' when installing Bitcoinlib
2. Install the required packages one-by-one using pip install, and see if you get any specific errors.
3. Check for help in `Github Discussions <https://github.com/1200wd/bitcoinlib/discussions>`_.
4. See if you find any known `issue <https://github.com/1200wd/bitcoinlib/issues>`_.
5. If it doesn't work out, do not hesitate to ask you question in the github discussions or post an issue!
5. If it doesn't work out, do not hesitate to ask your question in the github discussions or post an issue!

Does Bitcoinlib support 'x'-coin
--------------------------------
Expand All @@ -36,9 +36,10 @@ Most likely cause is a problem with a specific service provider.
Please set log level to 'debug' and check the logs in bitcoinlib.log to see if you can pin down the specific error.
You could then disable the provider and post the `issue <https://github.com/1200wd/bitcoinlib/issues>`_.

To avoid these kind of errors it is advised to run your local `Bcoin node <manuals.setup-bcoin.html>`_ or
To avoid these kinds of errors it is advised to run your local `Bcoin node <manuals.setup-bcoin.html>`_ or
`Blockbook server <manuals.setup-blockbook.html>`_.
With a local Bcoin node you do not depend on external Service providers which increases reliability, security, speed

With a local Bcoin node or Blockbook server you do not depend on external Service providers which increases reliability, security, speed
and privacy.

Can I use Bitcoinlib with another database besides SQLite?
Expand All @@ -59,7 +60,7 @@ I have another question
Maybe your question already has an answer om `Github Discussions <https://github.com/1200wd/bitcoinlib/discussions>`_.
Or search for an answer is this `documentation <https://bitcoinlib.readthedocs.io/en/latest/>`_.

If that does not answer your question, please post your question on on the
If that does not answer your question, please post your question on the
`Github Discussions Q&A <https://github.com/1200wd/bitcoinlib/discussions/categories/q-a>`_.


Expand Down
8 changes: 4 additions & 4 deletions docs/_static/manuals.security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ Ten tips for more privacy and security when using Bitcoin and Bitcoinlib:
This not only increases your privacy, but also makes your application much faster and more reliable. And as extra bonus
you support the Bitcoin network.
2. Use multi-signature wallets. So you are able to store your private keys in separate (offline) locations.
3. Use a minimal amount of inputs when creating a transaction. This is default behavior the Bitcoinlib Wallet
3. Use a minimal amount of inputs when creating a transaction. This is default behavior of the Bitcoinlib Wallet
object. You can set a hard limit when sending from a wallet with the max_utxos=1 attribute.
4. Use a random number of change outputs and shuffle order of inputs and outputs. This way it is not visible
which output is the change output. In the Wallet object you can set the number_of_change_outputs to zero to
generate a random number of change outputs.
5. `Encrypt your database or private keys <manuals.sqlcipher.html>`_ with SQLCipher or AES.
6. Use password protected private keys. For instance use a password when
`creating wallets <https://bitcoinlib.readthedocs.io/en/latest/source/bitcoinlib.wallets.html#bitcoinlib.wallets.Wallet.create>`_.
7. Backup private keys and passwords! I have no proof but I assume more bitcoins are lost because of lost private keys then there are lost due to hacking...
7. Backup private keys and passwords! I have no proof but I assume more bitcoins are lost because of lost private keys than there are lost due to hacking...
8. When using Bitcoinlib wallets the private keys are stored in a database. Make sure the database is in a safe location
and check encryption, access rights, etc. Also check tip 2 and 5 again and see how you can minimize risks.
9. Test, try, review. Before working with any real value carefully test your applications using the testnet or small value transactions.
10. Read this tips, read some more about `Security <https://en.bitcoin.it/wiki/Storing_bitcoins>`_ and `Privacy <https://en.bitcoin.it/wiki/Privacy>`_
and then think thorough about the best wallet setup, which is always a tradeoff between security, privacy and usability.
10. Read these tips, read some more about `Security <https://en.bitcoin.it/wiki/Storing_bitcoins>`_ and `Privacy <https://en.bitcoin.it/wiki/Privacy>`_
and then think thoroughly about the best wallet setup, which is always a tradeoff between security, privacy and usability.
10 changes: 5 additions & 5 deletions docs/_static/manuals.setup-bitcoind-connection.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
How to connect bitcoinlib to a Bitcoin node
===========================================

This manual explains how to connect to a bitcoind server on your localhost or an a remote server.
This manual explains how to connect to a bitcoind server on your localhost or a remote server.

Running your own bitcoin node allows you to create a large number of requests, faster response times,
and more control, privacy and independence. However you need to install and maintain it and it used
and more control, privacy and independence. However you need to install and maintain it and it uses
a lot of resources.

.. warning::
With a standard Bitcoin node you can only retrieve block and transaction information. You can not
query the node for information about specific addresses. So it not suitable to run in combination with a Bitcoinlib
query the node for information about specific addresses. So it is not suitable to run in combination with a Bitcoinlib
wallet. If you would like to use Bitcoinlib wallets and not be dependent on external providers you should use a
`Bcoin node <manuals.setup-bcoin.html>`_ or `Blockbook server <manuals.setup-blockbook.html>`_ instead.

Expand Down Expand Up @@ -77,7 +77,7 @@ Example:
Connect using base_url argument
-------------------------------

You can also directly pass connection string wit the 'base_url' argument in the BitcoindClient object.
You can also directly pass connection string with the 'base_url' argument in the BitcoindClient object.

This provides more flexibility but also the responsibility to store user and password information in a secure way.

Expand Down Expand Up @@ -115,4 +115,4 @@ Using RPC over a public network is unsafe, so since bitcoind version 0.18 remote
are disabled. The rpcallowip option cannot be used to listen on all network interfaces and rpcbind has to be used to
define specific IP addresses to listen on. See https://bitcoin.org/en/release/v0.18.0#configuration-option-changes

You could setup a openvpn or ssh tunnel to connect to a remote server to avoid this issues.
You could setup an openvpn or ssh tunnel to connect to a remote server to avoid this issues.
10 changes: 5 additions & 5 deletions docs/_static/manuals.sqlcipher.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Encrypt Database or Private Keys
================================

If you database contains private keys it is a good idea to encrypt your data. This will not be done automatically. At the moment you have 2 options:
If your database contains private keys it is a good idea to encrypt your data. This will not be done automatically. At the moment you have 2 options:

- Encrypt the database with SQLCipher. The database is fully encrypted and you need to provide the password in the Database URI when opening the database.
- Use a normal database but all private key data will be stored AES encrypted in the database. A key to encrypt and decrypt need to be provided in the Environment.
- Use a normal database but all private key data will be stored AES encrypted in the database. A key to encrypt and decrypt needs to be provided in the Environment.

Encrypt database with SQLCipher
-------------------------------
Expand Down Expand Up @@ -35,7 +35,7 @@ Now you can simply create and use an encrypted database by supplying a password
**Encrypt using Database URI**

You can also use a SQLCipher database URI to create and query a encrypted database:
You can also use a SQLCipher database URI to create and query an encrypted database:

.. code-block:: python
Expand Down Expand Up @@ -75,7 +75,7 @@ You can provide an encryption key directly or use a password to create a key:
>>> Key().private_hex()
'2414966ea9f2de189a61953c333f61013505dfbf8e383b5ed6cb1981d5ec2620'
This key needs to be stored in the environment when creating or accessing a wallet. No extra arguments have to be provided to the Wallet class, the data is encrypted an decrypted at database level.
This key needs to be stored in the environment when creating or accessing a wallet. No extra arguments have to be provided to the Wallet class, the data is encrypted and decrypted at database level.

2. You can also just provide a password, and let Bitcoinlib create a key for you. You will need to pass the DB_FIELD_ENCRYPTION_PASSWORD environment variable.

Expand All @@ -99,4 +99,4 @@ Or in Windows:
Environment variables can also be stored in an .env key, in a virtual environment or in Python code itself. However anyone with access to the key can decrypt your private keys.

Please make sure to remember and backup your encryption key or password, if you loose your key the private keys can not be recovered!
Please make sure to remember and backup your encryption key or password, if you lose your key the private keys can not be recovered!
4 changes: 2 additions & 2 deletions docs/_static/script-types-overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ Bitcoinlib script support
The 'pubkey' lockscript and 'signature' unlocking script are ancient and not supported by BitcoinLib at
the moment.

Using different encodings for addresses then the one listed in the Locking Script table is possible but
not adviced: It is not standard and not sufficiently tested.
Using different encodings for addresses than the one listed in the Locking Script table is possible but
not advised: It is not standard and not sufficiently tested.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Welcome to Bitcoinlib's documentation!
======================================

Bitcoin cryptocurrency Library writen in Python.
Bitcoin cryptocurrency Library written in Python.

Allows you to create a fully functional wallet with a single line of code.
Use this library to create and manage transactions, addresses/keys, wallets, mnemonic password phrases and blocks with
Expand Down Expand Up @@ -194,7 +194,7 @@ http://bitcoinlib.readthedocs.io/en/latest/_static/manuals.command-line-wallet.h
Service providers
-----------------
Communicates with pools of bitcoin service providers to retreive transaction, address, blockchain information.
Communicates with pools of bitcoin service providers to retrieve transaction, address, blockchain information.
To push a transaction to the network. To determine optimal service fee for a transaction. Or to update your
wallet's balance.
Expand Down

0 comments on commit 3a134d5

Please sign in to comment.